• September 19, 2021, 12:50:30 AM

### Author Topic: (Question) how do I even calculate a new reference point for perturbation in glsl?  (Read 198 times)

0 Members and 1 Guest are viewing this topic.

#### Mr Rebooted

• Posts: 74
##### (Question)how do I even calculate a new reference point for perturbation in glsl?
« on: September 09, 2021, 01:53:47 PM »
hey guys, I dunno if I already asked this question before, but ill post this anyways

so I actually figured out how to make arbitrary precision floats in glsl, but I ran into a problem when playing with this

when trying to implement perturbation theory, I already know that I could iterate z=z^2+c at arbitrary precision, and calculate dz = 2*z*dz+dz^2+dc at the normal floating point precision, with c being the coordinates, and dc being the screen coordinates. now here's the main problem: how do I even calculate a new reference point if z escaped too early or something like that?

I'm completely new to this stuff and still can't figure out how to implement perturbation theory correctly yet lol

#### superheal

• Fractal Friar
• Posts: 111
##### Re: how do I even calculate a new reference point for perturbation in glsl?
« Reply #1 on: September 09, 2021, 04:06:15 PM »
I recently added perturbation theory to my software, and I got away with calculating only one ref point using this:
https://fractalforums.org/fractal-mathematics-and-new-theories/28/another-solution-to-perturbation-glitches/4360

#### superheal

• Fractal Friar
• Posts: 111
##### Re: how do I even calculate a new reference point for perturbation in glsl?
« Reply #2 on: September 09, 2021, 04:07:25 PM »
basically you reuse the reference from the beginning.
I dont know why it works, and if there is some special condition that it brakes, but I guess you should give it a try.

#### Mr Rebooted

• Posts: 74
##### Re: how do I even calculate a new reference point for perturbation in glsl?
« Reply #3 on: September 09, 2021, 04:56:34 PM »
basically you reuse the reference from the beginning.
I dont know why it works, and if there is some special condition that it brakes, but I guess you should give it a try.

It works but the performance severely drops when I increase the maximum number of iterations to around 30

#### 3DickUlus

• Posts: 2460
##### Re: how do I even calculate a new reference point for perturbation in glsl?
« Reply #4 on: September 10, 2021, 03:06:18 AM »
Arbitrary precision in GLSL ? Do you have any benchmark comparisons between GPU vs same calculations on CPU ?

#### quaz0r

• Fractal Feline
• Posts: 165
##### Re: how do I even calculate a new reference point for perturbation in glsl?
« Reply #5 on: September 10, 2021, 05:48:26 AM »
i think when programming gpu compute sort of stuff people are just used to the mindset of the whole implementation running on the gpu.  3dick is right though, one should definitely prefer running the arbitrary precision on the cpu and copying the results over.. unless someone comes up with some spectacularly parallelizable gpu implementation of arbitrary precision that allows for large numbers to run faster than on cpu.. i know gmp/mpfr utilizes simd in some fashion, so maybe its possible?

#### 3DickUlus

• Posts: 2460
##### Re: how do I even calculate a new reference point for perturbation in glsl?
« Reply #6 on: September 10, 2021, 06:14:45 AM »
the only test results I have on hand are for garprec.. kinda old but it works quite well.. (removed  the ref and gold values... too much text for bbc editor)

results for varying conditions, temp storage in registers, const mem etc.... should give some idea of how fast it might be... (or should be?) this was done on an older GPU (14 years)

Code: [Select]
*********************omp_num_threads = 16n_digits = 500prec_words = 36, 36MAX_PREC_WORDS = 140n_words = 41numElement = 100000*********************Prepare data................................. done.test_add ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU add: 0.003 sec ****** CPU add: 0.919 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_mul ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU mul: 0.041 sec ****** CPU mul: 0.163 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_div ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU div: 0.046 sec ****** CPU div: 0.174 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_sqrt ........................................*** all are stored in the global memory ****** gmparray_sqrt_alldevice_kernel processing time: 0.2166 sec ****** GPU sqrt: 0.218 sec ****** CPU sqrt: 0.598 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_div ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU div: 0.046 sec ****** CPU div: 0.156 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_exp ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_exp_alldevice_kernel processing time: 3.4930 sec ****** GPU exp: 3.495 sec ****** CPU exp: 5.648 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_log ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_log_alldevice_kernel processing time: 4.8349 sec ****** GPU log: 4.837 sec ****** CPU log: 9.704 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_sin ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_sin_alldevice_kernel processing time: 2.5348 sec ****** GPU sin: 2.538 sec ****** CPU sin: 4.149 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_cos ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_cos_alldevice_kernel processing time: 2.5340 sec ****** GPU cos: 2.537 sec ****** CPU cos: 4.049 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_tan ........................................numBlock = 2400, numThread = 64numElement = 100000, interval = 100000all intermediate results are stored in the device memory.Additional global memory allocated: 456.311 MB*** gmparray_tan_alldevice_kernel processing time: 2.5767 sec ****** GPU sin: 2.583 sec ****** CPU sin: 4.434 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ************************omp_num_threads = 16n_digits = 1000prec_words = 71, 71MAX_PREC_WORDS = 140n_words = 76numElement = 100000*********************Prepare data................................. done.test_add ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU add: 0.006 sec ****** CPU add: 0.299 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_mul ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU mul: 0.151 sec ****** CPU mul: 0.387 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_div ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU div: 0.157 sec ****** CPU div: 0.406 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_sqrt ........................................*** all are stored in the global memory ****** gmparray_sqrt_alldevice_kernel processing time: 0.6453 sec ****** GPU sqrt: 0.647 sec ****** CPU sqrt: 1.068 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_div ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU div: 0.157 sec ****** CPU div: 0.454 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_exp ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_exp_alldevice_kernel processing time: 18.5557 sec ****** GPU exp: 18.558 sec ****** CPU exp: 28.202 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_log ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_log_alldevice_kernel processing time: 16.2324 sec ****** GPU log: 16.235 sec ****** CPU log: 27.865 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***A sample when i = 50635test_sin ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_sin_alldevice_kernel processing time: 11.8242 sec ****** GPU sin: 11.828 sec ****** CPU sin: 16.814 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_cos ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_cos_alldevice_kernel processing time: 11.7783 sec ****** GPU cos: 11.782 sec ****** CPU cos: 17.615 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_tan ........................................numBlock = 2400, numThread = 64numElement = 100000, interval = 100000all intermediate results are stored in the device memory.Additional global memory allocated: 837.842 MB*** gmparray_tan_alldevice_kernel processing time: 11.8942 sec ****** GPU sin: 11.898 sec ****** CPU sin: 16.617 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ************************omp_num_threads = 16n_digits = 1500prec_words = 105, 105MAX_PREC_WORDS = 140n_words = 110numElement = 100000*********************Prepare data................................. done.test_add ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU add: 0.008 sec ****** CPU add: 0.226 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_mul ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU mul: 0.324 sec ****** CPU mul: 0.745 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_div ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU div: 0.331 sec ****** CPU div: 0.863 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_sqrt ........................................*** all are stored in the global memory ****** gmparray_sqrt_alldevice_kernel processing time: 0.6480 sec ****** GPU sqrt: 0.649 sec ****** CPU sqrt: 1.305 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_div ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU div: 0.331 sec ****** CPU div: 0.817 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_exp ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_exp_alldevice_kernel processing time: 52.2951 sec ****** GPU exp: 52.297 sec ****** CPU exp: 75.953 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_log ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_log_alldevice_kernel processing time: 23.5067 sec ****** GPU log: 23.510 sec ****** CPU log: 41.223 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_sin ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_sin_alldevice_kernel processing time: 30.6239 sec ****** GPU sin: 30.628 sec ****** CPU sin: 42.769 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_cos ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_cos_alldevice_kernel processing time: 30.5215 sec ****** GPU cos: 30.525 sec ****** CPU cos: 42.718 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_tan ........................................numBlock = 2400, numThread = 64numElement = 100000, interval = 100000all intermediate results are stored in the device memory.Additional global memory allocated: 1208.472 MB*** gmparray_tan_alldevice_kernel processing time: 30.7873 sec ****** GPU sin: 30.792 sec ****** CPU sin: 43.304 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ************************omp_num_threads = 16n_digits = 2000prec_words = 140, 140MAX_PREC_WORDS = 140n_words = 145numElement = 100000*********************Prepare data................................. done.test_add ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU add: 0.010 sec ****** CPU add: 0.192 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_mul ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU mul: 0.570 sec ****** CPU mul: 1.419 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_div ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU div: 0.576 sec ****** CPU div: 1.400 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_sqrt ........................................*** all are stored in the global memory ****** gmparray_sqrt_alldevice_kernel processing time: 2.1942 sec ****** GPU sqrt: 2.196 sec ****** CPU sqrt: 6.213 sec ****** The abs. of max. rel. error = 10 ^ -2019 x 4.13787 ****** The abs. of avg. rel. error = 10 ^ -2023 x 2.68194 ***test_div ........................................numElement = 100000, interval = 100000numBlock = 2400, numThread = 64interval memory layout...*** GPU div: 0.576 sec ****** CPU div: 1.302 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_exp ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_exp_alldevice_kernel processing time: 114.9576 sec ****** GPU exp: 114.962 sec ****** CPU exp: 161.934 sec ****** The abs. of max. rel. error = 10 ^ 0 x 0 ****** The abs. of avg. rel. error = 10 ^ 0 x 0 ***test_log ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_log_alldevice_kernel processing time: 60.6657 sec ****** GPU log: 60.670 sec ****** CPU log: 166.706 sec ****** The abs. of max. rel. error = 10 ^ -2004 x 1.30254 ****** The abs. of avg. rel. error = 10 ^ -2009 x 7.07432 ***test_sin ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_sin_alldevice_kernel processing time: 66.8394 sec ****** GPU sin: 66.843 sec ****** CPU sin: 930.847 sec ****** The abs. of max. rel. error = 10 ^ -2001 x 2.79433 ****** The abs. of avg. rel. error = 10 ^ -2005 x 8.34563 ***test_cos ........................................numBlock = 2400, numThread = 64all intermediate results are stored in the device memory.*** gmparray_cos_alldevice_kernel processing time: 66.6984 sec ****** GPU cos: 66.702 sec ****** CPU cos: 824.357 sec ****** The abs. of max. rel. error = 10 ^ -2004 x 1.83821 ****** The abs. of avg. rel. error = 10 ^ -2006 x 4.47602 ***test_tan ........................................numBlock = 2400, numThread = 64numElement = 100000, interval = 100000all intermediate results are stored in the device memory.Additional global memory allocated: 1590.002 MB*** gmparray_tan_alldevice_kernel processing time: 67.2751 sec ****** GPU sin: 67.280 sec ****** CPU sin: 824.758 sec ****** The abs. of max. rel. error = 10 ^ -2001 x 2.79433 ****** The abs. of avg. rel. error = 10 ^ -2005 x 8.79323 ***
« Last Edit: September 10, 2021, 06:38:18 AM by 3DickUlus »

### Similar Topics

###### "Time Span"

Started by cricke49 on Fractal Image Gallery

0 Replies
1129 Views
August 02, 2018, 07:05:21 AM
by cricke49
###### Reference Point for Reference Orbit

Started by mrmath on Fractal Mathematics And New Theories

2 Replies
468 Views
December 10, 2017, 05:14:03 PM
by mrmath
###### Changing permutation reference point during calculation

Started by jjrv on Fractal Mathematics And New Theories

3 Replies
375 Views
October 27, 2018, 01:49:45 PM
by claude
###### How to get second reference when using Perturbation Theory?

Started by Mr Rebooted on Programming

11 Replies
551 Views
November 10, 2020, 02:03:44 PM
by Mr Rebooted
###### Original Point Color

Started by mclarekin on Color Snippets

0 Replies
161 Views
March 21, 2019, 08:12:34 AM
by mclarekin