Commit 03a5288d authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed lots of warnings and errors on Lion

parent dbccf50f
...@@ -57,6 +57,9 @@ const int OpenCLContext::ThreadBlockSize = 64; ...@@ -57,6 +57,9 @@ const int OpenCLContext::ThreadBlockSize = 64;
const int OpenCLContext::TileSize = 32; const int OpenCLContext::TileSize = 32;
static void CL_CALLBACK errorCallback(const char* errinfo, const void* private_info, size_t cb, void* user_data) { static void CL_CALLBACK errorCallback(const char* errinfo, const void* private_info, size_t cb, void* user_data) {
string skip = "OpenCL Build Warning : Compiler build log:";
if (strncmp(errinfo, skip.c_str(), skip.length()) == 0)
return; // OS X Lion insists on calling this for every build warning, even though they aren't errors.
std::cerr << "OpenCL internal error: " << errinfo << std::endl; std::cerr << "OpenCL internal error: " << errinfo << std::endl;
} }
......
...@@ -79,7 +79,7 @@ __kernel void computeN2Energy( ...@@ -79,7 +79,7 @@ __kernel void computeN2Energy(
exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx]; exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx];
if (tgx == 0) if (tgx == 0)
exclusionIndex[localGroupIndex] = -1; exclusionIndex[localGroupIndex] = -1;
for (int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE) for (unsigned int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE)
if (exclusionIndices[i] == y) if (exclusionIndices[i] == y)
exclusionIndex[localGroupIndex] = i*TILE_SIZE; exclusionIndex[localGroupIndex] = i*TILE_SIZE;
bool hasExclusions = (exclusionIndex[localGroupIndex] > -1); bool hasExclusions = (exclusionIndex[localGroupIndex] > -1);
......
...@@ -72,7 +72,7 @@ __kernel void computeN2Value(__global const float4* restrict posq, __local float ...@@ -72,7 +72,7 @@ __kernel void computeN2Value(__global const float4* restrict posq, __local float
exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx]; exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx];
if (tgx == 0) if (tgx == 0)
exclusionIndex[localGroupIndex] = -1; exclusionIndex[localGroupIndex] = -1;
for (int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE) for (unsigned int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE)
if (exclusionIndices[i] == y) if (exclusionIndices[i] == y)
exclusionIndex[localGroupIndex] = i*TILE_SIZE; exclusionIndex[localGroupIndex] = i*TILE_SIZE;
bool hasExclusions = (exclusionIndex[localGroupIndex] > -1); bool hasExclusions = (exclusionIndex[localGroupIndex] > -1);
......
...@@ -137,7 +137,7 @@ __kernel void computeBornSum( ...@@ -137,7 +137,7 @@ __kernel void computeBornSum(
exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx]; exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx];
if (tgx == 0) if (tgx == 0)
exclusionIndex[localGroupIndex] = -1; exclusionIndex[localGroupIndex] = -1;
for (int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE) for (unsigned int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE)
if (exclusionIndices[i] == y) if (exclusionIndices[i] == y)
exclusionIndex[localGroupIndex] = i*TILE_SIZE; exclusionIndex[localGroupIndex] = i*TILE_SIZE;
computeSubset = (exclusionIndex[localGroupIndex] == -1); computeSubset = (exclusionIndex[localGroupIndex] == -1);
...@@ -462,7 +462,7 @@ __kernel void computeGBSAForce1( ...@@ -462,7 +462,7 @@ __kernel void computeGBSAForce1(
exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx]; exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx];
if (tgx == 0) if (tgx == 0)
exclusionIndex[localGroupIndex] = -1; exclusionIndex[localGroupIndex] = -1;
for (int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE) for (unsigned int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE)
if (exclusionIndices[i] == y) if (exclusionIndices[i] == y)
exclusionIndex[localGroupIndex] = i*TILE_SIZE; exclusionIndex[localGroupIndex] = i*TILE_SIZE;
computeSubset = (exclusionIndex[localGroupIndex] == -1); computeSubset = (exclusionIndex[localGroupIndex] == -1);
......
...@@ -75,7 +75,7 @@ __kernel void selectLangevinStepSize(float maxStepSize, float errorTol, float ta ...@@ -75,7 +75,7 @@ __kernel void selectLangevinStepSize(float maxStepSize, float errorTol, float ta
// Sum the errors from all threads. // Sum the errors from all threads.
for (int offset = 1; offset < get_local_size(0); offset *= 2) { for (unsigned int offset = 1; offset < get_local_size(0); offset *= 2) {
if (get_local_id(0)+offset < get_local_size(0) && (get_local_id(0)&(2*offset-1)) == 0) if (get_local_id(0)+offset < get_local_size(0) && (get_local_id(0)&(2*offset-1)) == 0)
error[get_local_id(0)] += error[get_local_id(0)+offset]; error[get_local_id(0)] += error[get_local_id(0)+offset];
barrier(CLK_LOCAL_MEM_FENCE); barrier(CLK_LOCAL_MEM_FENCE);
......
...@@ -81,7 +81,7 @@ __kernel void computeNonbonded( ...@@ -81,7 +81,7 @@ __kernel void computeNonbonded(
exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx]; exclusionRange[2*localGroupIndex+tgx] = exclusionRowIndices[x+tgx];
if (tgx == 0) if (tgx == 0)
exclusionIndex[localGroupIndex] = -1; exclusionIndex[localGroupIndex] = -1;
for (int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE) for (unsigned int i = exclusionRange[2*localGroupIndex]+tgx; i < exclusionRange[2*localGroupIndex+1]; i += TILE_SIZE)
if (exclusionIndices[i] == y) if (exclusionIndices[i] == y)
exclusionIndex[localGroupIndex] = i*TILE_SIZE; exclusionIndex[localGroupIndex] = i*TILE_SIZE;
bool hasExclusions = (exclusionIndex[localGroupIndex] > -1); bool hasExclusions = (exclusionIndex[localGroupIndex] > -1);
......
...@@ -53,10 +53,10 @@ __kernel void calcCenterOfMassMomentum(int numAtoms, __global const float4* rest ...@@ -53,10 +53,10 @@ __kernel void calcCenterOfMassMomentum(int numAtoms, __global const float4* rest
* Remove center of mass motion. * Remove center of mass motion.
*/ */
__kernel void removeCenterOfMassMomentum(int numAtoms, __global float4* restrict velm, __global const float4* restrict cmMomentum, __local volatile float4* restrict temp) { __kernel void removeCenterOfMassMomentum(unsigned int numAtoms, __global float4* restrict velm, __global const float4* restrict cmMomentum, __local volatile float4* restrict temp) {
// First sum all of the momenta that were calculated by individual groups. // First sum all of the momenta that were calculated by individual groups.
int index = get_local_id(0); unsigned int index = get_local_id(0);
float4 cm = 0.0f; float4 cm = 0.0f;
while (index < get_num_groups(0)) { while (index < get_num_groups(0)) {
cm += cmMomentum[index]; cm += cmMomentum[index];
......
...@@ -61,7 +61,7 @@ __kernel void selectVerletStepSize(int numAtoms, float maxStepSize, float errorT ...@@ -61,7 +61,7 @@ __kernel void selectVerletStepSize(int numAtoms, float maxStepSize, float errorT
// Calculate the error. // Calculate the error.
float err = 0.0f; float err = 0.0f;
unsigned int index = get_local_id(0); int index = get_local_id(0);
while (index < numAtoms) { while (index < numAtoms) {
float4 f = force[index]; float4 f = force[index];
float invMass = velm[index].w; float invMass = velm[index].w;
...@@ -73,7 +73,7 @@ __kernel void selectVerletStepSize(int numAtoms, float maxStepSize, float errorT ...@@ -73,7 +73,7 @@ __kernel void selectVerletStepSize(int numAtoms, float maxStepSize, float errorT
// Sum the errors from all threads. // Sum the errors from all threads.
for (int offset = 1; offset < get_local_size(0); offset *= 2) { for (unsigned int offset = 1; offset < get_local_size(0); offset *= 2) {
if (get_local_id(0)+offset < get_local_size(0) && (get_local_id(0)&(2*offset-1)) == 0) if (get_local_id(0)+offset < get_local_size(0) && (get_local_id(0)&(2*offset-1)) == 0)
error[get_local_id(0)] += error[get_local_id(0)+offset]; error[get_local_id(0)] += error[get_local_id(0)+offset];
barrier(CLK_LOCAL_MEM_FENCE); barrier(CLK_LOCAL_MEM_FENCE);
......
...@@ -123,15 +123,14 @@ void testParallelComputation() { ...@@ -123,15 +123,14 @@ void testParallelComputation() {
for (int i = 0; i < numParticles; i++) for (int i = 0; i < numParticles; i++)
positions[i] = Vec3(i, i%2, 0); positions[i] = Vec3(i, i%2, 0);
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
...@@ -130,15 +130,14 @@ void testParallelComputation() { ...@@ -130,15 +130,14 @@ void testParallelComputation() {
for (int i = 0; i < numParticles; i++) for (int i = 0; i < numParticles; i++)
positions[i] = Vec3(i, 0, 0); positions[i] = Vec3(i, 0, 0);
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
...@@ -130,15 +130,14 @@ void testParallelComputation() { ...@@ -130,15 +130,14 @@ void testParallelComputation() {
for (int i = 0; i < numParticles; i++) for (int i = 0; i < numParticles; i++)
positions[i] = Vec3(5*genrand_real2(sfmt), 5*genrand_real2(sfmt), 5*genrand_real2(sfmt)); positions[i] = Vec3(5*genrand_real2(sfmt), 5*genrand_real2(sfmt), 5*genrand_real2(sfmt));
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
...@@ -380,15 +380,14 @@ void testParallelComputation() { ...@@ -380,15 +380,14 @@ void testParallelComputation() {
force->addExclusion(i, j); force->addExclusion(i, j);
} }
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
...@@ -162,15 +162,14 @@ void testParallelComputation() { ...@@ -162,15 +162,14 @@ void testParallelComputation() {
for (int i = 0; i < numParticles; i++) for (int i = 0; i < numParticles; i++)
positions[i] = Vec3(i, i%2, i%3); positions[i] = Vec3(i, i%2, i%3);
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
...@@ -92,15 +92,14 @@ void testParallelComputation() { ...@@ -92,15 +92,14 @@ void testParallelComputation() {
for (int i = 0; i < numParticles; i++) for (int i = 0; i < numParticles; i++)
positions[i] = Vec3(i, i%2, 0); positions[i] = Vec3(i, i%2, 0);
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
...@@ -87,15 +87,14 @@ void testParallelComputation() { ...@@ -87,15 +87,14 @@ void testParallelComputation() {
for (int i = 0; i < numParticles; i++) for (int i = 0; i < numParticles; i++)
positions[i] = Vec3(i, 0, 0); positions[i] = Vec3(i, 0, 0);
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
...@@ -698,15 +698,14 @@ void testParallelComputation() { ...@@ -698,15 +698,14 @@ void testParallelComputation() {
force->addException(i, j, 0, 1, 0); force->addException(i, j, 0, 1, 0);
} }
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
...@@ -89,15 +89,14 @@ void testParallelComputation() { ...@@ -89,15 +89,14 @@ void testParallelComputation() {
for (int i = 0; i < numParticles; i++) for (int i = 0; i < numParticles; i++)
positions[i] = Vec3(i, i%2, i%3); positions[i] = Vec3(i, i%2, i%3);
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
...@@ -99,15 +99,14 @@ void testParallelComputation() { ...@@ -99,15 +99,14 @@ void testParallelComputation() {
for (int i = 0; i < numParticles; i++) for (int i = 0; i < numParticles; i++)
positions[i] = Vec3(i, i%2, i%3); positions[i] = Vec3(i, i%2, i%3);
VerletIntegrator integrator1(0.01); VerletIntegrator integrator1(0.01);
map<string, string> props1; Context context1(system, integrator1, platform);
props1[OpenCLPlatform::OpenCLDeviceIndex()] = "0";
Context context1(system, integrator1, platform, props1);
context1.setPositions(positions); context1.setPositions(positions);
State state1 = context1.getState(State::Forces | State::Energy); State state1 = context1.getState(State::Forces | State::Energy);
VerletIntegrator integrator2(0.01); VerletIntegrator integrator2(0.01);
map<string, string> props2; string deviceIndex = platform.getPropertyValue(context1, OpenCLPlatform::OpenCLDeviceIndex());
props2[OpenCLPlatform::OpenCLDeviceIndex()] = "0,0"; map<string, string> props;
Context context2(system, integrator2, platform, props2); props[OpenCLPlatform::OpenCLDeviceIndex()] = deviceIndex+","+deviceIndex;
Context context2(system, integrator2, platform, props);
context2.setPositions(positions); context2.setPositions(positions);
State state2 = context2.getState(State::Forces | State::Energy); State state2 = context2.getState(State::Forces | State::Energy);
ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5); ASSERT_EQUAL_TOL(state1.getPotentialEnergy(), state2.getPotentialEnergy(), 1e-5);
......
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