Esempio n. 1
0
        public int GetDriverVersion()
        {
            int      version = -1;
            CUResult res;

            try
            {
                res            = CUDADriver.cuDriverGetVersion(ref version);
                this.LastError = res;
            }
            catch (EntryPointNotFoundException ex)
            {
                Debug.WriteLine("GetDriverVersion(): " + ex.Message);
            }

            return(version);
        }
Esempio n. 2
0
        public HuForceDirectedLayout(int steps)
        {
#if !DEBUG
            try
            {
#endif
            CUDADriver.cuInit(0);

            dev = new CUdevice();
            CUDADriver.cuDeviceGet(ref dev, 0);

            ctx = new CUcontext();
            CUDADriver.cuCtxCreate(ref ctx, 0, dev);

            mod = new CUmodule();
            CUDADriver.cuModuleLoad(ref mod, "BarnesHut.cubin");

            prop = new CUDeviceProperties();
            CUDADriver.cuDeviceGetProperties(ref prop, dev);
            int version = 0;
            CUDADriver.cuDriverGetVersion(ref version);

            string caps = "";

            GASS.CUDA.CUDARuntime.cudaRuntimeGetVersion(ref version);


            caps += "\tClock rate        = " + prop.clockRate / 1000000 + " MHz\n";
            caps += "\tMemory size       = " + prop.totalConstantMemory / 1024 + " KB\n";
            caps += "\tThreads per block = " + prop.maxThreadsPerBlock + "\n";
            caps += "\tWarp size         = " + prop.SIMDWidth + "\n";
            caps += "\tCUDA version      = " + version + "\n";

            Logger.AddMessage(LogEntryType.Info, "Successfully initialized CUDA GPU computation\n" + caps);
#if !DEBUG
        }
        catch (Exception ex)
        {
            Logger.AddMessage(LogEntryType.Warning, "CUDA not available, falling back to CPU. Exception was: " + ex.Message);
            CUDAEnabled = false;
        }
#endif
        }