Exemplo n.º 1
0
 string GetPTX(IntPtr program)
 {
     if (program == null || program == IntPtr.Zero)
     {
         return(string.Empty);
     }
     return(NVRTC.GetPTX(program));
 }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }