private List <int> getGpus(int nMax)
        {
            CudaDnn <float> cuda      = new CudaDnn <float>(0);
            List <int>      rgGpu     = new List <int>();
            int             nDevCount = cuda.GetDeviceCount();

            for (int i = 0; i < nDevCount; i++)
            {
                string strDevInfo = cuda.GetDeviceInfo(i, true);
                string strP2PInfo = cuda.GetDeviceP2PInfo(i);

                if (strP2PInfo.Contains("P2P Capable = YES"))
                {
                    rgGpu.Add(i);
                }

                if (rgGpu.Count == nMax)
                {
                    break;
                }
            }

            cuda.Dispose();

            return(rgGpu);
        }
Beispiel #2
0
        private void m_bwInit_DoWork(object sender, DoWorkEventArgs e)
        {
            List <string> rgstrGpu = new List <string>();

            // Setup the GPU menu with all GPU's in the system and
            //  select the first GPU as the default for testing.
            CudaDnn <float> cuda         = new CudaDnn <float>(0);
            int             nDeviceCount = cuda.GetDeviceCount();

            for (int i = 0; i < nDeviceCount; i++)
            {
                string strDevice = cuda.GetDeviceName(i);
                rgstrGpu.Add(strDevice);
            }

            cuda.Dispose();

            e.Result = rgstrGpu;
        }