Commit 73f248e7 authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Reactivated dupfac dynamic setting

Made setting of RNG seed consistent w/ logic used for Cuda 
parent 6eb3c418
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "BrookIntegrateLangevinStepKernel.h" #include "BrookIntegrateLangevinStepKernel.h"
#include "BrookStreamInternal.h" #include "BrookStreamInternal.h"
#include <ctime>
using namespace OpenMM; using namespace OpenMM;
using namespace std; using namespace std;
...@@ -201,13 +202,20 @@ void BrookIntegrateLangevinStepKernel::initialize( const System& system, const L ...@@ -201,13 +202,20 @@ void BrookIntegrateLangevinStepKernel::initialize( const System& system, const L
_brookRandomNumberGenerator = new BrookRandomNumberGenerator( ); _brookRandomNumberGenerator = new BrookRandomNumberGenerator( );
_brookRandomNumberGenerator->setup( (int) masses.size(), getPlatform() ); _brookRandomNumberGenerator->setup( (int) masses.size(), getPlatform() );
unsigned long int seed = static_cast<unsigned long int>( integrator.getRandomNumberSeed() );
unsigned long int seed;
if( integrator.getRandomNumberSeed() <= 1 ){
seed = static_cast<unsigned long int>(time(NULL) & 0x000fffff);
} else {
seed = static_cast<unsigned long int>( integrator.getRandomNumberSeed() );
}
_brookRandomNumberGenerator->setRandomNumberSeed( seed ); _brookRandomNumberGenerator->setRandomNumberSeed( seed );
if( printOn ){ if( printOn ){
(void) fprintf( log, "%s done setup:\nBrookShakeAlgorithm:\n%s\nBrookRandomNumberGenerator:\n%s\n\n", methodName.c_str(), (void) fprintf( log, "%s done setup:\nBrookShakeAlgorithm:\n%s\nBrookRandomNumberGenerator:\n%s\n\n", methodName.c_str(),
_brookShakeAlgorithm->getContentsString().c_str(), _brookShakeAlgorithm->getContentsString().c_str(),
_brookRandomNumberGenerator->getContentsString().c_str() ); _brookRandomNumberGenerator->getContentsString().c_str() );
(void) fprintf( log, "LangevinIntegrator seed=%d\n", integrator.getRandomNumberSeed() );
(void) fflush( log ); (void) fflush( log );
} }
......
...@@ -1098,7 +1098,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI ...@@ -1098,7 +1098,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI
static int showAux = 1; static int showAux = 1;
if( printOn ){ if( printOn && showAux ){
(void) fprintf( log, "%s step=%d shake=%d\n", methodName.c_str(), _internalStepCount, brookShakeAlgorithm.getNumberOfConstraints() ); (void) fprintf( log, "%s step=%d shake=%d\n", methodName.c_str(), _internalStepCount, brookShakeAlgorithm.getNumberOfConstraints() );
(void) fflush( log ); (void) fflush( log );
} }
...@@ -1119,6 +1119,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI ...@@ -1119,6 +1119,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI
(void) fprintf( log, "%s step=%d Shake contents\n%s", methodName.c_str(), _internalStepCount, contents.c_str() ); (void) fprintf( log, "%s step=%d Shake contents\n%s", methodName.c_str(), _internalStepCount, contents.c_str() );
(void) fflush( log ); (void) fflush( log );
} }
} }
// diagnostics // diagnostics
...@@ -1178,7 +1179,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI ...@@ -1178,7 +1179,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI
// diagnostics // diagnostics
if( printOn ){ if( 0 && printOn ){
(void) fprintf( log, "\n%s step=%d Post kupdate_sd1_fix1: particleStrW=%3d rngStrW=%3d rngOff=%5d " (void) fprintf( log, "\n%s step=%d Post kupdate_sd1_fix1: particleStrW=%3d rngStrW=%3d rngOff=%5d "
"EM=%12.5e Sd1pc[]=[%12.5e %12.5e %12.5e]", methodName.c_str(), _internalStepCount, "EM=%12.5e Sd1pc[]=[%12.5e %12.5e %12.5e]", methodName.c_str(), _internalStepCount,
getLangevinDynamicsParticleStreamWidth(), getLangevinDynamicsParticleStreamWidth(),
...@@ -1264,7 +1265,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI ...@@ -1264,7 +1265,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI
brookShakeAlgorithm.getShakeXCons3Stream()->getBrookStream(), brookShakeAlgorithm.getShakeXCons3Stream()->getBrookStream(),
getXPrimeStream()->getBrookStream() ); getXPrimeStream()->getBrookStream() );
if( printOn ){ if( 0 && printOn ){
(void) fprintf( log, "\n%s Post kshakeh_update1: sw=%d ShkCnstStrW=%3d tol=%.3f maxIt=%d", (void) fprintf( log, "\n%s Post kshakeh_update1: sw=%d ShkCnstStrW=%3d tol=%.3f maxIt=%d",
methodName.c_str(), getLangevinDynamicsParticleStreamWidth(), methodName.c_str(), getLangevinDynamicsParticleStreamWidth(),
...@@ -1328,7 +1329,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI ...@@ -1328,7 +1329,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI
// diagnostics // diagnostics
if( printOn ){ if( 0 && printOn ){
(void) fprintf( log, "\n%s step=%d Post kupdate_sd2_fix1: particleStrW=%3d rngStrW=%3d rngOff=%5d " (void) fprintf( log, "\n%s step=%d Post kupdate_sd2_fix1: particleStrW=%3d rngStrW=%3d rngOff=%5d "
"Sd2pc[]=[%12.5e %12.5e]", methodName.c_str(), _internalStepCount, "Sd2pc[]=[%12.5e %12.5e]", methodName.c_str(), _internalStepCount,
getLangevinDynamicsParticleStreamWidth(), getLangevinDynamicsParticleStreamWidth(),
...@@ -1408,7 +1409,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI ...@@ -1408,7 +1409,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI
// diagnostics // diagnostics
if( printOn ){ if( 0 && printOn ){
(void) fprintf( log, "\n%s step=%d Post kshakeh_update2_fix1: ShakeConstraintStreamWidth=%3d rngStrW=%3d rngOff=%5d " (void) fprintf( log, "\n%s step=%d Post kshakeh_update2_fix1: ShakeConstraintStreamWidth=%3d rngStrW=%3d rngOff=%5d "
"Sd2pc[]=[%12.5e %12.5e]\n", methodName.c_str(), _internalStepCount, "Sd2pc[]=[%12.5e %12.5e]\n", methodName.c_str(), _internalStepCount,
brookShakeAlgorithm.getShakeConstraintStreamWidth(), brookShakeAlgorithm.getShakeConstraintStreamWidth(),
...@@ -1453,7 +1454,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI ...@@ -1453,7 +1454,7 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI
// no constraints // no constraints
if( printOn ){ if( 0 && printOn ){
(void) fprintf( log, "\n%s Pre ksetStr3 (no constraints)", methodName.c_str() ); (void) fprintf( log, "\n%s Pre ksetStr3 (no constraints)", methodName.c_str() );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamInternal(); BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamInternal();
(void) fprintf( log, "\nPositionStream\n" ); (void) fprintf( log, "\nPositionStream\n" );
......
...@@ -394,12 +394,12 @@ int BrookPlatform::getDuplicationFactor( int numberOfParticles ) const { ...@@ -394,12 +394,12 @@ int BrookPlatform::getDuplicationFactor( int numberOfParticles ) const {
int duplicationFactor = 4; int duplicationFactor = 4;
if( numberOfParticles < 65 ){ if( numberOfParticles < 65 ){
duplicationFactor = 1; duplicationFactor = 1;
(void) fprintf( stderr, "%s forcing duplicationFactor=%d since number of particles=%d < 65\n", (void) fprintf( stderr, "%s forcing optimization parameter 'duplicationFactor' to %d since number of particles=%d < 65\n",
methodName.c_str(), duplicationFactor, numberOfParticles ); methodName.c_str(), duplicationFactor, numberOfParticles );
} }
// set only if _minSuggestedThreads is available from board // set only if _minSuggestedThreads is available from board
/*
if( _minSuggestedThreads > 0 ){ if( _minSuggestedThreads > 0 ){
float threads = static_cast<float>( _minSuggestedThreads ); float threads = static_cast<float>( _minSuggestedThreads );
float numP = static_cast<float>( numberOfParticles ); float numP = static_cast<float>( numberOfParticles );
...@@ -414,8 +414,9 @@ int BrookPlatform::getDuplicationFactor( int numberOfParticles ) const { ...@@ -414,8 +414,9 @@ int BrookPlatform::getDuplicationFactor( int numberOfParticles ) const {
duplicationFactor = static_cast<int>( ceil( factor*0.25f ) ); duplicationFactor = static_cast<int>( ceil( factor*0.25f ) );
duplicationFactor *= 4; duplicationFactor *= 4;
} }
// (void) fprintf( stderr, "getDuplicationFactor %.1f numiP=%.1f factor=%.1f duplicationFactor=%d\n", threads, numP, factor, duplicationFactor );
} }
*/
return duplicationFactor; return duplicationFactor;
} }
......
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