Commit c7e1b591 authored by Peter Eastman's avatar Peter Eastman
Browse files

Compile device code in 32 or 64 bit mode to match the host code (see bug 1811).

parent 475ccb4f
......@@ -366,10 +366,11 @@ CUmodule CudaContext::createModule(const string source, const map<string, string
ofstream out(inputFile.c_str());
out << src.str();
out.close();
string bits = intToString(8*sizeof(void*));
#ifdef WIN32
string command = ""+compiler+" --ptx --machine 32 -arch=sm_"+gpuArchitecture+" -o "+outputFile+" "+options+" "+inputFile+" 2> "+logFile;
string command = ""+compiler+" --ptx --machine "+bits+" -arch=sm_"+gpuArchitecture+" -o "+outputFile+" "+options+" "+inputFile+" 2> "+logFile;
#else
string command = "\""+compiler+"\" --ptx -arch=sm_"+gpuArchitecture+" -o \""+outputFile+"\" "+options+" \""+inputFile+"\" 2> \""+logFile+"\"";
string command = "\""+compiler+"\" --ptx --machine "+bits+" -arch=sm_"+gpuArchitecture+" -o \""+outputFile+"\" "+options+" \""+inputFile+"\" 2> \""+logFile+"\"";
#endif
int res = std::system(command.c_str());
try {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment