Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            NppLibraryVersion libVer = NPPNativeMethods.NPPCore.nppGetLibVersion();

            GpuComputeCapability computeCap = NPPNativeMethods.NPPCore.nppGetGpuComputeCapability();

            string output = string.Format("NPP Library Version {0}\n", libVer.ToString());

            txt_info.AppendText(output);

            _nppOK = computeCap != GpuComputeCapability.CudaNotCapable;

            if (_nppOK)
            {
                output = string.Format("{0} using GPU <{1}> with {2} SM(s) with", Assembly.GetExecutingAssembly().GetName().Name,
                                       NPPNativeMethods.NPPCore.nppGetGpuName(), NPPNativeMethods.NPPCore.nppGetGpuNumSMs());
                txt_info.AppendText(output);
                if (computeCap > 0)
                {
                    output = " Compute capability " + ((int)computeCap / 100).ToString() + "." + ((int)computeCap % 100).ToString() + "\n";
                    //output = string.Format(" {0}\n", sComputeCap[(int)computeCap]);
                    txt_info.AppendText(output);
                }
                else
                {
                    txt_info.AppendText(" Unknown Compute Capabilities\n");
                }
            }
            else
            {
                output = string.Format(" {0}\n", "No CUDA Capable Device Found");
                txt_info.AppendText(output);
            }

            //The NPP Library distinguishes warnings and errors. Errors are wrapped to standard exceptions.
            //Warnings are handled using a singleton NPPWarningHandler instance where you can find the OnNPPWarning event:
            NPPWarningHandler.GetInstance().OnNPPWarning += new NPPWarningHandler.NPPWarningEventHandler(nppwarnings_OnNPPWarning);
        }
Ejemplo n.º 2
0
        public void nppGetLibVersion_test()
        {
            NppLibraryVersion version = NppCore.nppGetLibVersion();

            Console.WriteLine("NPP version : {0}.{1}", version.major, version.minor);
        }