Commit d7aa33fe authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Fixed bug in setting Cuda device

parent ac8cb97f
...@@ -3027,9 +3027,10 @@ static int readAmoebaSurfaceParameters( FILE* filePtr, MapStringInt& forceMap, c ...@@ -3027,9 +3027,10 @@ static int readAmoebaSurfaceParameters( FILE* filePtr, MapStringInt& forceMap, c
//static const unsigned int maxPrint = MAX_PRINT; //static const unsigned int maxPrint = MAX_PRINT;
static const unsigned int maxPrint = 15; static const unsigned int maxPrint = 15;
unsigned int arraySize = static_cast<unsigned int>(sasaForce->getNumParticles()); unsigned int arraySize = static_cast<unsigned int>(sasaForce->getNumParticles());
(void) fprintf( log, "%s: %u sample of AmoebaSASAForce parameters in %s units; probe radius=%10.4f\n", //(void) fprintf( log, "%s: %u sample of AmoebaSASAForce parameters in %s units; probe radius=%10.4f\n",
methodName.c_str(), arraySize,
//methodName.c_str(), arraySize, (useOpenMMUnits ? "OpenMM" : "Amoeba"), //methodName.c_str(), arraySize, (useOpenMMUnits ? "OpenMM" : "Amoeba"),
(void) fprintf( log, "%s: %u sample of AmoebaSASAForce parameters; probe radius=%10.4f\n",
methodName.c_str(), arraySize,
sasaForce->getProbeRadius() ); sasaForce->getProbeRadius() );
for( unsigned int ii = 0; ii < arraySize; ii++ ){ for( unsigned int ii = 0; ii < arraySize; ii++ ){
...@@ -4505,17 +4506,17 @@ Context* createContext( const std::string& amoebaTinkerParameterFileName, MapStr ...@@ -4505,17 +4506,17 @@ Context* createContext( const std::string& amoebaTinkerParameterFileName, MapStr
Platform& platform = Platform::getPlatformByName("Cuda"); Platform& platform = Platform::getPlatformByName("Cuda");
map<string, string> properties; map<string, string> properties;
if( getenv("CudaDevice") || cudaDevice > -1 ){ if( getenv("CudaDevice") || cudaDevice > -1 ){
std::string cudaDevice; std::string cudaDeviceStr;
if( getenv("CudaDevice") ){ if( getenv("CudaDevice") ){
cudaDevice = getenv("CudaDevice"); cudaDeviceStr = getenv("CudaDevice");
} else { } else {
std::stringstream cudaDeviceStrStr; std::stringstream cudaDeviceStrStr;
cudaDeviceStrStr << cudaDevice; cudaDeviceStrStr << cudaDevice;
cudaDevice = cudaDeviceStrStr.str(); cudaDeviceStr = cudaDeviceStrStr.str();
} }
properties["CudaDevice"] = cudaDevice; properties["CudaDevice"] = cudaDeviceStr;
if( log ){ if( log ){
(void) fprintf( log, "Setting Cuda device to %s.\n", cudaDevice.c_str() ); (void) fprintf( log, "Setting Cuda device to %s.\n", cudaDeviceStr.c_str() );
} }
} }
Context* context = new Context(*system, *integrator, platform, properties); Context* context = new Context(*system, *integrator, platform, properties);
......
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