Example #1
0
        public static void createCudaIncludesAndLibaryPath(
            StreamWriter writer,
            ProjectInfo_CPP projectInfo,
            ProjectInfo_CUDA projectCudaInfo)
        {
            if (projectCudaInfo.IsCUDA)
            {
                var configurationInfos = projectInfo.getConfigurationInfos();

                foreach (var configurationInfo in configurationInfos)
                {
                    var includes        = MakefileBuilder_Project_CPP.getIncludePathVariableName(configurationInfo);
                    var cudaIncludePath = getCudaPath() + "/include";
                    writer.WriteLine("{0}+=-I\"{1}\"", includes, cudaIncludePath);
                }

                writer.WriteLine("");

                foreach (var configurationInfo in configurationInfos)
                {
                    var libPath         = MakefileBuilder_Project_CPP.getLibraryPathVariableName(configurationInfo);
                    var cudaLabraryPath = getCudaPath() + "/lib64";
                    writer.WriteLine("{0}+=-L\"{1}\"", libPath, cudaLabraryPath);
                }

                writer.WriteLine("");
            }
        }
Example #2
0
        public static void createCudaLinker(
            StreamWriter writer,
            ProjectInfo_CPP projectInfo,
            ProjectConfigurationInfo_CPP configurationInfo,
            ProjectInfo_CUDA projectCudaInfo)
        {
            if (!projectCudaInfo.IsCUDA || projectCudaInfo.CompileInfos.Count == 0)
            {
                return;
            }

            var projectSettings = MakeItSoConfig.Instance.getProjectConfig(projectInfo.Name);

            var intermediateFolder = MakefileBuilder_Project_CPP.getIntermediateFolder(projectInfo, configurationInfo);

            string files = "";

            foreach (var info in projectCudaInfo.CompileInfos)
            {
                var filename = info.File;

                if (projectSettings.filesOrDirectoriesShouldBeRemoved(filename))
                {
                    continue;
                }

                string path = String.Format("{0}/{1}", intermediateFolder, filename);
                if (filename.StartsWith(".."))
                {
                    var tmp = filename.Replace("../", "");
                    path = String.Format("{0}/{1}", intermediateFolder, tmp);
                }
                string objectPath = Path.ChangeExtension(path, ".o");

                files += objectPath + " ";
            }


            // TODO
            string sm = "sm_20";
            {
                var compileInfo = projectCudaInfo.CompileInfos.Count > 0 ? projectCudaInfo.CompileInfos[0] : projectCudaInfo.AllCompileInfo;

                var opt  = compileInfo.getOption(configurationInfo.Name);
                var gens = getCodeGenerations(opt);
                sm = gens[1];
            }

            var linkedFile = getLinkedCudaFile(intermediateFolder);

            writer.WriteLine("# Link gpu code files.");
            writer.WriteLine("{0}: {1}", linkedFile, files);
            writer.WriteLine("\t$(NVCC) -arch={0} -dlink {1} -o {2}", sm, files, linkedFile);
            writer.WriteLine("");
        }
Example #3
0
        /// <summary>
        /// Creates a makefile for the project passed in.
        /// </summary>
        private static void createProjectMakefile(ProjectInfo projectInfo, ProjectInfo_CUDA projectInfoCuda)
        {
            // Are we ignoring this project?
            if (MakeItSoConfig.Instance.ignoreProject(projectInfo.Name) == true)
            {
                return;
            }

            // We build a different makefile, depending on the
            // project type...
            if (projectInfo is ProjectInfo_CPP)
            {
                MakefileBuilder_Project_CPP.createMakefile(projectInfo as ProjectInfo_CPP, projectInfoCuda);
            }
            if (projectInfo is ProjectInfo_CSharp)
            {
                MakefileBuilder_Project_CSharp.createMakefile(projectInfo as ProjectInfo_CSharp);
            }
        }
Example #4
0
        public static void createFileTargets(
            StreamWriter writer,
            ProjectInfo_CPP projectInfo,
            ProjectConfigurationInfo_CPP configurationInfo,
            ProjectInfo_CUDA projectCudaInfo)
        {
            if (!projectCudaInfo.IsCUDA)
            {
                return;
            }

            var includePath             = String.Format("$({0})", MakefileBuilder_Project_CPP.getIncludePathVariableName(configurationInfo));
            var preprocessorDefinitions = String.Format("$({0})", MakefileBuilder_Project_CPP.getPreprocessorDefinitionsVariableName(configurationInfo));
            var intermediateFolder      = MakefileBuilder_Project_CPP.getIntermediateFolder(projectInfo, configurationInfo);

            var projectSettings = MakeItSoConfig.Instance.getProjectConfig(projectInfo.Name);

            foreach (var info in projectCudaInfo.CompileInfos)
            {
                var filename = info.File;

                if (projectSettings.filesOrDirectoriesShouldBeRemoved(filename))
                {
                    continue;
                }

                var    opt          = info.getOption(configurationInfo.Name);
                string compileFlags = getCudaCompileFlags(configurationInfo, opt);

                string path = String.Format("{0}/{1}", intermediateFolder, filename);
                if (filename.StartsWith(".."))
                {
                    var tmp = filename.Replace("../", "");
                    path = String.Format("{0}/{1}", intermediateFolder, tmp);
                }
                string objectPath = Path.ChangeExtension(path, ".o");

                writer.WriteLine("# Compiles file {0} for the {1} configuration...", filename, configurationInfo.Name);
                writer.WriteLine("{0}: {1}", objectPath, filename);
                writer.WriteLine("\t$(NVCC) {0} {1} {2} -c {3} -o {4}", compileFlags, includePath, preprocessorDefinitions, filename, objectPath);
                writer.WriteLine("");
            }
        }