Commit 00f51540 authored by peastman's avatar peastman
Browse files

Cache filename specifies whether it was compiled in 32 or 64 bit mode

parent d7aebd3a
......@@ -352,6 +352,7 @@ static bool compileInWindows(const string &command) {
#endif
CUmodule CudaContext::createModule(const string source, const map<string, string>& defines, const char* optimizationFlags) {
string bits = intToString(8*sizeof(void*));
string options = (optimizationFlags == NULL ? defaultOptimizationOptions : string(optimizationFlags));
stringstream src;
if (!options.empty())
......@@ -411,7 +412,7 @@ CUmodule CudaContext::createModule(const string source, const map<string, string
cacheFile.flags(ios::hex);
for (int i = 0; i < 20; i++)
cacheFile << setw(2) << setfill('0') << (int) hash[i];
cacheFile << '_' << gpuArchitecture;
cacheFile << '_' << gpuArchitecture << '_' << bits;
CUmodule module;
if (cuModuleLoad(&module, cacheFile.str().c_str()) == CUDA_SUCCESS)
return module;
......@@ -431,7 +432,6 @@ 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
#ifdef _DEBUG
string command = "\""+compiler+"\" --ptx -G -g --machine "+bits+" -arch=sm_"+gpuArchitecture+" -o "+outputFile+" "+options+" "+inputFile+" 2> "+logFile;
......
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