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