예제 #1
0
 string GetPTX(IntPtr program)
 {
     if (program == null || program == IntPtr.Zero)
     {
         return(string.Empty);
     }
     return(NVRTC.GetPTX(program));
 }
예제 #2
0
        IntPtr CreateProgram(string src, string name)
        {
            int numHeaders = headerList.Count;

            if (numHeaders == 0)
            {
                return(NVRTC.CreateProgram(src, name, numHeaders, null, null));
            }
            string[] headers      = new string[numHeaders];
            string[] includeNames = new string[numHeaders];
            headerList.Values.CopyTo(headers, 0);
            headerList.Keys.CopyTo(includeNames, 0);
            return(NVRTC.CreateProgram(src, name, numHeaders, headers, includeNames));
        }
예제 #3
0
        public string Compile(string name, string src)
        {
            IntPtr program = CreateProgram(src, name);

            int         numOptions = optionList.Count;
            nvrtcResult result     = NVRTC.API.nvrtcCompileProgram(
                program, numOptions, optionList.ToArray()
                );

            if (result != nvrtcResult.NVRTC_SUCCESS)
            {
                log = GetLog(program);
                return(null);
            }
            log = GetLog(program);

            string ptx = GetPTX(program);

            NVRTC.DestroyProgram(program);

            return(ptx);
        }