Exemple #1
0
 /// <summary>
 /// Generate Poisson-distributed unsigned ints.<para/>
 /// Use <c>generator</c> to generate <c>num</c> unsigned int results into the device memory at
 /// <c>outputPtr</c>.  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 <c>curandSetStream()</c>, or the null stream if no stream has been set.
 /// Results are 32-bit unsigned int point values with poisson distribution based on
 /// an associated poisson distribution with lambda <c>lambda</c>.
 /// </summary>
 /// <param name="generator">Generator to use</param>
 /// <param name="output">Pointer to device memory to store CUDA-generated results</param>
 public void Generate(CudaRandDevice generator, CudaDeviceVariable <uint> output)
 {
     _status = CudaRandNativeMethods.curandGeneratePoisson(generator.Generator, output.DevicePointer, output.Size, _lambda);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGeneratePoisson", _status));
     if (_status != CurandStatus.Success)
     {
         throw new CudaRandException(_status);
     }
 }
		/// <summary> 
		/// Generate Poisson-distributed unsigned ints.<para/>
		/// Use <c>generator</c> to generate <c>num</c> unsigned int results into the device memory at
		/// <c>outputPtr</c>.  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 <c>curandSetStream()</c>, or the null stream if no stream has been set.
		/// Results are 32-bit unsigned int point values with poisson distribution based on
		/// an associated poisson distribution with lambda <c>lambda</c>.
		/// </summary>
		/// <param name="generator">Generator to use</param>
		/// <param name="output">Pointer to device memory to store CUDA-generated results</param>
		public void Generate(CudaRandDevice generator, CudaDeviceVariable<uint> output)
		{
			_status = CudaRandNativeMethods.curandGeneratePoisson(generator.Generator, output.DevicePointer, output.Size, _lambda);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGeneratePoisson", _status));
			if (_status != CurandStatus.Success) throw new CudaRandException(_status);
		}
Exemple #3
0
 /// <summary>
 /// Returns the version number of the dynamically linked CURAND library.
 /// </summary>
 public static Version GetVersion()
 {
     return(CudaRandDevice.GetVersion());
 }
Exemple #4
0
 /// <summary>
 /// Get an array of direction vectors that can be used for quasirandom number generation.
 /// <para/>
 /// The array contains vectors for many dimensions. Each dimension
 /// has 64 vectors. Each individual vector is an unsigned long long.
 /// <para/>
 /// Legal values for set are:
 /// - <see cref="DirectionVectorSet.JoeKuo6_64"/> (20,000 dimensions)
 /// - <see cref="DirectionVectorSet.ScrambledJoeKuo6_64"/> (20,000 dimensions)
 /// </summary>
 /// <param name="set"></param>
 /// <returns></returns>
 public static DirectionVectors64[] GetDirectionVectors64(DirectionVectorSet set)
 {
     return(CudaRandDevice.GetDirectionVectors64(set));
 }
Exemple #5
0
 /// <summary>
 /// Get scramble constants that can be used for quasirandom number generation.
 /// <para/>
 /// The array contains constants for many dimensions. Each dimension
 /// has a single ulong constant.
 /// </summary>
 /// <returns></returns>
 public static ulong[] GetScrambleConstants64()
 {
     return(CudaRandDevice.GetScrambleConstants64());
 }
Exemple #6
0
 /// <summary>
 /// Get scramble constants that can be used for quasirandom number generation.
 /// <para/>
 /// The array contains constants for many dimensions. Each dimension
 /// has a single uint constant.
 /// </summary>
 /// <returns></returns>
 public static uint[] GetScrambleConstants32()
 {
     return(CudaRandDevice.GetScrambleConstants32());
 }
 public CUDANoiseCube()
 {
     randomDevice = new CudaRandDevice(GeneratorType.PseudoDefault);
 }