Commit 562283df authored by Yutong Zhao's avatar Yutong Zhao
Browse files

minor bug fixes

parent f4591cad
...@@ -394,7 +394,7 @@ CUmodule CudaContext::createModule(const string source, const map<string, string ...@@ -394,7 +394,7 @@ CUmodule CudaContext::createModule(const string source, const map<string, string
// Write out the source to a temporary file. // Write out the source to a temporary file.
stringstream tempFileName; stringstream tempFileName;
tempFileName << "openmmTempKernel" << this; // Include a pointer to this context as part of the filename to avoid collisions. tempFileName << "openmmTempKernel" << rand(); //<< this; // Include a pointer to this context as part of the filename to avoid collisions.
string inputFile = (tempDir+tempFileName.str()+".cu"); string inputFile = (tempDir+tempFileName.str()+".cu");
string outputFile = (tempDir+tempFileName.str()+".ptx"); string outputFile = (tempDir+tempFileName.str()+".ptx");
string logFile = (tempDir+tempFileName.str()+".log"); string logFile = (tempDir+tempFileName.str()+".log");
...@@ -438,15 +438,15 @@ CUmodule CudaContext::createModule(const string source, const map<string, string ...@@ -438,15 +438,15 @@ CUmodule CudaContext::createModule(const string source, const map<string, string
m<<"Error loading CUDA module: "<<getErrorString(result)<<" ("<<result<<")"; m<<"Error loading CUDA module: "<<getErrorString(result)<<" ("<<result<<")";
throw OpenMMException(m.str()); throw OpenMMException(m.str());
} }
remove(inputFile.c_str()); //remove(inputFile.c_str());
remove(outputFile.c_str()); //remove(outputFile.c_str());
remove(logFile.c_str()); //remove(logFile.c_str());
return module; return module;
} }
catch (...) { catch (...) {
remove(inputFile.c_str()); //remove(inputFile.c_str());
remove(outputFile.c_str()); //remove(outputFile.c_str());
remove(logFile.c_str()); //remove(logFile.c_str());
throw; throw;
} }
} }
......
...@@ -415,8 +415,6 @@ void CudaNonbondedUtilities::setAtomBlockRange(double startFraction, double endF ...@@ -415,8 +415,6 @@ void CudaNonbondedUtilities::setAtomBlockRange(double startFraction, double endF
numTiles = (int) (endFraction*totalTiles)-startTileIndex; numTiles = (int) (endFraction*totalTiles)-startTileIndex;
} }
#include <map>
CUfunction CudaNonbondedUtilities::createInteractionKernel(const string& source, vector<ParameterInfo>& params, vector<ParameterInfo>& arguments, bool useExclusions, bool isSymmetric) { CUfunction CudaNonbondedUtilities::createInteractionKernel(const string& source, vector<ParameterInfo>& params, vector<ParameterInfo>& arguments, bool useExclusions, bool isSymmetric) {
map<string, string> defines; map<string, string> defines;
...@@ -475,8 +473,7 @@ CUfunction CudaNonbondedUtilities::createInteractionKernel(const string& source, ...@@ -475,8 +473,7 @@ CUfunction CudaNonbondedUtilities::createInteractionKernel(const string& source,
// Part 1. Defines for on diagonal exclusion tiles // Part 1. Defines for on diagonal exclusion tiles
stringstream loadLocal1; stringstream loadLocal1;
if(useShuffle) { if(useShuffle) {
// not needed if using shuffles as we can directly fetch from // not needed if using shuffles as we can directly fetch from register
// LOAD_ATOM1_PARAMETERS
} else { } else {
for (int i = 0; i < (int) params.size(); i++) { for (int i = 0; i < (int) params.size(); i++) {
if (params[i].getNumComponents() == 1) { if (params[i].getNumComponents() == 1) {
...@@ -616,8 +613,6 @@ CUfunction CudaNonbondedUtilities::createInteractionKernel(const string& source, ...@@ -616,8 +613,6 @@ CUfunction CudaNonbondedUtilities::createInteractionKernel(const string& source,
defines["LAST_EXCLUSION_TILE"] = context.intToString(endExclusionIndex); defines["LAST_EXCLUSION_TILE"] = context.intToString(endExclusionIndex);
if ((localDataSize/4)%2 == 0 && !context.getUseDoublePrecision()) if ((localDataSize/4)%2 == 0 && !context.getUseDoublePrecision())
defines["PARAMETER_SIZE_IS_EVEN"] = "1"; defines["PARAMETER_SIZE_IS_EVEN"] = "1";
//if (context.getComputeCapability() >= 3.0 && !context.getUseDoublePrecision())
// defines["ENABLE_SHUFFLE"] = "1";
CUmodule program = context.createModule(CudaKernelSources::vectorOps+context.replaceStrings(CudaKernelSources::nonbonded, replacements), defines); CUmodule program = context.createModule(CudaKernelSources::vectorOps+context.replaceStrings(CudaKernelSources::nonbonded, replacements), defines);
CUfunction kernel = context.getKernel(program, "computeNonbonded"); CUfunction kernel = context.getKernel(program, "computeNonbonded");
......
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