示例#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);
        }