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
823b9a75
Commit
823b9a75
authored
Jul 29, 2016
by
peastman
Browse files
Bug fixes to OpenCL on CPU
parent
68f1f485
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
10 deletions
+23
-10
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+12
-3
platforms/opencl/src/kernels/customGBValueN2_cpu.cl
platforms/opencl/src/kernels/customGBValueN2_cpu.cl
+10
-6
tests/TestCustomGBForce.h
tests/TestCustomGBForce.h
+1
-1
No files found.
platforms/opencl/src/OpenCLKernels.cpp
View file @
823b9a75
...
...
@@ -3239,14 +3239,23 @@ void OpenCLCalcCustomGBForceKernel::initialize(const System& system, const Custo
load2 << "real temp_" << derivName << "_1 = 0;\n";
load2 << "real temp_" << derivName << "_2 = 0;\n";
tempDerivs1 << derivName << " += temp_" << derivName << "_1;\n";
tempDerivs2 << "local_" << derivName << "[tbx+tj] += temp_" << derivName << "_2;\n";
if (deviceIsCpu)
tempDerivs2 << "local_" << derivName << "[j] += temp_" << derivName << "_2;\n";
else
tempDerivs2 << "local_" << derivName << "[tbx+tj] += temp_" << derivName << "_2;\n";
if (useLong) {
storeDeriv1 << "atom_add(&global_" << derivName << "[offset1], (long) (" << derivName << "*0x100000000));\n";
storeDeriv2 << "atom_add(&global_" << derivName << "[offset2], (long) (local_" << derivName << "[get_local_id(0)]*0x100000000));\n";
if (deviceIsCpu)
storeDeriv2 << "atom_add(&global_" << derivName << "[offset2], (long) (local_" << derivName << "[tgx]*0x100000000));\n";
else
storeDeriv2 << "atom_add(&global_" << derivName << "[offset2], (long) (local_" << derivName << "[get_local_id(0)]*0x100000000));\n";
}
else {
storeDeriv1 << "global_" << derivName << "[offset1] += " << derivName << ";\n";
storeDeriv2 << "global_" << derivName << "[offset2] += local_" << derivName << "[get_local_id(0)];\n";
if (deviceIsCpu)
storeDeriv2 << "global_" << derivName << "[offset2] += local_" << derivName << "[tgx];\n";
else
storeDeriv2 << "global_" << derivName << "[offset2] += local_" << derivName << "[get_local_id(0)];\n";
}
}
}
...
...
platforms/opencl/src/kernels/customGBValueN2_cpu.cl
View file @
823b9a75
...
...
@@ -87,11 +87,13 @@ __kernel void computeN2Value(__global const real4* restrict posq, __local real4*
// Write results.
#ifdef SUPPORTS_64_BIT_ATOMICS
atom_add(&global_value[atom1], (long) (value*0x100000000));
unsigned int offset1 = atom1;
atom_add(&global_value[offset1], (long) (value*0x100000000));
#else
unsigned int offset = atom1 + get_group_id(0)*PADDED_NUM_ATOMS;
global_value[offset] += value;
unsigned int offset
1
= atom1 + get_group_id(0)*PADDED_NUM_ATOMS;
global_value[offset
1
] += value;
#endif
STORE_PARAM_DERIVS1
}
}
else {
...
...
@@ -274,11 +276,13 @@ __kernel void computeN2Value(__global const real4* restrict posq, __local real4*
//
Write
results
for
atom1.
#
ifdef
SUPPORTS_64_BIT_ATOMICS
atom_add
(
&global_value[atom1],
(
long
)
(
value*0x100000000
))
;
unsigned
int
offset1
=
atom1
;
atom_add
(
&global_value[offset1],
(
long
)
(
value*0x100000000
))
;
#
else
unsigned
int
offset
=
atom1
+
get_group_id
(
0
)
*PADDED_NUM_ATOMS
;
global_value[offset]
+=
value
;
unsigned
int
offset
1
=
atom1
+
get_group_id
(
0
)
*PADDED_NUM_ATOMS
;
global_value[offset
1
]
+=
value
;
#
endif
STORE_PARAM_DERIVS1
}
}
else
...
...
tests/TestCustomGBForce.h
View file @
823b9a75
...
...
@@ -491,7 +491,7 @@ void testIllegalVariable() {
void
testEnergyParameterDerivatives
()
{
// Create a box of particles.
const
int
numParticles
=
3
0
;
const
int
numParticles
=
4
0
;
const
int
numParameters
=
4
;
const
double
boxSize
=
2.0
;
const
double
delta
=
1e-3
;
...
...
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