Research Article

A Fading Channel Simulator Implementation Based on GPU Computing Techniques

Algorithm 2

Pseudorandom noise generation code.
_global_ void setup_kernel(curandState  state)
{ int id = threadIdx.x + blockIdx.x  6;
   curand_init(1234blockIdx.x, id, 0,  &state[id]);
_global_ void generate_normal_kernel(curandState  state, int n, float  result)
{ int id = threadIdx.x + blockIdx.x  6;
   float2 x;
   curandState localState = state[id];
   for(int i=0; i<n; i++)
   { /  Generate pseudorandom normals  /
      x=curand_normal2(&localState);
      result[id]= x.x;
   }
/  Copy state back to global memory  /
   state[id] = localState;