cross-platform thread-safe RNG drand48_r
Qianqian Fang
fangqq@gmail.com
Mon Jun 7 03:22:00 GMT 2010
hi
I was trying to compile a simulation code on
multiple platforms. It involves a thread-safe
48bit POSIX random number generator (RNG),
drand48_r/seed48_r. I tried gcc 4.4 on Ubuntu
10.4 and it compiled fine. However, when
I run gcc 4.0 on Mac OS X, it gave me error:
posix_randr.h:29: error: array type has incomplete element type
and the offending lines read like:
typedef struct drand48_data RandType;
__device__ float rand_uniform01(RandType t[RAND_BUF_LEN]);
...
Similar error when compiling on Windows with
MinGW gcc 3.4.
Because drand48 is supposed to be a POSIX function,
I am a bit surprised when seeing multiple platforms
responded differently. Did I miss anything? or
this is the correct behavior?
thanks
Qianqian
More information about the Gcc-help
mailing list