private curandGenerateLogNormalDouble ( ManagedCuda.CudaRand.CurandGenerator generator, ManagedCuda.BasicTypes.CUdeviceptr outputPtr, ManagedCuda.BasicTypes.SizeT n, double mean, double stddev ) : CurandStatus | ||
generator | ManagedCuda.CudaRand.CurandGenerator | |
outputPtr | ManagedCuda.BasicTypes.CUdeviceptr | |
n | ManagedCuda.BasicTypes.SizeT | |
mean | double | |
stddev | double | |
return | CurandStatus |
/// <summary> /// Use generator to generate num double 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 64-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. /// 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">DevicePtr of type double*</param> /// <param name="size">Number of random elements to create</param> /// <param name="mean"></param> /// <param name="stddev"></param> public void GenerateLogNormal64(CUdeviceptr output, SizeT size, float mean, float stddev) { _status = CudaRandNativeMethods.curandGenerateLogNormalDouble(_generator, output, size, mean, stddev); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGenerateLogNormalDouble", _status)); if (_status != CurandStatus.Success) { throw new CudaRandException(_status); } }
/// <summary> /// Use generator to generate num double 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 64-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. /// 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 <double> output, double mean, double stddev) { _status = CudaRandNativeMethods.curandGenerateLogNormalDouble(_generator, output.DevicePointer, output.Size, mean, stddev); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGenerateLogNormalDouble", _status)); if (_status != CurandStatus.Success) { throw new CudaRandException(_status); } }
/// <summary> /// Use generator to generate num double 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 64-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. /// 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(double[] output, double mean, double stddev) { _status = CudaRandNativeMethods.curandGenerateLogNormalDouble(_generator, output, output.LongLength, mean, stddev); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGenerateLogNormalDouble", _status)); if (_status != CurandStatus.Success) { throw new CudaRandException(_status); } }