Пример #1
0
        public void Test_CURAND_Host_Reference_Example()
        {
            int n = 100;

            float[] hostData = new float[n];

            GPGPURAND gen = GPGPURAND.Create(_gpu, curandRngType.CURAND_RNG_PSEUDO_DEFAULT, true);

            gen.SetPseudoRandomGeneratorSeed(1234);
            gen.GenerateUniform(hostData);

            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(hostData[i]);
            }

            gen.Dispose();
        }
Пример #2
0
        public void Test_CURAND_Device_Reference_Example()
        {
            int n = 100;

            float[] devData  = _gpu.Allocate <float>(n);
            float[] hostData = new float[n];

            GPGPURAND gen = GPGPURAND.Create(_gpu, curandRngType.CURAND_RNG_PSEUDO_DEFAULT);

            gen.SetPseudoRandomGeneratorSeed(1234);
            gen.GenerateUniform(devData);

            _gpu.CopyFromDevice(devData, hostData);

            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(hostData[i]);
            }

            gen.Dispose();
        }