Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
36f6f9e6
Commit
36f6f9e6
authored
Jan 06, 2012
by
Mark Friedrichs
Browse files
Replaced exit() with exceptions
parent
591c5f92
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
36 deletions
+32
-36
plugins/amoeba/platforms/cuda/src/kernels/amoebaCudaGpu.cpp
plugins/amoeba/platforms/cuda/src/kernels/amoebaCudaGpu.cpp
+24
-25
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaGrycuk.cu
.../platforms/cuda/src/kernels/kCalculateAmoebaCudaGrycuk.cu
+1
-1
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaMutualInducedAndGkFields.cu
...c/kernels/kCalculateAmoebaCudaMutualInducedAndGkFields.cu
+2
-4
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeMutualInducedField.cu
.../src/kernels/kCalculateAmoebaCudaPmeMutualInducedField.cu
+3
-3
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaRotateFrame.cu
...forms/cuda/src/kernels/kCalculateAmoebaCudaRotateFrame.cu
+2
-3
No files found.
plugins/amoeba/platforms/cuda/src/kernels/amoebaCudaGpu.cpp
View file @
36f6f9e6
...
@@ -1303,7 +1303,6 @@ void gpuSetAmoebaTorsionTorsionGrids(amoebaGpuContext amoebaGpu, const std::vect
...
@@ -1303,7 +1303,6 @@ void gpuSetAmoebaTorsionTorsionGrids(amoebaGpuContext amoebaGpu, const std::vect
values[0], values[1], values[2], values[3] );
values[0], values[1], values[2], values[3] );
if( errors++ > 10 ){
if( errors++ > 10 ){
(void) fflush( amoebaGpu->log );
(void) fflush( amoebaGpu->log );
exit(0);
}
}
}
}
}
}
...
@@ -1312,7 +1311,6 @@ void gpuSetAmoebaTorsionTorsionGrids(amoebaGpuContext amoebaGpu, const std::vect
...
@@ -1312,7 +1311,6 @@ void gpuSetAmoebaTorsionTorsionGrids(amoebaGpuContext amoebaGpu, const std::vect
if( !errors ){
if( !errors ){
(void) fprintf( amoebaGpu->log, "No errors in grid readback\n" );
(void) fprintf( amoebaGpu->log, "No errors in grid readback\n" );
}
}
exit(0);
#endif
#endif
psTorsionTorsionGrids
->
Upload
();
psTorsionTorsionGrids
->
Upload
();
...
@@ -2391,8 +2389,9 @@ void gpuSetAmoebaVdwParameters( amoebaGpuContext amoebaGpu,
...
@@ -2391,8 +2389,9 @@ void gpuSetAmoebaVdwParameters( amoebaGpuContext amoebaGpu,
psVdwReductionID
->
_pSysData
[
count
].
w
=
ii
;
psVdwReductionID
->
_pSysData
[
count
].
w
=
ii
;
}
}
if
(
ivMapping
[
ii
].
size
()
>
3
){
if
(
ivMapping
[
ii
].
size
()
>
3
){
(
void
)
fprintf
(
stderr
,
"Atom %u has %u reductions -- invalid -- aborting"
,
ii
,
static_cast
<
unsigned
int
>
(
ivMapping
[
ii
].
size
())
);
std
::
stringstream
buffer
;
exit
(
1
);
buffer
<<
"Atom "
<<
ii
<<
" has "
<<
ivMapping
[
ii
].
size
()
<<
" reductions: value should be < 3."
;
throw
OpenMM
::
OpenMMException
(
buffer
.
str
()
);
}
}
count
++
;
count
++
;
}
}
...
@@ -3788,8 +3787,9 @@ FILE* getWriteToFilePtr( const std::string& fname, int step )
...
@@ -3788,8 +3787,9 @@ FILE* getWriteToFilePtr( const std::string& fname, int step )
FILE
*
filePtr
=
fopen
(
fileName
.
str
().
c_str
(),
"w"
);
FILE
*
filePtr
=
fopen
(
fileName
.
str
().
c_str
(),
"w"
);
#endif
#endif
if
(
filePtr
==
NULL
){
if
(
filePtr
==
NULL
){
(
void
)
fprintf
(
stderr
,
"Could not open file=<%s> for writitng."
,
fileName
.
str
().
c_str
()
);
std
::
stringstream
buffer
;
exit
(
-
1
);
buffer
<<
"Could not open file "
<<
fileName
.
str
()
<<
" for writitng."
;
throw
OpenMM
::
OpenMMException
(
buffer
.
str
()
);
}
}
return
filePtr
;
return
filePtr
;
}
}
...
@@ -3820,8 +3820,9 @@ FILE* getWriteToFilePtrV( const std::string& fname, std::vector<int>& fileId )
...
@@ -3820,8 +3820,9 @@ FILE* getWriteToFilePtrV( const std::string& fname, std::vector<int>& fileId )
FILE
*
filePtr
=
fopen
(
fileName
.
str
().
c_str
(),
"w"
);
FILE
*
filePtr
=
fopen
(
fileName
.
str
().
c_str
(),
"w"
);
#endif
#endif
if
(
filePtr
==
NULL
){
if
(
filePtr
==
NULL
){
(
void
)
fprintf
(
stderr
,
"Could not open file=<%s> for writing."
,
fileName
.
str
().
c_str
()
);
std
::
stringstream
buffer
;
exit
(
-
1
);
buffer
<<
"Could not open file "
<<
fileName
.
str
()
<<
" for writitng."
;
throw
OpenMM
::
OpenMMException
(
buffer
.
str
()
);
}
}
return
filePtr
;
return
filePtr
;
}
}
...
@@ -4077,7 +4078,7 @@ void cudaLoadCudaFloatArray( int numberOfParticles, int entriesPerParticle,
...
@@ -4077,7 +4078,7 @@ void cudaLoadCudaFloatArray( int numberOfParticles, int entriesPerParticle,
Check for nans in Cuda array
Check for nans in Cuda array
(1) download data from gpu
(1) download data from gpu
(2) check for nans and large values (> 1.0e+08) in array, and report if any found
and exit
(2) check for nans and large values (> 1.0e+08) in array, and report if any found
(3) report largest entry in absolute value, if no problems detected
(3) report largest entry in absolute value, if no problems detected
(4) also by editing 'targetParticle', can track values around that index
(4) also by editing 'targetParticle', can track values around that index
...
@@ -4133,7 +4134,6 @@ void checkForNans( int numberOfParticles, int entriesPerParticle,
...
@@ -4133,7 +4134,6 @@ void checkForNans( int numberOfParticles, int entriesPerParticle,
(
void
)
fprintf
(
log
,
"%s %6d no errors detected maxValue=%15.7e %6d.
\n
"
,
idString
.
c_str
(),
iteration
,
maxValue
,
maxIndex
);
(
void
)
fprintf
(
log
,
"%s %6d no errors detected maxValue=%15.7e %6d.
\n
"
,
idString
.
c_str
(),
iteration
,
maxValue
,
maxIndex
);
}
else
{
}
else
{
(
void
)
fprintf
(
log
,
"%s %6d errors detected maxValue=%15.7e %6d.
\n
"
,
idString
.
c_str
(),
iteration
,
maxValue
,
maxIndex
);
(
void
)
fprintf
(
log
,
"%s %6d errors detected maxValue=%15.7e %6d.
\n
"
,
idString
.
c_str
(),
iteration
,
maxValue
,
maxIndex
);
exit
(
-
1
);
}
}
}
}
...
@@ -4143,7 +4143,7 @@ void checkForNans( int numberOfParticles, int entriesPerParticle,
...
@@ -4143,7 +4143,7 @@ void checkForNans( int numberOfParticles, int entriesPerParticle,
Check for nans in Cuda<float4> array
Check for nans in Cuda<float4> array
(1) download data from gpu
(1) download data from gpu
(2) check for nans and large values (> 1.0e+08) in array, and report if any found
and exit
(2) check for nans and large values (> 1.0e+08) in array, and report if any found
(3) report largest entry in absolute value, if no problems detected
(3) report largest entry in absolute value, if no problems detected
(4) also by editing 'targetParticle', can track values around that index
(4) also by editing 'targetParticle', can track values around that index
...
@@ -4203,7 +4203,6 @@ void checkForNansFloat4( int numberOfParticles, CUDAStream<float4>* array, int*
...
@@ -4203,7 +4203,6 @@ void checkForNansFloat4( int numberOfParticles, CUDAStream<float4>* array, int*
(
void
)
fprintf
(
log
,
"%s %6d no errors detected maxValue=%15.7e %6d.
\n
"
,
idString
.
c_str
(),
iteration
,
maxValue
,
maxIndex
);
(
void
)
fprintf
(
log
,
"%s %6d no errors detected maxValue=%15.7e %6d.
\n
"
,
idString
.
c_str
(),
iteration
,
maxValue
,
maxIndex
);
}
else
{
}
else
{
(
void
)
fprintf
(
log
,
"%s %6d errors detected maxValue=%15.7e %6d.
\n
"
,
idString
.
c_str
(),
iteration
,
maxValue
,
maxIndex
);
(
void
)
fprintf
(
log
,
"%s %6d errors detected maxValue=%15.7e %6d.
\n
"
,
idString
.
c_str
(),
iteration
,
maxValue
,
maxIndex
);
exit
(
-
1
);
}
}
}
}
...
@@ -4615,9 +4614,9 @@ void trackMutualInducedIterations( amoebaGpuContext amoebaGpu, int iteration){
...
@@ -4615,9 +4614,9 @@ void trackMutualInducedIterations( amoebaGpuContext amoebaGpu, int iteration){
}
}
}
}
if
(
nansPresent
){
if
(
nansPresent
){
(
void
)
fprintf
(
amoebaGpu
->
log
,
"epsilon nan - exiting
\n
"
)
;
std
::
stringstream
buffer
;
(
void
)
fflush
(
amoebaGpu
->
log
)
;
buffer
<<
"epsilon nan exiting."
;
exit
(
-
1
);
throw
OpenMM
::
OpenMMException
(
buffer
.
str
()
);
}
}
}
}
...
...
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaGrycuk.cu
View file @
36f6f9e6
...
@@ -423,7 +423,7 @@ void kCalculateGrycukGbsaForces2( amoebaGpuContext amoebaGpu )
...
@@ -423,7 +423,7 @@ void kCalculateGrycukGbsaForces2( amoebaGpuContext amoebaGpu )
cudaLoadCudaFloatArray
(
gpu
->
natoms
,
1
,
gpu
->
psBornRadii
,
outputVector
,
gpu
->
psAtomIndex
->
_pSysData
,
1.0
f
);
cudaLoadCudaFloatArray
(
gpu
->
natoms
,
1
,
gpu
->
psBornRadii
,
outputVector
,
gpu
->
psAtomIndex
->
_pSysData
,
1.0
f
);
cudaWriteVectorOfDoubleVectorsToFile
(
"GryF"
,
fileId
,
outputVector
);
cudaWriteVectorOfDoubleVectorsToFile
(
"GryF"
,
fileId
,
outputVector
);
delete
temp
;
delete
temp
;
exit
(
0
);
//
exit(0);
}
}
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaMutualInducedAndGkFields.cu
View file @
36f6f9e6
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "amoebaGpuTypes.h"
#include "amoebaGpuTypes.h"
#include "amoebaCudaKernels.h"
#include "amoebaCudaKernels.h"
#include "kCalculateAmoebaCudaUtilities.h"
#include "kCalculateAmoebaCudaUtilities.h"
#include "openmm/OpenMMException.h"
#include <stdio.h>
#include <stdio.h>
...
@@ -586,10 +587,7 @@ static void cudaComputeAmoebaMutualInducedAndGkFieldBySOR( amoebaGpuContext amoe
...
@@ -586,10 +587,7 @@ static void cudaComputeAmoebaMutualInducedAndGkFieldBySOR( amoebaGpuContext amoe
// check for nans
// check for nans
if
(
currentEpsilon
!=
currentEpsilon
){
if
(
currentEpsilon
!=
currentEpsilon
){
(
void
)
fprintf
(
stderr
,
"cudaComputeAmoebaMutualInducedAndGkFieldBySOR at timestep=%d iteration=%3d eps is nan -- exiting.
\n
"
,
throw
OpenMM
::
OpenMMException
(
"GkFieldBySOR: Nans detected in induced dipole calculation."
);
timestep
,
iteration
);
(
void
)
fflush
(
NULL
);
exit
(
-
1
);
}
}
// converged?
// converged?
...
...
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeMutualInducedField.cu
View file @
36f6f9e6
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "amoebaGpuTypes.h"
#include "amoebaGpuTypes.h"
#include "amoebaCudaKernels.h"
#include "amoebaCudaKernels.h"
#include "kCalculateAmoebaCudaUtilities.h"
#include "kCalculateAmoebaCudaUtilities.h"
#include "openmm/OpenMMException.h"
#include <stdio.h>
#include <stdio.h>
...
@@ -549,11 +550,10 @@ static void cudaComputeAmoebaPmeMutualInducedFieldBySOR( amoebaGpuContext amoeba
...
@@ -549,11 +550,10 @@ static void cudaComputeAmoebaPmeMutualInducedFieldBySOR( amoebaGpuContext amoeba
done
=
1
;
done
=
1
;
}
}
//
exit if nan
//
throw exception if nan detected
if
(
amoebaGpu
->
mutualInducedCurrentEpsilon
!=
amoebaGpu
->
mutualInducedCurrentEpsilon
){
if
(
amoebaGpu
->
mutualInducedCurrentEpsilon
!=
amoebaGpu
->
mutualInducedCurrentEpsilon
){
(
void
)
fprintf
(
stderr
,
"PME MI iteration=%3d eps is nan -- exiting.
\n
"
,
iteration
);
throw
OpenMM
::
OpenMMException
(
"PME induced dipole calculation detected nans."
);
exit
(
0
);
}
}
iteration
++
;
iteration
++
;
...
...
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaRotateFrame.cu
View file @
36f6f9e6
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "cudaKernels.h"
#include "cudaKernels.h"
#include "amoebaCudaKernels.h"
#include "amoebaCudaKernels.h"
#include "kCalculateAmoebaCudaUtilities.h"
#include "kCalculateAmoebaCudaUtilities.h"
#include "openmm/OpenMMException.h"
#include <stdio.h>
#include <stdio.h>
#include <cuda.h>
#include <cuda.h>
...
@@ -480,9 +481,7 @@ void kCalculateAmoebaMultipoleForces(amoebaGpuContext amoebaGpu, bool hasAmoebaG
...
@@ -480,9 +481,7 @@ void kCalculateAmoebaMultipoleForces(amoebaGpuContext amoebaGpu, bool hasAmoebaG
// check if induce dipole calculation converged -- abort if it did not
// check if induce dipole calculation converged -- abort if it did not
if
(
amoebaGpu
->
mutualInducedDone
==
0
){
if
(
amoebaGpu
->
mutualInducedDone
==
0
){
(
void
)
fprintf
(
stderr
,
"%s induced dipole calculation did not converge -- aborting!
\n
"
,
methodName
.
c_str
()
);
throw
OpenMM
::
OpenMMException
(
"Induced dipole calculation did not converge"
);
(
void
)
fflush
(
stderr
);
exit
(
-
1
);
}
}
// calculate electrostatic forces
// calculate electrostatic forces
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment