Exemplo n.º 1
0
        public static CudaDeviceInfo GetBestDeviceInfo()
        {
            CudaDeviceInfo device = null;

            try
            {
                int           index               = 0;
                StringBuilder name                = new StringBuilder(255);
                float         driver_version      = 0;
                float         runtime_version     = 0;
                float         capability_version  = 0;
                int           global_memory       = 0;
                int           memory_clock_rate   = 0;
                int           multyprocessors_num = 0;
                int           memory_bus_width    = 0;
                int           cuda_cores_num      = 0;
                int           clock_rate          = 0;
                CUDA_BestDeviceInfo(ref index, name, ref driver_version, ref runtime_version, ref capability_version, ref global_memory, ref memory_clock_rate, ref multyprocessors_num, ref memory_bus_width, ref cuda_cores_num, ref clock_rate);
                return(device = new CudaDeviceInfo
                {
                    Index = index,
                    Name = name.ToString(),
                    DriverVersion = driver_version,
                    RuntimeVersion = runtime_version,
                    CapabilityVersion = capability_version,
                    GlobalMemory = global_memory,
                    MemoryClockRate = memory_clock_rate,
                    MultyprocessorsNum = multyprocessors_num,
                    MemoryBusWidth = memory_bus_width,
                    CudaCoresNum = cuda_cores_num,
                    ClockRate = clock_rate
                });
            }
            catch (Exception)
            {
                throw new Exception(GetLastExceptionMessage());
            }
        }
Exemplo n.º 2
0
 public static void SetBestDevice()
 {
     Device = GetBestDeviceInfo();
 }