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
3c8adf0c
"openmmapi/vscode:/vscode.git/clone" did not exist on "d51ef9e650836517690b9481f12cf3f0e44e24e6"
Commit
3c8adf0c
authored
Oct 31, 2012
by
Peter Eastman
Browse files
OpenCL and CUDA tests are run three times, once for each precision model
parent
6f4ec6b6
Changes
80
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
108 additions
and
84 deletions
+108
-84
platforms/cuda/tests/TestCudaLocalEnergyMinimizer.cpp
platforms/cuda/tests/TestCudaLocalEnergyMinimizer.cpp
+5
-4
platforms/cuda/tests/TestCudaMonteCarloBarostat.cpp
platforms/cuda/tests/TestCudaMonteCarloBarostat.cpp
+5
-5
platforms/cuda/tests/TestCudaMultipleForces.cpp
platforms/cuda/tests/TestCudaMultipleForces.cpp
+6
-3
platforms/cuda/tests/TestCudaNonbondedForce.cpp
platforms/cuda/tests/TestCudaNonbondedForce.cpp
+8
-15
platforms/cuda/tests/TestCudaPeriodicTorsionForce.cpp
platforms/cuda/tests/TestCudaPeriodicTorsionForce.cpp
+5
-3
platforms/cuda/tests/TestCudaRBTorsionForce.cpp
platforms/cuda/tests/TestCudaRBTorsionForce.cpp
+5
-3
platforms/cuda/tests/TestCudaRandom.cpp
platforms/cuda/tests/TestCudaRandom.cpp
+6
-4
platforms/cuda/tests/TestCudaSettle.cpp
platforms/cuda/tests/TestCudaSettle.cpp
+5
-2
platforms/cuda/tests/TestCudaSort.cpp
platforms/cuda/tests/TestCudaSort.cpp
+6
-3
platforms/cuda/tests/TestCudaVariableLangevinIntegrator.cpp
platforms/cuda/tests/TestCudaVariableLangevinIntegrator.cpp
+5
-5
platforms/cuda/tests/TestCudaVariableVerletIntegrator.cpp
platforms/cuda/tests/TestCudaVariableVerletIntegrator.cpp
+5
-5
platforms/cuda/tests/TestCudaVerletIntegrator.cpp
platforms/cuda/tests/TestCudaVerletIntegrator.cpp
+5
-5
platforms/cuda/tests/TestCudaVirtualSites.cpp
platforms/cuda/tests/TestCudaVirtualSites.cpp
+5
-7
platforms/opencl/tests/CMakeLists.txt
platforms/opencl/tests/CMakeLists.txt
+7
-1
platforms/opencl/tests/TestOpenCLAndersenThermostat.cpp
platforms/opencl/tests/TestOpenCLAndersenThermostat.cpp
+5
-4
platforms/opencl/tests/TestOpenCLBrownianIntegrator.cpp
platforms/opencl/tests/TestOpenCLBrownianIntegrator.cpp
+5
-5
platforms/opencl/tests/TestOpenCLCMAPTorsionForce.cpp
platforms/opencl/tests/TestOpenCLCMAPTorsionForce.cpp
+5
-2
platforms/opencl/tests/TestOpenCLCMMotionRemover.cpp
platforms/opencl/tests/TestOpenCLCMMotionRemover.cpp
+5
-2
platforms/opencl/tests/TestOpenCLCheckpoints.cpp
platforms/opencl/tests/TestOpenCLCheckpoints.cpp
+5
-2
platforms/opencl/tests/TestOpenCLCustomAngleForce.cpp
platforms/opencl/tests/TestOpenCLCustomAngleForce.cpp
+5
-4
No files found.
platforms/cuda/tests/TestCudaLocalEnergyMinimizer.cpp
View file @
3c8adf0c
...
@@ -45,6 +45,8 @@
...
@@ -45,6 +45,8 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
void
testHarmonicBonds
()
{
void
testHarmonicBonds
()
{
const
int
numParticles
=
10
;
const
int
numParticles
=
10
;
System
system
;
System
system
;
...
@@ -64,7 +66,6 @@ void testHarmonicBonds() {
...
@@ -64,7 +66,6 @@ void testHarmonicBonds() {
// Minimize it and check that all bonds are at their equilibrium distances.
// Minimize it and check that all bonds are at their equilibrium distances.
VerletIntegrator
integrator
(
0.01
);
VerletIntegrator
integrator
(
0.01
);
CudaPlatform
platform
;
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
LocalEnergyMinimizer
::
minimize
(
context
,
1e-5
);
LocalEnergyMinimizer
::
minimize
(
context
,
1e-5
);
...
@@ -105,7 +106,6 @@ void testLargeSystem() {
...
@@ -105,7 +106,6 @@ void testLargeSystem() {
// Minimize it and verify that the energy has decreased.
// Minimize it and verify that the energy has decreased.
CudaPlatform
platform
;
VerletIntegrator
integrator
(
0.01
);
VerletIntegrator
integrator
(
0.01
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
...
@@ -167,7 +167,6 @@ void testVirtualSites() {
...
@@ -167,7 +167,6 @@ void testVirtualSites() {
// Minimize it and verify that the energy has decreased.
// Minimize it and verify that the energy has decreased.
CudaPlatform
platform
;
VerletIntegrator
integrator
(
0.01
);
VerletIntegrator
integrator
(
0.01
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
...
@@ -199,8 +198,10 @@ void testVirtualSites() {
...
@@ -199,8 +198,10 @@ void testVirtualSites() {
ASSERT
(
forceNorm
<
3
*
tolerance
);
ASSERT
(
forceNorm
<
3
*
tolerance
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testHarmonicBonds
();
testHarmonicBonds
();
testLargeSystem
();
testLargeSystem
();
testVirtualSites
();
testVirtualSites
();
...
...
platforms/cuda/tests/TestCudaMonteCarloBarostat.cpp
View file @
3c8adf0c
...
@@ -49,8 +49,9 @@
...
@@ -49,8 +49,9 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
void
testChangingBoxSize
()
{
void
testChangingBoxSize
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
4
,
0
,
0
),
Vec3
(
0
,
5
,
0
),
Vec3
(
0
,
0
,
6
));
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
4
,
0
,
0
),
Vec3
(
0
,
5
,
0
),
Vec3
(
0
,
0
,
6
));
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -100,7 +101,6 @@ void testIdealGas() {
...
@@ -100,7 +101,6 @@ void testIdealGas() {
// Create a gas of noninteracting particles.
// Create a gas of noninteracting particles.
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
initialLength
,
0
,
0
),
Vec3
(
0
,
0.5
*
initialLength
,
0
),
Vec3
(
0
,
0
,
2
*
initialLength
));
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
initialLength
,
0
,
0
),
Vec3
(
0
,
0.5
*
initialLength
,
0
),
Vec3
(
0
,
0
,
2
*
initialLength
));
vector
<
Vec3
>
positions
(
numParticles
);
vector
<
Vec3
>
positions
(
numParticles
);
...
@@ -146,7 +146,6 @@ void testRandomSeed() {
...
@@ -146,7 +146,6 @@ void testRandomSeed() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
const
double
pressure
=
1.5
;
const
double
pressure
=
1.5
;
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
8
,
0
,
0
),
Vec3
(
0
,
8
,
0
),
Vec3
(
0
,
0
,
8
));
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
8
,
0
,
0
),
Vec3
(
0
,
8
,
0
),
Vec3
(
0
,
0
,
8
));
VerletIntegrator
integrator
(
0.01
);
VerletIntegrator
integrator
(
0.01
);
...
@@ -219,7 +218,6 @@ void testWater() {
...
@@ -219,7 +218,6 @@ void testWater() {
// Create a box of SPC water molecules.
// Create a box of SPC water molecules.
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
gridSize
*
spacing
,
0
,
0
),
Vec3
(
0
,
gridSize
*
spacing
,
0
),
Vec3
(
0
,
0
,
gridSize
*
spacing
));
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
gridSize
*
spacing
,
0
,
0
),
Vec3
(
0
,
gridSize
*
spacing
,
0
),
Vec3
(
0
,
0
,
gridSize
*
spacing
));
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
@@ -273,8 +271,10 @@ void testWater() {
...
@@ -273,8 +271,10 @@ void testWater() {
ASSERT_USUALLY_EQUAL_TOL
(
1.0
,
density
,
0.02
);
ASSERT_USUALLY_EQUAL_TOL
(
1.0
,
density
,
0.02
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testChangingBoxSize
();
testChangingBoxSize
();
testIdealGas
();
testIdealGas
();
testRandomSeed
();
testRandomSeed
();
...
...
platforms/cuda/tests/TestCudaMultipleForces.cpp
View file @
3c8adf0c
...
@@ -52,6 +52,8 @@
...
@@ -52,6 +52,8 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
const
double
TOL
=
1e-4
;
const
double
TOL
=
1e-4
;
void
testForces
()
{
void
testForces
()
{
...
@@ -78,9 +80,8 @@ void testForces() {
...
@@ -78,9 +80,8 @@ void testForces() {
ReferencePlatform
ref
;
ReferencePlatform
ref
;
VerletIntegrator
integrator1
(
0.01
);
VerletIntegrator
integrator1
(
0.01
);
Context
context1
(
system
,
integrator1
,
ref
);
Context
context1
(
system
,
integrator1
,
ref
);
CudaPlatform
cl
;
VerletIntegrator
integrator2
(
0.01
);
VerletIntegrator
integrator2
(
0.01
);
Context
context2
(
system
,
integrator2
,
cl
);
Context
context2
(
system
,
integrator2
,
platform
);
OpenMM_SFMT
::
SFMT
sfmt
;
OpenMM_SFMT
::
SFMT
sfmt
;
init_gen_rand
(
0
,
sfmt
);
init_gen_rand
(
0
,
sfmt
);
vector
<
Vec3
>
positions
(
numParticles
);
vector
<
Vec3
>
positions
(
numParticles
);
...
@@ -97,8 +98,10 @@ void testForces() {
...
@@ -97,8 +98,10 @@ void testForces() {
ASSERT_EQUAL_TOL
(
state1
.
getPotentialEnergy
(),
state2
.
getPotentialEnergy
(),
TOL
);
ASSERT_EQUAL_TOL
(
state1
.
getPotentialEnergy
(),
state2
.
getPotentialEnergy
(),
TOL
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testForces
();
testForces
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
platforms/cuda/tests/TestCudaNonbondedForce.cpp
View file @
3c8adf0c
...
@@ -53,10 +53,11 @@
...
@@ -53,10 +53,11 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
testCoulomb
()
{
void
testCoulomb
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -79,7 +80,6 @@ void testCoulomb() {
...
@@ -79,7 +80,6 @@ void testCoulomb() {
}
}
void
testLJ
()
{
void
testLJ
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -104,7 +104,6 @@ void testLJ() {
...
@@ -104,7 +104,6 @@ void testLJ() {
}
}
void
testExclusionsAnd14
()
{
void
testExclusionsAnd14
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
...
@@ -192,7 +191,6 @@ void testExclusionsAnd14() {
...
@@ -192,7 +191,6 @@ void testExclusionsAnd14() {
}
}
void
testCutoff
()
{
void
testCutoff
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -229,7 +227,6 @@ void testCutoff() {
...
@@ -229,7 +227,6 @@ void testCutoff() {
}
}
void
testCutoff14
()
{
void
testCutoff14
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
VerletIntegrator
integrator
(
0.01
);
VerletIntegrator
integrator
(
0.01
);
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
@@ -325,7 +322,6 @@ void testCutoff14() {
...
@@ -325,7 +322,6 @@ void testCutoff14() {
}
}
void
testPeriodic
()
{
void
testPeriodic
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -366,7 +362,6 @@ void testLargeSystem() {
...
@@ -366,7 +362,6 @@ void testLargeSystem() {
const
double
cutoff
=
2.0
;
const
double
cutoff
=
2.0
;
const
double
boxSize
=
20.0
;
const
double
boxSize
=
20.0
;
const
double
tol
=
2e-3
;
const
double
tol
=
2e-3
;
CudaPlatform
cl
;
ReferencePlatform
reference
;
ReferencePlatform
reference
;
System
system
;
System
system
;
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
...
@@ -404,7 +399,7 @@ void testLargeSystem() {
...
@@ -404,7 +399,7 @@ void testLargeSystem() {
system
.
addForce
(
bonds
);
system
.
addForce
(
bonds
);
VerletIntegrator
integrator1
(
0.01
);
VerletIntegrator
integrator1
(
0.01
);
VerletIntegrator
integrator2
(
0.01
);
VerletIntegrator
integrator2
(
0.01
);
Context
cuContext
(
system
,
integrator1
,
cl
);
Context
cuContext
(
system
,
integrator1
,
platform
);
Context
referenceContext
(
system
,
integrator2
,
reference
);
Context
referenceContext
(
system
,
integrator2
,
reference
);
cuContext
.
setPositions
(
positions
);
cuContext
.
setPositions
(
positions
);
cuContext
.
setVelocities
(
velocities
);
cuContext
.
setVelocities
(
velocities
);
...
@@ -450,7 +445,6 @@ void testBlockInteractions(bool periodic) {
...
@@ -450,7 +445,6 @@ void testBlockInteractions(bool periodic) {
const
int
numParticles
=
blockSize
*
numBlocks
;
const
int
numParticles
=
blockSize
*
numBlocks
;
const
double
cutoff
=
1.0
;
const
double
cutoff
=
1.0
;
const
double
boxSize
=
(
periodic
?
5.1
:
1.1
);
const
double
boxSize
=
(
periodic
?
5.1
:
1.1
);
CudaPlatform
cl
;
System
system
;
System
system
;
VerletIntegrator
integrator
(
0.01
);
VerletIntegrator
integrator
(
0.01
);
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
@@ -467,7 +461,7 @@ void testBlockInteractions(bool periodic) {
...
@@ -467,7 +461,7 @@ void testBlockInteractions(bool periodic) {
nonbonded
->
setCutoffDistance
(
cutoff
);
nonbonded
->
setCutoffDistance
(
cutoff
);
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
boxSize
,
0
,
0
),
Vec3
(
0
,
boxSize
,
0
),
Vec3
(
0
,
0
,
boxSize
));
system
.
addForce
(
nonbonded
);
system
.
addForce
(
nonbonded
);
Context
context
(
system
,
integrator
,
cl
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
ContextImpl
*
contextImpl
=
*
reinterpret_cast
<
ContextImpl
**>
(
&
context
);
ContextImpl
*
contextImpl
=
*
reinterpret_cast
<
ContextImpl
**>
(
&
context
);
CudaPlatform
::
PlatformData
&
data
=
*
static_cast
<
CudaPlatform
::
PlatformData
*>
(
contextImpl
->
getPlatformData
());
CudaPlatform
::
PlatformData
&
data
=
*
static_cast
<
CudaPlatform
::
PlatformData
*>
(
contextImpl
->
getPlatformData
());
...
@@ -628,7 +622,6 @@ void testDispersionCorrection() {
...
@@ -628,7 +622,6 @@ void testDispersionCorrection() {
int
numParticles
=
gridSize
*
gridSize
*
gridSize
;
int
numParticles
=
gridSize
*
gridSize
*
gridSize
;
double
boxSize
=
gridSize
*
0.5
;
double
boxSize
=
gridSize
*
0.5
;
double
cutoff
=
boxSize
/
3
;
double
cutoff
=
boxSize
/
3
;
CudaPlatform
platform
;
System
system
;
System
system
;
VerletIntegrator
integrator
(
0.01
);
VerletIntegrator
integrator
(
0.01
);
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
@@ -695,7 +688,6 @@ void testChangingParameters() {
...
@@ -695,7 +688,6 @@ void testChangingParameters() {
const
double
cutoff
=
2.0
;
const
double
cutoff
=
2.0
;
const
double
boxSize
=
20.0
;
const
double
boxSize
=
20.0
;
const
double
tol
=
2e-3
;
const
double
tol
=
2e-3
;
CudaPlatform
cl
;
ReferencePlatform
reference
;
ReferencePlatform
reference
;
System
system
;
System
system
;
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
...
@@ -728,7 +720,7 @@ void testChangingParameters() {
...
@@ -728,7 +720,7 @@ void testChangingParameters() {
VerletIntegrator
integrator1
(
0.01
);
VerletIntegrator
integrator1
(
0.01
);
VerletIntegrator
integrator2
(
0.01
);
VerletIntegrator
integrator2
(
0.01
);
Context
cuContext
(
system
,
integrator1
,
cl
);
Context
cuContext
(
system
,
integrator1
,
platform
);
Context
referenceContext
(
system
,
integrator2
,
reference
);
Context
referenceContext
(
system
,
integrator2
,
reference
);
cuContext
.
setPositions
(
positions
);
cuContext
.
setPositions
(
positions
);
referenceContext
.
setPositions
(
positions
);
referenceContext
.
setPositions
(
positions
);
...
@@ -761,7 +753,6 @@ void testChangingParameters() {
...
@@ -761,7 +753,6 @@ void testChangingParameters() {
}
}
void
testParallelComputation
(
bool
useCutoff
)
{
void
testParallelComputation
(
bool
useCutoff
)
{
CudaPlatform
platform
;
System
system
;
System
system
;
const
int
numParticles
=
200
;
const
int
numParticles
=
200
;
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
...
@@ -820,8 +811,10 @@ void testParallelComputation(bool useCutoff) {
...
@@ -820,8 +811,10 @@ void testParallelComputation(bool useCutoff) {
ASSERT_EQUAL_VEC
(
state1
.
getForces
()[
i
],
state2
.
getForces
()[
i
],
1e-5
);
ASSERT_EQUAL_VEC
(
state1
.
getForces
()[
i
],
state2
.
getForces
()[
i
],
1e-5
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testCoulomb
();
testCoulomb
();
testLJ
();
testLJ
();
testExclusionsAnd14
();
testExclusionsAnd14
();
...
...
platforms/cuda/tests/TestCudaPeriodicTorsionForce.cpp
View file @
3c8adf0c
...
@@ -46,10 +46,11 @@
...
@@ -46,10 +46,11 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
testPeriodicTorsions
()
{
void
testPeriodicTorsions
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -93,7 +94,6 @@ void testPeriodicTorsions() {
...
@@ -93,7 +94,6 @@ void testPeriodicTorsions() {
}
}
void
testParallelComputation
()
{
void
testParallelComputation
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
const
int
numParticles
=
200
;
const
int
numParticles
=
200
;
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
...
@@ -121,8 +121,10 @@ void testParallelComputation() {
...
@@ -121,8 +121,10 @@ void testParallelComputation() {
ASSERT_EQUAL_VEC
(
state1
.
getForces
()[
i
],
state2
.
getForces
()[
i
],
1e-5
);
ASSERT_EQUAL_VEC
(
state1
.
getForces
()[
i
],
state2
.
getForces
()[
i
],
1e-5
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testPeriodicTorsions
();
testPeriodicTorsions
();
testParallelComputation
();
testParallelComputation
();
}
}
...
...
platforms/cuda/tests/TestCudaRBTorsionForce.cpp
View file @
3c8adf0c
...
@@ -46,10 +46,11 @@
...
@@ -46,10 +46,11 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
testRBTorsions
()
{
void
testRBTorsions
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -112,7 +113,6 @@ void testRBTorsions() {
...
@@ -112,7 +113,6 @@ void testRBTorsions() {
}
}
void
testParallelComputation
()
{
void
testParallelComputation
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
const
int
numParticles
=
200
;
const
int
numParticles
=
200
;
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
...
@@ -140,8 +140,10 @@ void testParallelComputation() {
...
@@ -140,8 +140,10 @@ void testParallelComputation() {
ASSERT_EQUAL_VEC
(
state1
.
getForces
()[
i
],
state2
.
getForces
()[
i
],
1e-5
);
ASSERT_EQUAL_VEC
(
state1
.
getForces
()[
i
],
state2
.
getForces
()[
i
],
1e-5
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testRBTorsions
();
testRBTorsions
();
testParallelComputation
();
testParallelComputation
();
}
}
...
...
platforms/cuda/tests/TestCudaRandom.cpp
View file @
3c8adf0c
...
@@ -47,13 +47,14 @@
...
@@ -47,13 +47,14 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
void
testGaussian
()
{
void
testGaussian
()
{
int
numAtoms
=
5000
;
int
numAtoms
=
5000
;
System
system
;
System
system
;
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
CudaPlatform
platform
;
CudaPlatform
::
PlatformData
platformData
(
system
,
""
,
"true"
,
platform
.
getPropertyDefaultValue
(
"CudaPrecision"
),
CudaPlatform
::
PlatformData
platformData
(
system
,
""
,
"true"
,
"single"
,
platform
.
getPropertyDefaultValue
(
CudaPlatform
::
CudaCompiler
()),
platform
.
getPropertyDefaultValue
(
CudaPlatform
::
CudaTempDirectory
()));
platform
.
getPropertyDefaultValue
(
CudaPlatform
::
CudaCompiler
()),
platform
.
getPropertyDefaultValue
(
CudaPlatform
::
CudaTempDirectory
()));
CudaContext
&
context
=
*
platformData
.
contexts
[
0
];
CudaContext
&
context
=
*
platformData
.
contexts
[
0
];
context
.
initialize
();
context
.
initialize
();
...
@@ -93,7 +94,6 @@ void testRandomVelocities() {
...
@@ -93,7 +94,6 @@ void testRandomVelocities() {
const
int
numParticles
=
10000
;
const
int
numParticles
=
10000
;
const
double
temperture
=
100.0
;
const
double
temperture
=
100.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
VerletIntegrator
integrator
(
0.01
);
VerletIntegrator
integrator
(
0.01
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
...
@@ -131,8 +131,10 @@ void testRandomVelocities() {
...
@@ -131,8 +131,10 @@ void testRandomVelocities() {
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
4
/
sqrt
(
numParticles
));
ASSERT_USUALLY_EQUAL_TOL
(
expected
,
ke
,
4
/
sqrt
(
numParticles
));
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testGaussian
();
testGaussian
();
testRandomVelocities
();
testRandomVelocities
();
}
}
...
...
platforms/cuda/tests/TestCudaSettle.cpp
View file @
3c8adf0c
...
@@ -47,12 +47,13 @@
...
@@ -47,12 +47,13 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
void
testConstraints
()
{
void
testConstraints
()
{
const
int
numMolecules
=
10
;
const
int
numMolecules
=
10
;
const
int
numParticles
=
numMolecules
*
3
;
const
int
numParticles
=
numMolecules
*
3
;
const
int
numConstraints
=
numMolecules
*
3
;
const
int
numConstraints
=
numMolecules
*
3
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.001
);
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.001
);
integrator
.
setConstraintTolerance
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
@@ -103,8 +104,10 @@ void testConstraints() {
...
@@ -103,8 +104,10 @@ void testConstraints() {
}
}
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testConstraints
();
testConstraints
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
platforms/cuda/tests/TestCudaSort.cpp
View file @
3c8adf0c
...
@@ -46,6 +46,8 @@
...
@@ -46,6 +46,8 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
class
SortTrait
:
public
CudaSort
::
SortTrait
{
class
SortTrait
:
public
CudaSort
::
SortTrait
{
int
getDataSize
()
const
{
return
4
;}
int
getDataSize
()
const
{
return
4
;}
int
getKeySize
()
const
{
return
4
;}
int
getKeySize
()
const
{
return
4
;}
...
@@ -62,8 +64,7 @@ void verifySorting(vector<float> array) {
...
@@ -62,8 +64,7 @@ void verifySorting(vector<float> array) {
System
system
;
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
0.0
);
CudaPlatform
platform
;
CudaPlatform
::
PlatformData
platformData
(
system
,
""
,
"true"
,
platform
.
getPropertyDefaultValue
(
"CudaPrecision"
),
CudaPlatform
::
PlatformData
platformData
(
system
,
""
,
"true"
,
"single"
,
platform
.
getPropertyDefaultValue
(
CudaPlatform
::
CudaCompiler
()),
platform
.
getPropertyDefaultValue
(
CudaPlatform
::
CudaTempDirectory
()));
platform
.
getPropertyDefaultValue
(
CudaPlatform
::
CudaCompiler
()),
platform
.
getPropertyDefaultValue
(
CudaPlatform
::
CudaTempDirectory
()));
CudaContext
&
context
=
*
platformData
.
contexts
[
0
];
CudaContext
&
context
=
*
platformData
.
contexts
[
0
];
context
.
initialize
();
context
.
initialize
();
...
@@ -108,8 +109,10 @@ void testLogValues()
...
@@ -108,8 +109,10 @@ void testLogValues()
verifySorting
(
array
);
verifySorting
(
array
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testUniformValues
();
testUniformValues
();
testLogValues
();
testLogValues
();
}
}
...
...
platforms/cuda/tests/TestCudaVariableLangevinIntegrator.cpp
View file @
3c8adf0c
...
@@ -48,10 +48,11 @@
...
@@ -48,10 +48,11 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
testSingleBond
()
{
void
testSingleBond
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
...
@@ -97,7 +98,6 @@ void testSingleBond() {
...
@@ -97,7 +98,6 @@ void testSingleBond() {
void
testTemperature
()
{
void
testTemperature
()
{
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
VariableLangevinIntegrator
integrator
(
temp
,
2.0
,
1e-4
);
VariableLangevinIntegrator
integrator
(
temp
,
2.0
,
1e-4
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
@@ -132,7 +132,6 @@ void testTemperature() {
...
@@ -132,7 +132,6 @@ void testTemperature() {
void
testConstraints
()
{
void
testConstraints
()
{
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
VariableLangevinIntegrator
integrator
(
temp
,
2.0
,
1e-5
);
VariableLangevinIntegrator
integrator
(
temp
,
2.0
,
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
@@ -175,7 +174,6 @@ void testConstraints() {
...
@@ -175,7 +174,6 @@ void testConstraints() {
void
testRandomSeed
()
{
void
testRandomSeed
()
{
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
VariableLangevinIntegrator
integrator
(
temp
,
2.0
,
1e-5
);
VariableLangevinIntegrator
integrator
(
temp
,
2.0
,
1e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
@@ -230,8 +228,10 @@ void testRandomSeed() {
...
@@ -230,8 +228,10 @@ void testRandomSeed() {
}
}
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testSingleBond
();
testSingleBond
();
testTemperature
();
testTemperature
();
testConstraints
();
testConstraints
();
...
...
platforms/cuda/tests/TestCudaVariableVerletIntegrator.cpp
View file @
3c8adf0c
...
@@ -48,10 +48,11 @@
...
@@ -48,10 +48,11 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
testSingleBond
()
{
void
testSingleBond
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
...
@@ -89,7 +90,6 @@ void testConstraints() {
...
@@ -89,7 +90,6 @@ void testConstraints() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
int
numConstraints
=
5
;
const
int
numConstraints
=
5
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
VariableVerletIntegrator
integrator
(
1e-5
);
VariableVerletIntegrator
integrator
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
@@ -150,8 +150,6 @@ void testConstraints() {
...
@@ -150,8 +150,6 @@ void testConstraints() {
void
testConstrainedClusters
()
{
void
testConstrainedClusters
()
{
const
int
numParticles
=
7
;
const
int
numParticles
=
7
;
const
double
temp
=
500.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
VariableVerletIntegrator
integrator
(
1e-5
);
VariableVerletIntegrator
integrator
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
@@ -213,8 +211,10 @@ void testConstrainedClusters() {
...
@@ -213,8 +211,10 @@ void testConstrainedClusters() {
ASSERT
(
context
.
getState
(
State
::
Positions
).
getTime
()
>
0.1
);
ASSERT
(
context
.
getState
(
State
::
Positions
).
getTime
()
>
0.1
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testSingleBond
();
testSingleBond
();
testConstraints
();
testConstraints
();
testConstrainedClusters
();
testConstrainedClusters
();
...
...
platforms/cuda/tests/TestCudaVerletIntegrator.cpp
View file @
3c8adf0c
...
@@ -48,10 +48,11 @@
...
@@ -48,10 +48,11 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
testSingleBond
()
{
void
testSingleBond
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
...
@@ -90,7 +91,6 @@ void testConstraints() {
...
@@ -90,7 +91,6 @@ void testConstraints() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
int
numConstraints
=
5
;
const
int
numConstraints
=
5
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
VerletIntegrator
integrator
(
0.001
);
VerletIntegrator
integrator
(
0.001
);
integrator
.
setConstraintTolerance
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
@@ -143,8 +143,6 @@ void testConstraints() {
...
@@ -143,8 +143,6 @@ void testConstraints() {
void
testConstrainedClusters
()
{
void
testConstrainedClusters
()
{
const
int
numParticles
=
7
;
const
int
numParticles
=
7
;
const
double
temp
=
500.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
VerletIntegrator
integrator
(
0.001
);
VerletIntegrator
integrator
(
0.001
);
integrator
.
setConstraintTolerance
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
@@ -205,8 +203,10 @@ void testConstrainedClusters() {
...
@@ -205,8 +203,10 @@ void testConstrainedClusters() {
}
}
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testSingleBond
();
testSingleBond
();
testConstraints
();
testConstraints
();
testConstrainedClusters
();
testConstrainedClusters
();
...
...
platforms/cuda/tests/TestCudaVirtualSites.cpp
View file @
3c8adf0c
...
@@ -50,11 +50,12 @@
...
@@ -50,11 +50,12 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
CudaPlatform
platform
;
/**
/**
* Check that massless particles are handled correctly.
* Check that massless particles are handled correctly.
*/
*/
void
testMasslessParticle
()
{
void
testMasslessParticle
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
0.0
);
system
.
addParticle
(
0.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -91,7 +92,6 @@ void testMasslessParticle() {
...
@@ -91,7 +92,6 @@ void testMasslessParticle() {
* Test a TwoParticleAverageSite virtual site.
* Test a TwoParticleAverageSite virtual site.
*/
*/
void
testTwoParticleAverage
()
{
void
testTwoParticleAverage
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -128,7 +128,6 @@ void testTwoParticleAverage() {
...
@@ -128,7 +128,6 @@ void testTwoParticleAverage() {
* Test a ThreeParticleAverageSite virtual site.
* Test a ThreeParticleAverageSite virtual site.
*/
*/
void
testThreeParticleAverage
()
{
void
testThreeParticleAverage
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -170,7 +169,6 @@ void testThreeParticleAverage() {
...
@@ -170,7 +169,6 @@ void testThreeParticleAverage() {
* Test an OutOfPlaneSite virtual site.
* Test an OutOfPlaneSite virtual site.
*/
*/
void
testOutOfPlane
()
{
void
testOutOfPlane
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
...
@@ -220,7 +218,6 @@ void testOutOfPlane() {
...
@@ -220,7 +218,6 @@ void testOutOfPlane() {
* when using virtual sites.
* when using virtual sites.
*/
*/
void
testConservationLaws
()
{
void
testConservationLaws
()
{
CudaPlatform
platform
;
System
system
;
System
system
;
NonbondedForce
*
forceField
=
new
NonbondedForce
();
NonbondedForce
*
forceField
=
new
NonbondedForce
();
system
.
addForce
(
forceField
);
system
.
addForce
(
forceField
);
...
@@ -329,7 +326,6 @@ void testConservationLaws() {
...
@@ -329,7 +326,6 @@ void testConservationLaws() {
void
testReordering
()
{
void
testReordering
()
{
const
double
cutoff
=
2.0
;
const
double
cutoff
=
2.0
;
const
double
boxSize
=
20.0
;
const
double
boxSize
=
20.0
;
CudaPlatform
platform
;
System
system
;
System
system
;
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
system
.
addForce
(
nonbonded
);
system
.
addForce
(
nonbonded
);
...
@@ -430,8 +426,10 @@ void testReordering() {
...
@@ -430,8 +426,10 @@ void testReordering() {
}
}
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"CudaPrecision"
,
string
(
argv
[
1
]));
testMasslessParticle
();
testMasslessParticle
();
testTwoParticleAverage
();
testTwoParticleAverage
();
testThreeParticleAverage
();
testThreeParticleAverage
();
...
...
platforms/opencl/tests/CMakeLists.txt
View file @
3c8adf0c
...
@@ -7,6 +7,8 @@ ENABLE_TESTING()
...
@@ -7,6 +7,8 @@ ENABLE_TESTING()
# INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../FindOpenCL.cmake)
# INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../FindOpenCL.cmake)
INCLUDE_DIRECTORIES
(
${
OPENCL_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
OPENCL_INCLUDE_DIR
}
)
SET
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS TRUE CACHE BOOL
"Whether to build double precision versions of OpenCL test cases"
)
SET
(
INCLUDE_SERIALIZATION FALSE
)
SET
(
INCLUDE_SERIALIZATION FALSE
)
#SET( INCLUDE_SERIALIZATION TRUE )
#SET( INCLUDE_SERIALIZATION TRUE )
...
@@ -53,7 +55,11 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -53,7 +55,11 @@ FOREACH(TEST_PROG ${TEST_PROGS})
ENDIF
(
INCLUDE_SERIALIZATION
)
ENDIF
(
INCLUDE_SERIALIZATION
)
ENDIF
(
${
TEST_ROOT
}
STREQUAL
"TestOpenCLGBSAOBCForce2"
)
ENDIF
(
${
TEST_ROOT
}
STREQUAL
"TestOpenCLGBSAOBCForce2"
)
ADD_TEST
(
${
TEST_ROOT
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
)
ADD_TEST
(
${
TEST_ROOT
}
Single
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
single
)
IF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
ADD_TEST
(
${
TEST_ROOT
}
Mixed
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
mixed
)
ADD_TEST
(
${
TEST_ROOT
}
Double
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
double
)
ENDIF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
# Link with static library
# Link with static library
# SET(TEST_STATIC ${TEST_ROOT}Static)
# SET(TEST_STATIC ${TEST_ROOT}Static)
...
...
platforms/opencl/tests/TestOpenCLAndersenThermostat.cpp
View file @
3c8adf0c
...
@@ -48,12 +48,13 @@
...
@@ -48,12 +48,13 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
OpenCLPlatform
platform
;
void
testTemperature
()
{
void
testTemperature
()
{
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
10000
;
const
int
numSteps
=
10000
;
OpenCLPlatform
platform
;
System
system
;
System
system
;
VerletIntegrator
integrator
(
0.005
);
VerletIntegrator
integrator
(
0.005
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
@@ -92,7 +93,6 @@ void testConstraints() {
...
@@ -92,7 +93,6 @@ void testConstraints() {
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
double
collisionFreq
=
10.0
;
const
int
numSteps
=
10000
;
const
int
numSteps
=
10000
;
OpenCLPlatform
platform
;
System
system
;
System
system
;
VerletIntegrator
integrator
(
0.005
);
VerletIntegrator
integrator
(
0.005
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
@@ -144,7 +144,6 @@ void testRandomSeed() {
...
@@ -144,7 +144,6 @@ void testRandomSeed() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
double
collisionFreq
=
10.0
;
OpenCLPlatform
platform
;
System
system
;
System
system
;
VerletIntegrator
integrator
(
0.01
);
VerletIntegrator
integrator
(
0.01
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
@@ -201,8 +200,10 @@ void testRandomSeed() {
...
@@ -201,8 +200,10 @@ void testRandomSeed() {
}
}
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"OpenCLPrecision"
,
string
(
argv
[
1
]));
testTemperature
();
testTemperature
();
testConstraints
();
testConstraints
();
testRandomSeed
();
testRandomSeed
();
...
...
platforms/opencl/tests/TestOpenCLBrownianIntegrator.cpp
View file @
3c8adf0c
...
@@ -51,10 +51,11 @@
...
@@ -51,10 +51,11 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
OpenCLPlatform
platform
;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
testSingleBond
()
{
void
testSingleBond
()
{
OpenCLPlatform
platform
;
System
system
;
System
system
;
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
...
@@ -91,7 +92,6 @@ void testTemperature() {
...
@@ -91,7 +92,6 @@ void testTemperature() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
int
numBonds
=
numParticles
-
1
;
const
int
numBonds
=
numParticles
-
1
;
const
double
temp
=
10.0
;
const
double
temp
=
10.0
;
OpenCLPlatform
platform
;
System
system
;
System
system
;
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.01
);
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.01
);
HarmonicBondForce
*
forceField
=
new
HarmonicBondForce
();
HarmonicBondForce
*
forceField
=
new
HarmonicBondForce
();
...
@@ -128,7 +128,6 @@ void testConstraints() {
...
@@ -128,7 +128,6 @@ void testConstraints() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
int
numConstraints
=
5
;
const
int
numConstraints
=
5
;
const
double
temp
=
20.0
;
const
double
temp
=
20.0
;
OpenCLPlatform
platform
;
System
system
;
System
system
;
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.001
);
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.001
);
integrator
.
setConstraintTolerance
(
1e-5
);
integrator
.
setConstraintTolerance
(
1e-5
);
...
@@ -177,7 +176,6 @@ void testRandomSeed() {
...
@@ -177,7 +176,6 @@ void testRandomSeed() {
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
const
double
temp
=
100.0
;
const
double
collisionFreq
=
10.0
;
const
double
collisionFreq
=
10.0
;
OpenCLPlatform
platform
;
System
system
;
System
system
;
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.001
);
BrownianIntegrator
integrator
(
temp
,
2.0
,
0.001
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
NonbondedForce
*
forceField
=
new
NonbondedForce
();
...
@@ -232,8 +230,10 @@ void testRandomSeed() {
...
@@ -232,8 +230,10 @@ void testRandomSeed() {
}
}
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"OpenCLPrecision"
,
string
(
argv
[
1
]));
testSingleBond
();
testSingleBond
();
testTemperature
();
testTemperature
();
testConstraints
();
testConstraints
();
...
...
platforms/opencl/tests/TestOpenCLCMAPTorsionForce.cpp
View file @
3c8adf0c
...
@@ -48,6 +48,8 @@
...
@@ -48,6 +48,8 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
OpenCLPlatform
platform
;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
testCMAPTorsions
()
{
void
testCMAPTorsions
()
{
...
@@ -56,7 +58,6 @@ void testCMAPTorsions() {
...
@@ -56,7 +58,6 @@ void testCMAPTorsions() {
// Create two systems: one with a pair of periodic torsions, and one with a CMAP torsion
// Create two systems: one with a pair of periodic torsions, and one with a CMAP torsion
// that approximates the same force.
// that approximates the same force.
OpenCLPlatform
platform
;
System
system1
;
System
system1
;
for
(
int
i
=
0
;
i
<
5
;
i
++
)
for
(
int
i
=
0
;
i
<
5
;
i
++
)
system1
.
addParticle
(
1.0
);
system1
.
addParticle
(
1.0
);
...
@@ -104,8 +105,10 @@ void testCMAPTorsions() {
...
@@ -104,8 +105,10 @@ void testCMAPTorsions() {
}
}
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"OpenCLPrecision"
,
string
(
argv
[
1
]));
testCMAPTorsions
();
testCMAPTorsions
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
platforms/opencl/tests/TestOpenCLCMMotionRemover.cpp
View file @
3c8adf0c
...
@@ -50,6 +50,8 @@
...
@@ -50,6 +50,8 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
OpenCLPlatform
platform
;
Vec3
calcCM
(
const
vector
<
Vec3
>&
values
,
System
&
system
)
{
Vec3
calcCM
(
const
vector
<
Vec3
>&
values
,
System
&
system
)
{
Vec3
cm
;
Vec3
cm
;
for
(
int
j
=
0
;
j
<
system
.
getNumParticles
();
++
j
)
{
for
(
int
j
=
0
;
j
<
system
.
getNumParticles
();
++
j
)
{
...
@@ -62,7 +64,6 @@ Vec3 calcCM(const vector<Vec3>& values, System& system) {
...
@@ -62,7 +64,6 @@ Vec3 calcCM(const vector<Vec3>& values, System& system) {
void
testMotionRemoval
(
Integrator
&
integrator
)
{
void
testMotionRemoval
(
Integrator
&
integrator
)
{
const
int
numParticles
=
8
;
const
int
numParticles
=
8
;
OpenCLPlatform
platform
;
System
system
;
System
system
;
HarmonicBondForce
*
bonds
=
new
HarmonicBondForce
();
HarmonicBondForce
*
bonds
=
new
HarmonicBondForce
();
bonds
->
addBond
(
2
,
3
,
2.0
,
0.5
);
bonds
->
addBond
(
2
,
3
,
2.0
,
0.5
);
...
@@ -103,8 +104,10 @@ void testMotionRemoval(Integrator& integrator) {
...
@@ -103,8 +104,10 @@ void testMotionRemoval(Integrator& integrator) {
}
}
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"OpenCLPrecision"
,
string
(
argv
[
1
]));
LangevinIntegrator
langevin
(
0.0
,
1e-5
,
0.01
);
LangevinIntegrator
langevin
(
0.0
,
1e-5
,
0.01
);
testMotionRemoval
(
langevin
);
testMotionRemoval
(
langevin
);
VerletIntegrator
verlet
(
0.01
);
VerletIntegrator
verlet
(
0.01
);
...
...
platforms/opencl/tests/TestOpenCLCheckpoints.cpp
View file @
3c8adf0c
...
@@ -48,6 +48,8 @@
...
@@ -48,6 +48,8 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
OpenCLPlatform
platform
;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
compareStates
(
State
&
s1
,
State
&
s2
)
{
void
compareStates
(
State
&
s1
,
State
&
s2
)
{
...
@@ -71,7 +73,6 @@ void testCheckpoint() {
...
@@ -71,7 +73,6 @@ void testCheckpoint() {
const
int
numParticles
=
100
;
const
int
numParticles
=
100
;
const
double
boxSize
=
5.0
;
const
double
boxSize
=
5.0
;
const
double
temperature
=
200.0
;
const
double
temperature
=
200.0
;
OpenCLPlatform
platform
;
System
system
;
System
system
;
system
.
addForce
(
new
AndersenThermostat
(
0.0
,
100.0
));
system
.
addForce
(
new
AndersenThermostat
(
0.0
,
100.0
));
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
NonbondedForce
*
nonbonded
=
new
NonbondedForce
();
...
@@ -158,8 +159,10 @@ void testCheckpoint() {
...
@@ -158,8 +159,10 @@ void testCheckpoint() {
compareStates
(
s6
,
s8
);
compareStates
(
s6
,
s8
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"OpenCLPrecision"
,
string
(
argv
[
1
]));
testCheckpoint
();
testCheckpoint
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
platforms/opencl/tests/TestOpenCLCustomAngleForce.cpp
View file @
3c8adf0c
...
@@ -49,9 +49,9 @@ using namespace std;
...
@@ -49,9 +49,9 @@ using namespace std;
const
double
TOL
=
1e-5
;
const
double
TOL
=
1e-5
;
void
testAngles
()
{
OpenCLPlatform
platform
;
OpenCLPlatform
platform
;
void
testAngles
()
{
// Create a system using a CustomAngleForce.
// Create a system using a CustomAngleForce.
System
customSystem
;
System
customSystem
;
...
@@ -134,7 +134,6 @@ void testAngles() {
...
@@ -134,7 +134,6 @@ void testAngles() {
}
}
void
testParallelComputation
()
{
void
testParallelComputation
()
{
OpenCLPlatform
platform
;
System
system
;
System
system
;
const
int
numParticles
=
200
;
const
int
numParticles
=
200
;
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
...
@@ -163,8 +162,10 @@ void testParallelComputation() {
...
@@ -163,8 +162,10 @@ void testParallelComputation() {
ASSERT_EQUAL_VEC
(
state1
.
getForces
()[
i
],
state2
.
getForces
()[
i
],
1e-5
);
ASSERT_EQUAL_VEC
(
state1
.
getForces
()[
i
],
state2
.
getForces
()[
i
],
1e-5
);
}
}
int
main
()
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
try
{
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"OpenCLPrecision"
,
string
(
argv
[
1
]));
testAngles
();
testAngles
();
testParallelComputation
();
testParallelComputation
();
}
}
...
...
Prev
1
2
3
4
Next
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