Logo by S Nelson - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. March 29, 2024, 12:10:44 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: CUDA random numbers for threads  (Read 1759 times)
0 Members and 1 Guest are viewing this topic.
kubinator4321
Forums Freshman
**
Posts: 18


« on: January 16, 2015, 10:54:57 PM »

Hello,
I don't know, if this is the right place to ask. If it is, I'm kindly asking the moderators to move it to the proper category.

I'm currently trying to use the knowledge I got from making a mandelbrot renderer in CUDA to make a buddhabrot in CUDA. However, I came across a problem - random numbers. The very basic of a buddhabrot is iterating random numbers. In my CPU inplementation, I used the Mersenne Twister, which is included in the standard C++ libraries and has a huge period. On the GPU, however, things start getting complicated. I haven't yet figured out how to use them, and how to use them PROPERLY and EFFICIENTLY. And thus, I'm kindly asking anybody here, who has experience with that in CUDA on C++ to help me understand how to use the random numbers.

Also, if anybody here can tell me the best way to sum up the results of operations from many threads (atomic operations are slow AFAIK), or if I shouldn't bother myself with it, I'd appreciate it too.
Logged
claude
Fractal Bachius
*
Posts: 563



WWW
« Reply #1 on: January 16, 2015, 11:45:18 PM »

You need one random number generator for each thread, all uncorrelated / independent.  I think the term for generating uncorrelated RNG states is called "splitting", at least that's what the Haskell random package calls it:
http://hackage.haskell.org/package/random-1.1/docs/System-Random.html#v:split

For accumulation, maybe look into interoperability with OpenGL: collect all the points into a buffer, then draw them as points with additive blending into a floating point frame buffer (to avoid overflow issues).

Anyway, in my personal experiments with Buddhabrot I've avoided random numbers:
http://mathr.co.uk/blog/2013-12-30_ultimate_anti-buddhabrot.html
Logged
kubinator4321
Forums Freshman
**
Posts: 18


« Reply #2 on: January 17, 2015, 12:00:21 AM »

Anyway, in my personal experiments with Buddhabrot I've avoided random numbers:

I'm sorry, but I'll need to study a bit more to understand all the maths language, but do you simply go through points in rows and columns and calculate the buddhabrot for them? Because when I used to do it in C++, I got color discontinuities, as visible in these screenshoots:
http://puu.sh/dGkCK/986645bfb5.jpg
http://puu.sh/dGCSA/92bd101652.jpg
Logged
claude
Fractal Bachius
*
Posts: 563



WWW
« Reply #3 on: January 17, 2015, 12:14:21 AM »

basically yes, but note that if you zoom into the buddhabrot, you still have to calculate iterates from across the whole mandelbrot set because the iterates jump around a lot.  i saw this about fast zooming, but the maths is even more intense than my blog post cheesy http://www.moleculardensity.net/buddhabrot/appendix/1
Logged
kubinator4321
Forums Freshman
**
Posts: 18


« Reply #4 on: January 17, 2015, 10:45:17 AM »

if you zoom into the buddhabrot, you still have to calculate iterates from across the whole mandelbrot set

Actually, maybe I should precalculate many starting points and small random numbers, and assign a starting point+random number for each thread? This theoretically should give nice results...
Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #5 on: January 29, 2015, 04:10:13 PM »

I use Mersenne twister, it's fast (non-crypto) and "good enough for me".
You can find my openCL code here : https://github.com/ker2x/WinBuddhaOpenCL/blob/master/WinBuddhaOpenCL/BuddhaCloo.cs


Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Cave with weird threads Images Showcase (Rate My Fractal) BradC 3 1688 Last post September 09, 2010, 12:48:50 AM
by Tglad
Threads in M3D 'Internal' Tab Mandelbulb 3d Sfumato 2 1976 Last post August 10, 2011, 08:43:40 PM
by Sfumato
FB notifications about unviewable threads. Discuss Fractal Forums Pauldelbrot 4 2734 Last post May 27, 2013, 01:40:57 AM
by M Benesi
Not all random numbers are equaly random General Discussion Alef 10 3511 Last post October 10, 2013, 11:25:27 PM
by Roquen
Better living through random numbers... Fragmentarium Feline 11 1376 Last post April 07, 2016, 10:40:47 AM
by Roquen

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.311 seconds with 24 queries. (Pretty URLs adds 0.011s, 2q)