示例#1
0
        private static void DetailCudaDriver()
        {
            CUDA cuda = new CUDA(false);

            cuda.Init();

            int cudaDrv = cuda.GetDeviceCount();

            if (cudaDrv < 1)
            {
                Console.WriteLine("Cuda device not found");
                System.Environment.Exit(-1);
            }

            Console.WriteLine("Found {0} cuda devices", cudaDrv);
            Device[] cuDevice = cuda.Devices;

            for (int i = 0; i < cuDevice.Length; i++)
            {
                Console.WriteLine("-------------------");
                Console.WriteLine("Cuda device nr {0} details:", i + 1);
                Console.WriteLine("Name: {0}", cuDevice[i].Name);
                Console.WriteLine("Compute: {0}", cuDevice[i].ComputeCapability);

                DeviceProperties prop = cuDevice[i].Properties;

                int processors = cuda.GetDeviceAttribute(CUDeviceAttribute.MultiProcessorCount, cuDevice[i].Handle);
                Console.WriteLine("Clock rate: {0}", prop.ClockRate);
                Console.WriteLine("Number of processors: {0}", processors);
                Console.WriteLine("Memory: {0} GB", (cuDevice[i].TotalMemory + 0.0) / (1024 * 1024));
                Console.WriteLine("Constant Memory: {0}MB", (prop.TotalConstantMemory + 0.0) / 1024);

            }
            Console.WriteLine("----------------------------------");
            Console.WriteLine();
        }