curandGenerateNormal() private method

private curandGenerateNormal ( ManagedCuda.CudaRand.CurandGenerator generator, ManagedCuda.BasicTypes.CUdeviceptr outputPtr, ManagedCuda.BasicTypes.SizeT n, float mean, float stddev ) : CurandStatus
generator ManagedCuda.CudaRand.CurandGenerator
outputPtr ManagedCuda.BasicTypes.CUdeviceptr
n ManagedCuda.BasicTypes.SizeT
mean float
stddev float
return CurandStatus
Ejemplo n.º 1
0
 /// <summary>
 /// Use generator to generate num float results into the device memory at
 /// outputPtr. The device memory must have been previously allocated and be
 /// large enough to hold all the results. Launches are done with the stream
 /// set using curandSetStream(), or the null stream if no stream has been set.
 /// <para/>
 /// Results are 32-bit floating point values with mean  mean and standard
 /// deviation stddev.
 /// <para/>
 /// Normally distributed results are generated from pseudorandom generators
 /// with a Box-Muller transform, and so require num to be even.
 /// Quasirandom generators use an inverse cumulative distribution
 /// function to preserve dimensionality.
 /// <para/>
 /// There may be slight numerical differences between results generated
 /// on the GPU with generators created with curandCreateGenerator()
 /// and results calculated on the CPU with generators created with
 /// curandCreateGeneratorHost(). These differences arise because of
 /// differences in results for transcendental functions.  In addition,
 /// future versions of CURAND may use newer versions of the CUDA math
 /// library, so different versions of CURAND may give slightly different
 /// numerical values.
 /// </summary>
 /// <param name="output">CudaDeviceVariable</param>
 /// <param name="mean"></param>
 /// <param name="stddev"></param>
 public void GenerateNormal(CudaDeviceVariable <float> output, float mean, float stddev)
 {
     _status = CudaRandNativeMethods.curandGenerateNormal(_generator, output.DevicePointer, output.Size, mean, stddev);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGenerateNormal", _status));
     if (_status != CurandStatus.Success)
     {
         throw new CudaRandException(_status);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Use generator to generate num float results into the device memory at
 /// outputPtr. The device memory must have been previously allocated and be
 /// large enough to hold all the results. Launches are done with the stream
 /// set using curandSetStream(), or the null stream if no stream has been set.
 /// <para/>
 /// Results are 32-bit floating point values with mean  mean and standard
 /// deviation stddev.
 /// <para/>
 /// Normally distributed results are generated from pseudorandom generators
 /// with a Box-Muller transform, and so require num to be even.
 /// Quasirandom generators use an inverse cumulative distribution
 /// function to preserve dimensionality.
 /// <para/>
 /// There may be slight numerical differences between results generated
 /// on the GPU with generators created with curandCreateGenerator()
 /// and results calculated on the CPU with generators created with
 /// curandCreateGeneratorHost(). These differences arise because of
 /// differences in results for transcendental functions.  In addition,
 /// future versions of CURAND may use newer versions of the CUDA math
 /// library, so different versions of CURAND may give slightly different
 /// numerical values.
 /// </summary>
 /// <param name="output">CudaDeviceVariable</param>
 /// <param name="mean"></param>
 /// <param name="stddev"></param>
 public void GenerateNormal(float[] output, float mean, float stddev)
 {
     _status = CudaRandNativeMethods.curandGenerateNormal(_generator, output, output.LongLength, mean, stddev);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGenerateNormal", _status));
     if (_status != CurandStatus.Success)
     {
         throw new CudaRandException(_status);
     }
 }