curandGenerateLogNormal() private method

private curandGenerateLogNormal ( 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
示例#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 log-normal distribution based on
 /// an associated normal distribution 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/>
 /// The normally distributed results are transformed into log-normal distribution.
 /// <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 GenerateLogNormal(CudaDeviceVariable <float> output, float mean, float stddev)
 {
     _status = CudaRandNativeMethods.curandGenerateLogNormal(_generator, output.DevicePointer, output.Size, mean, stddev);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGenerateLogNormal", _status));
     if (_status != CurandStatus.Success)
     {
         throw new CudaRandException(_status);
     }
 }
示例#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 log-normal distribution based on
 /// an associated normal distribution 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/>
 /// The normally distributed results are transformed into log-normal distribution.
 /// <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 GenerateLogNormal(float[] output, float mean, float stddev)
 {
     _status = CudaRandNativeMethods.curandGenerateLogNormal(_generator, output, output.LongLength, mean, stddev);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGenerateLogNormal", _status));
     if (_status != CurandStatus.Success)
     {
         throw new CudaRandException(_status);
     }
 }