Ejemplo n.º 1
0
 private void parseCudaCompileOptions(ProjectInfo_CUDA.CudaCompileOption opt, string configuration, XmlNode item, MakeItSoConfig_Project projConfig)
 {
     if (item.Name == "GenerateRelocatableDeviceCode")
     {
         opt.GenerateRelocatableDeviceCode = checkIsTrue(item.InnerText);
     }
     else if (item.Name == "TargetMachinePlatform")
     {
         opt.TargetMachinePlatform = Int32.Parse(item.InnerText);
     }
     else if (item.Name == "CodeGeneration")
     {
         opt.CodeGeneration = item.InnerText;
     }
     else if (item.Name == "NvccCompilation")
     {
         opt.NvccCompilation = item.InnerText;
     }
     else if (item.Name == "FastMath")
     {
         opt.FastMath = checkIsTrue(item.InnerText);
     }
     else if (item.Name == "CudaRuntime")
     {
         opt.CudaRuntime = item.InnerText;
     }
     else if (item.Name == "GPUDebugInfo")
     {
         opt.GPUDebugInfo = checkIsTrue(item.InnerText);
     }
     else if (item.Name == "HostDebugInfo")
     {
         opt.GenerateHostDebugInfo = checkIsTrue(item.InnerText);
     }
 }
Ejemplo n.º 2
0
        private static string[] getCodeGenerations(ProjectInfo_CUDA.CudaCompileOption compileOption)
        {
            string[] separator = { "," };
            var      strs      = compileOption.CodeGeneration.Split(separator, System.StringSplitOptions.RemoveEmptyEntries);

            string sm      = "";
            string compute = "";

            sm      = strs[0].StartsWith("sm_") ? strs[0] : strs[1];
            compute = strs[0].StartsWith("compute_") ? strs[0] : strs[1];

            string[] ret = { compute, sm };

            return(ret);
        }
Ejemplo n.º 3
0
        private static string getCudaCompileFlags(
            ProjectConfigurationInfo_CPP configurationInfo,
            ProjectInfo_CUDA.CudaCompileOption compileOption)
        {
            string flags = "";

            flags += compileOption.GenerateRelocatableDeviceCode ? " -rdc=true" : "";

            switch (compileOption.NvccCompilation)
            {
            case "compile":
                flags += " --compile";
                break;

            default:
                // TODO
                break;
            }

            switch (compileOption.CudaRuntime)
            {
            case "Static":
                flags += " -cudart static";
                break;

            default:
                break;
            }

            flags += " --machine " + compileOption.TargetMachinePlatform.ToString();

            flags += compileOption.GPUDebugInfo ? " -G" : "";

            flags += compileOption.GenerateHostDebugInfo ? " -g" : "";

            flags += compileOption.FastMath ? " -use_fast_math" : "";

            {
                var gens = getCodeGenerations(compileOption);

                var compute = gens[0];
                var sm      = gens[1];

                flags += string.Format(" -gencode arch={0},code={1}", compute, sm);
            }

            flags += " " + compileOption.AdditionalOptions;

            {
                var hostCompileFlagsList = configurationInfo.getCompilerFlags().ToList();;
                var projectSettings      = MakeItSoConfig.Instance.getProjectConfig(configurationInfo.ParentProjectInfo.Name);

                string hostCompileFlags = "";
                foreach (var f in hostCompileFlagsList)
                {
                    if (!projectSettings.hostCompilerFlagCudaShouldBeRemoved(f))
                    {
                        hostCompileFlags += f + " ";
                    }
                }

                flags += string.Format(" -Xcompiler ,{0}", hostCompileFlags);
            }

            return(flags);
        }