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

Moved diagnostic check for nans

parent 0ba57257
......@@ -4139,8 +4139,8 @@ void trackMutualInducedIterations( amoebaGpuContext amoebaGpu, int iteration){
// ---------------------------------------------------------------------------------------
if( amoebaGpu->log == NULL || currentStep > 20000 )return;
//if( amoebaGpu->log == NULL )return;
//if( amoebaGpu->log == NULL || currentStep > 20000 )return;
if( amoebaGpu->log == NULL )return;
gpuContext gpu = amoebaGpu->gpuContext;
currentStep++;
......@@ -4159,6 +4159,26 @@ void trackMutualInducedIterations( amoebaGpuContext amoebaGpu, int iteration){
methodName.c_str(), currentStep, average, stddev, iterationStat[2], iterationStat[3], iterationStat[4], amoebaGpu->mutualInducedCurrentEpsilon );
(void) fflush( amoebaGpu->log );
iterationStat[0] = iterationStat[1] = iterationStat[4] = 0.0;
int nansPresent = isNanOrInfinity( amoebaGpu->mutualInducedCurrentEpsilon );
if( nansPresent == 0 ){
for( int ii = 0; ii < gpu->natoms && nansPresent == 0; ii++ ){
if( isNanOrInfinity( gpu->psPosq4->_pSysStream[0][ii].x ) ||
isNanOrInfinity( gpu->psPosq4->_pSysStream[0][ii].y ) ||
isNanOrInfinity( gpu->psPosq4->_pSysStream[0][ii].z ) ||
isNanOrInfinity( gpu->psVelm4->_pSysStream[0][ii].x ) ||
isNanOrInfinity( gpu->psVelm4->_pSysStream[0][ii].y ) ||
isNanOrInfinity( gpu->psVelm4->_pSysStream[0][ii].z ) ){
nansPresent = 1;
}
}
}
if( nansPresent ){
(void) fprintf( amoebaGpu->log, "epsilon nan - exiting\n" );
(void) fflush( amoebaGpu->log );
exit(-1);
}
}
if( 0 ){
std::vector<int> fileId;
......@@ -4182,24 +4202,6 @@ void trackMutualInducedIterations( amoebaGpuContext amoebaGpu, int iteration){
cudaLoadCudaFloatArray( gpu->natoms, 3, amoebaGpu->psInducedDipolePolarS,outputVector );
*/
cudaWriteVectorOfDoubleVectorsToFile( "CudaMI", fileId, outputVector );
int nansPresent = isNanOrInfinity( amoebaGpu->mutualInducedCurrentEpsilon );
if( nansPresent == 0 ){
for( int ii = 0; ii < gpu->natoms && nansPresent == 0; ii++ ){
if( isNanOrInfinity( gpu->psPosq4->_pSysStream[0][ii].x ) ||
isNanOrInfinity( gpu->psPosq4->_pSysStream[0][ii].y ) ||
isNanOrInfinity( gpu->psPosq4->_pSysStream[0][ii].z ) ||
isNanOrInfinity( gpu->psVelm4->_pSysStream[0][ii].x ) ||
isNanOrInfinity( gpu->psVelm4->_pSysStream[0][ii].y ) ||
isNanOrInfinity( gpu->psVelm4->_pSysStream[0][ii].z ) ){
nansPresent = 1;
}
}
}
if( nansPresent ){
(void) fprintf( amoebaGpu->log, "epsilon nan - exiting\n" );
(void) fflush( amoebaGpu->log );
exit(-1);
}
}
}
......
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