Beispiel #1
0
 internal CudaRAND(GPGPU gpu, curandRngType rng_type)
 {
     _gpu = gpu;
     if (IntPtr.Size == 8)
     {
         _driver = new CURANDDriver64();
     }
     else
     {
         _driver = new CURANDDriver32();
     }
 }
Beispiel #2
0
 internal CudaRAND(GPGPU gpu, curandRngType rng_type)
 {
     _gpu = gpu;
     if (IntPtr.Size == 8)
     {
         _driver = new CURANDDriver64();
     }
     else
     {
         _driver = new CURANDDriver32();
     }
 }
Beispiel #3
0
 internal CudaRAND(GPGPU gpu, curandRngType rng_type)
 {
     _gpu = gpu;
     if (IntPtr.Size == 8)
     {
         _driver = new CURANDDriver64();
     }
     else
     {
         throw new NotSupportedException();
         //_driver = new CURANDDriver32();
     }
 }
Beispiel #4
0
 internal CudaRAND(GPGPU gpu, curandRngType rng_type)
 {
     _gpu = gpu;
     if (IntPtr.Size == 8)
     {
         _driver = new CURANDDriver64();
     }
     else
     {
         throw new NotSupportedException();
         //_driver = new CURANDDriver32();
     }
 }
Beispiel #5
0
        /// <summary>
        /// Creates an instance based on the specified gpu.
        /// </summary>
        /// <param name="gpu">The gpu.</param>
        /// <param name="rng_type">The type of generator.</param>
        /// <param name="host">if set to <c>true</c> the uses generator on the host (if applicable).</param>
        /// <returns>New instance.</returns>
        public static GPGPURAND Create(GPGPU gpu, curandRngType rng_type, bool host = false)
        {
            GPGPURAND rand;

            if (!host && gpu is CudaGPU)
            {
                rand = new CudaDeviceRAND(gpu, rng_type);
            }
            else if (gpu is CudaGPU)
            {
                rand = new CudaHostRAND(gpu, rng_type);
            }
            else
            {
                rand = new HostRAND(gpu, rng_type);
            }

            return(rand);
        }
Beispiel #6
0
 public curandStatus CreateGeneratorHost(ref RandGenerator generator, curandRngType rng_type)
 {
     return(curandCreateGeneratorHost(ref generator, rng_type));
 }
Beispiel #7
0
 private static extern curandStatus curandCreateGeneratorHost(ref RandGenerator generator, curandRngType rng_type);
 internal CudaHostRAND(GPGPU gpu, curandRngType rng_type)
     : base(gpu, rng_type)
 {
     SafeCall(_driver.CreateGeneratorHost(ref _gen, rng_type));
 }
Beispiel #9
0
 /// <summary>
 /// Creates an instance based on the specified gpu.
 /// </summary>
 /// <param name="gpu">The gpu.</param>
 /// <param name="rng_type">The type of generator.</param>
 /// <param name="host">if set to <c>true</c> the uses generator on the host (if applicable).</param>
 /// <returns>New instance.</returns>
 public static GPGPURAND Create(GPGPU gpu, curandRngType rng_type, bool host = false)
 {
     GPGPURAND rand;
     if (!host && gpu is CudaGPU)
         rand = new CudaDeviceRAND(gpu, rng_type);
     else if (gpu is CudaGPU)
         rand = new CudaHostRAND(gpu, rng_type);
     else
         rand = new HostRAND(gpu, rng_type);
   
     return rand;
 }
Beispiel #10
0
 public curandStatus CreateGeneratorHost(ref RandGenerator generator, curandRngType rng_type)
 {
     return curandCreateGeneratorHost(ref generator, rng_type);
 }
Beispiel #11
0
 private static extern curandStatus curandCreateGeneratorHost(ref RandGenerator generator, curandRngType rng_type);
Beispiel #12
0
 internal HostRAND(GPGPU gpu, curandRngType rng_type)
 {
     throw new CudafyMathException(CudafyMathException.csX_NOT_CURRENTLY_SUPPORTED, "HostRand");
 }
 internal CudaDeviceRAND(GPGPU gpu, curandRngType rng_type)
     : base(gpu, rng_type)
 {
     SafeCall(_driver.CreateGenerator(ref _gen, rng_type));
 }
Beispiel #14
0
 public CudaRandomDevice(curandRngType type = curandRngType.CURAND_RNG_PSEUDO_DEFAULT)
 {
     generator = cuRAND.CreateGenerator(type);
 }
Beispiel #15
0
 internal HostRAND(GPGPU gpu, curandRngType rng_type)
 {
     throw new CudafyMathException(CudafyMathException.csX_NOT_CURRENTLY_SUPPORTED, "HostRand");
 }