IPB

Welcome Guest ( Log In | Register )

> random number generation, generating random numbers in CUDA
thepolishpistol
post Mar 20 2007, 10:45 PM
Post #1



***

Group: Members
Posts: 28
Joined: 5-March 07
Member No.: 43,865
Org.: upenn



I'm trying to generate a random seed value for the srand function in a kernel I'm running, but I keep getting an error. This code:
CODE

srand(time(NULL));
float r = rand();

produces the error:
".\simpleGL_kernel.cu", line 67: error: expression must have (pointer-to-)
function type
srand(time(0));

Is the time function not accessible in a kernel? I wasn't having any problems with srand or rand, only time.

If time is not usable, does anyone have a suggestion for generating random seeds?

-skiz
Go to the top of the page
 
+Quote Post

Posts in this topic
- thepolishpistol   random number generation   Mar 20 2007, 10:45 PM
- - JaredHoberock   Pretty sure time() wouldn't be callable in a k...   Mar 20 2007, 10:53 PM
|- - seibert   QUOTE(JaredHoberock @ Mar 20 2007, 05:53 PM)P...   Mar 21 2007, 01:11 AM
|- - JaredHoberock   QUOTE(seibert @ Mar 20 2007, 07:11 PM)You pro...   Mar 21 2007, 03:25 AM
|- - thepolishpistol   QUOTE(seibert @ Mar 20 2007, 09:11 PM)And eve...   Mar 21 2007, 04:50 AM
|- - tachyon_john   Friends don't let friends use rand()... :-) S...   Mar 21 2007, 05:17 AM
|- - seibert   QUOTE(tachyon_john @ Mar 21 2007, 12:17 AM)Se...   Mar 21 2007, 12:51 PM
|- - thepolishpistol   QUOTE(seibert @ Mar 21 2007, 08:51 AM)This wo...   Mar 21 2007, 03:50 PM
|- - tachyon_john   Yeah, I think it would be a fun project to take th...   Mar 21 2007, 07:28 PM
- - jhanweck   I've implemented a highly efficient (if not hi...   Mar 21 2007, 02:21 PM
- - osiris   I too am evaluating/designing a port onto the G80 ...   Apr 22 2007, 11:28 PM
|- - bbudge   QUOTE(osiris @ Apr 22 2007, 03:28 PM)I too am...   Apr 23 2007, 03:38 AM
|- - FangQ   hi I am looking for a random number generator for...   Feb 20 2009, 03:52 PM
|- - FangQ   QUOTE (FangQ @ Feb 20 2009, 10:52 AM) hi ...   Feb 20 2009, 04:23 PM
- - osiris   Yep, that's exactly it! One could do up to...   Apr 23 2007, 05:03 AM
|- - bbudge   QUOTE(osiris @ Apr 22 2007, 09:03 PM)Yep, tha...   Apr 23 2007, 06:39 PM
|- - bbudge   I've had a request for seeding this thing. He...   Apr 23 2007, 07:11 PM
- - osiris   Hi Brian, Just as a coda... my expression of the c...   Apr 25 2007, 01:46 AM
|- - bbudge   QUOTE(osiris @ Apr 24 2007, 05:46 PM) Now I d...   Apr 25 2007, 02:27 AM
- - osiris   Ooops - and mine runs 8,8,6... On the last questio...   Apr 25 2007, 02:49 AM
|- - bbudge   QUOTE(osiris @ Apr 24 2007, 06:49 PM)Ooops - ...   Apr 25 2007, 03:58 AM
- - osiris   Hi Brian, I think that there is a requirement that...   Apr 25 2007, 06:11 AM
- - osiris   Hi Brian, well we both got it wrong! I am surp...   Apr 29 2007, 02:56 AM
|- - bbudge   QUOTE(osiris @ Apr 28 2007, 06:56 PM)Hi Brian...   Apr 30 2007, 05:31 AM
- - osiris   Hi Brian, the reason you have not seen problems is...   Apr 30 2007, 08:04 AM
- - osiris   Here it is multithreaded C original Mersenne Twi...   May 6 2007, 08:54 PM
- - osiris   The web interface dropped the file with a ".c...   May 6 2007, 09:00 PM
- - mfatica   Thanks Eric, nice job !!! If you coul...   May 6 2007, 11:32 PM
- - osiris   Thanks, Massimiliano. The only code you need is a ...   May 7 2007, 02:20 AM
- - osiris   No comments yet, however I thought it worthwhile r...   May 24 2007, 07:48 AM
- - osiris   Pretty much done now: I have some feedback on the ...   Jun 2 2007, 01:00 AM
- - osiris   Thought I should post an update for V1.0 and also ...   Jul 2 2007, 11:21 AM
- - lutorm   Hey all, Just started playing with CUDA to eventu...   Sep 3 2007, 09:05 PM
|- - vpodlozhnyuk   QUOTE(lutorm @ Sep 4 2007, 12:05 AM)Hey all, ...   Sep 3 2007, 09:59 PM
|- - lutorm   QUOTE(vpodlozhnyuk @ Sep 3 2007, 01:59 PM)It ...   Sep 3 2007, 10:38 PM
|- - vpodlozhnyuk   QUOTE(lutorm @ Sep 4 2007, 01:38 AM)Ok... I d...   Sep 3 2007, 10:57 PM
|- - lutorm   QUOTE(vpodlozhnyuk @ Sep 3 2007, 02:57 PM)Wel...   Sep 4 2007, 01:35 AM
|- - vpodlozhnyuk   QUOTE(lutorm @ Sep 4 2007, 04:35 AM)I see wha...   Sep 4 2007, 08:11 AM
- - osiris   QUOTE(lutorm @ Sep 4 2007, 08:05 AM)Just star...   Sep 4 2007, 01:48 AM
|- - vpodlozhnyuk   QUOTE(osiris @ Sep 4 2007, 04:48 AM)Nvidia ch...   Sep 4 2007, 07:51 AM
- - osiris   QUOTE(vpodlozhnyuk @ Sep 4 2007, 06:51 PM)Wel...   Sep 4 2007, 08:28 AM
|- - lutorm   QUOTE(osiris @ Sep 4 2007, 12:28 AM)Yeah... b...   Sep 4 2007, 07:03 PM
|- - vpodlozhnyuk   QUOTE(lutorm @ Sep 4 2007, 10:03 PM)So that e...   Sep 4 2007, 07:24 PM
- - osiris   QUOTE(lutorm @ Sep 5 2007, 06:03 AM)Ok, I...   Sep 5 2007, 02:01 AM
|- - vpodlozhnyuk   QUOTE(osiris @ Sep 5 2007, 05:01 AM)This gets...   Sep 5 2007, 02:52 PM
- - osiris   QUOTE(vpodlozhnyuk @ Sep 6 2007, 01:52 AM)If ...   Sep 5 2007, 10:57 PM
- - osiris   Just for completeness, here is the dcmt19937 sampl...   Sep 7 2007, 02:38 AM
|- - vpodlozhnyuk   QUOTE(osiris @ Sep 7 2007, 05:38 AM)Just for ...   Sep 7 2007, 03:39 PM
|- - lutorm   QUOTE(osiris @ Sep 6 2007, 06:38 PM)Just for ...   Sep 18 2007, 08:55 PM
- - osiris   Thanks, Victor. I think you are a little confused...   Sep 8 2007, 04:32 AM
- - osiris   Just a quick note to say that the library above is...   Sep 15 2007, 08:47 AM
- - osiris   Yes, I left out the word "necessarily" -...   Sep 19 2007, 12:14 AM
- - lord_jake   Dear all, by chance we found this discussion abou...   Oct 15 2007, 03:28 PM
- - wumpus   lord_jake: Your download gives a file not found er...   Oct 16 2007, 02:05 PM
|- - lord_jake   QUOTE(wumpus @ Oct 16 2007, 06:05 AM)lord_jak...   Oct 22 2007, 08:11 AM
- - asadafag   To lord_jake: 0. What problem do you intend to sol...   Oct 17 2007, 06:03 AM
|- - lord_jake   QUOTE(asadafag @ Oct 16 2007, 10:03 PM)To lor...   Oct 22 2007, 08:22 AM
- - MisterAnderson42   Nose-Hoover and related thermostats are fully dete...   Oct 17 2007, 02:04 PM
- - asadafag   QUOTENose-Hoover and related thermostats are fully...   Oct 18 2007, 03:15 AM
- - FangQ   I put together a few subroutines found in this thr...   Feb 21 2009, 01:09 AM
|- - pcrs   Hi, I thought it could be so simple just to genera...   May 4 2009, 09:02 PM
|- - pcrs   What a strange way to calculate the performance: ...   May 8 2009, 10:11 PM
- - neocortex   So is the easiest way to generate random numbers u...   Jul 2 2009, 08:44 PM


Reply to this topicStart new topic

 



Copyright 2008 NVIDIA Corporation.  Terms of Use | Legal Info | Privacy Policy Time is now: 9th February 2010 - 11:51 PM
Unites States Argentina Brazil Chile China Colombia France Germany India Italy Japan Korea Mexico Poland Russia Spain Taiwan United Kingdom Venezuela