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
0de92fdc
Commit
0de92fdc
authored
Mar 03, 2011
by
Peter Eastman
Browse files
Fixed round-off error that occasionally caused errors in the neighbor list
parent
09f5cb4c
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
34 additions
and
34 deletions
+34
-34
platforms/opencl/src/kernels/customGBEnergyN2_cpu.cl
platforms/opencl/src/kernels/customGBEnergyN2_cpu.cl
+2
-2
platforms/opencl/src/kernels/customGBEnergyN2_default.cl
platforms/opencl/src/kernels/customGBEnergyN2_default.cl
+2
-2
platforms/opencl/src/kernels/customGBEnergyN2_nvidia.cl
platforms/opencl/src/kernels/customGBEnergyN2_nvidia.cl
+2
-2
platforms/opencl/src/kernels/customGBValueN2_cpu.cl
platforms/opencl/src/kernels/customGBValueN2_cpu.cl
+2
-2
platforms/opencl/src/kernels/customGBValueN2_default.cl
platforms/opencl/src/kernels/customGBValueN2_default.cl
+2
-2
platforms/opencl/src/kernels/customGBValueN2_nvidia.cl
platforms/opencl/src/kernels/customGBValueN2_nvidia.cl
+2
-2
platforms/opencl/src/kernels/findInteractingBlocks.cl
platforms/opencl/src/kernels/findInteractingBlocks.cl
+2
-2
platforms/opencl/src/kernels/findInteractingBlocks_cpu.cl
platforms/opencl/src/kernels/findInteractingBlocks_cpu.cl
+2
-2
platforms/opencl/src/kernels/gbsaObc_cpu.cl
platforms/opencl/src/kernels/gbsaObc_cpu.cl
+4
-4
platforms/opencl/src/kernels/gbsaObc_default.cl
platforms/opencl/src/kernels/gbsaObc_default.cl
+4
-4
platforms/opencl/src/kernels/gbsaObc_nvidia.cl
platforms/opencl/src/kernels/gbsaObc_nvidia.cl
+4
-4
platforms/opencl/src/kernels/nonbonded_cpu.cl
platforms/opencl/src/kernels/nonbonded_cpu.cl
+2
-2
platforms/opencl/src/kernels/nonbonded_default.cl
platforms/opencl/src/kernels/nonbonded_default.cl
+2
-2
platforms/opencl/src/kernels/nonbonded_nvidia.cl
platforms/opencl/src/kernels/nonbonded_nvidia.cl
+2
-2
No files found.
platforms/opencl/src/kernels/customGBEnergyN2_cpu.cl
View file @
0de92fdc
...
@@ -40,8 +40,8 @@ __kernel void computeN2Energy(__global float4* forceBuffers, __global float* ene
...
@@ -40,8 +40,8 @@ __kernel void computeN2Energy(__global float4* forceBuffers, __global float* ene
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
platforms/opencl/src/kernels/customGBEnergyN2_default.cl
View file @
0de92fdc
...
@@ -44,8 +44,8 @@ void computeN2Energy(__global float4* forceBuffers, __global float* energyBuffer
...
@@ -44,8 +44,8 @@ void computeN2Energy(__global float4* forceBuffers, __global float* energyBuffer
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
platforms/opencl/src/kernels/customGBEnergyN2_nvidia.cl
View file @
0de92fdc
...
@@ -45,8 +45,8 @@ void computeN2Energy(__global float4* forceBuffers, __global float* energyBuffer
...
@@ -45,8 +45,8 @@ void computeN2Energy(__global float4* forceBuffers, __global float* energyBuffer
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
platforms/opencl/src/kernels/customGBValueN2_cpu.cl
View file @
0de92fdc
...
@@ -37,8 +37,8 @@ __kernel void computeN2Value(__global float4* posq, __local float4* local_posq,
...
@@ -37,8 +37,8 @@ __kernel void computeN2Value(__global float4* posq, __local float4* local_posq,
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
platforms/opencl/src/kernels/customGBValueN2_default.cl
View file @
0de92fdc
...
@@ -41,8 +41,8 @@ void computeN2Value(__global float4* posq, __local float4* local_posq, __global
...
@@ -41,8 +41,8 @@ void computeN2Value(__global float4* posq, __local float4* local_posq, __global
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
platforms/opencl/src/kernels/customGBValueN2_nvidia.cl
View file @
0de92fdc
...
@@ -43,8 +43,8 @@ void computeN2Value(__global float4* posq, __local float4* local_posq, __global
...
@@ -43,8 +43,8 @@ void computeN2Value(__global float4* posq, __local float4* local_posq, __global
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
platforms/opencl/src/kernels/findInteractingBlocks.cl
View file @
0de92fdc
...
@@ -180,8 +180,8 @@ __kernel void findBlocksWithInteractions(float cutoffSquared, float4 periodicBox
...
@@ -180,8 +180,8 @@ __kernel void findBlocksWithInteractions(float cutoffSquared, float4 periodicBox
if (index < numTiles) {
if (index < numTiles) {
unsigned int y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*index));
unsigned int y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*index));
unsigned int x = (index-y*NUM_BLOCKS+y*(y+1)/2);
unsigned int x = (index-y*NUM_BLOCKS+y*(y+1)/2);
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if (x
< y |
|
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
y
++
;
y
+=
(
x
<
y
?
-1
:
1
)
;
x
=
(
index-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
index-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
}
}
...
...
platforms/opencl/src/kernels/findInteractingBlocks_cpu.cl
View file @
0de92fdc
...
@@ -134,8 +134,8 @@ __kernel void findBlocksWithInteractions(float cutoffSquared, float4 periodicBox
...
@@ -134,8 +134,8 @@ __kernel void findBlocksWithInteractions(float cutoffSquared, float4 periodicBox
unsigned int y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*index));
unsigned int y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*index));
unsigned int x = (index-y*NUM_BLOCKS+y*(y+1)/2);
unsigned int x = (index-y*NUM_BLOCKS+y*(y+1)/2);
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if (x
< y |
|
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
y
++
;
y
+=
(
x
<
y
?
-1
:
1
)
;
x
=
(
index-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
index-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
}
}
...
...
platforms/opencl/src/kernels/gbsaObc_cpu.cl
View file @
0de92fdc
...
@@ -44,8 +44,8 @@ __kernel void computeBornSum(__global float* global_bornSum, __global float4* po
...
@@ -44,8 +44,8 @@ __kernel void computeBornSum(__global float* global_bornSum, __global float4* po
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
@@ -222,8 +222,8 @@ __kernel void computeGBSAForce1(__global float4* forceBuffers, __global float* e
...
@@ -222,8 +222,8 @@ __kernel void computeGBSAForce1(__global float4* forceBuffers, __global float* e
{
{
y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if (x
< y |
|
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
y
++
;
y
+=
(
x
<
y
?
-1
:
1
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
}
}
}
}
...
...
platforms/opencl/src/kernels/gbsaObc_default.cl
View file @
0de92fdc
...
@@ -45,8 +45,8 @@ void computeBornSum(__global float* global_bornSum, __global float4* posq, __glo
...
@@ -45,8 +45,8 @@ void computeBornSum(__global float* global_bornSum, __global float4* posq, __glo
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
@@ -232,8 +232,8 @@ void computeGBSAForce1(__global float4* forceBuffers, __global float* energyBuff
...
@@ -232,8 +232,8 @@ void computeGBSAForce1(__global float4* forceBuffers, __global float* energyBuff
{
{
y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if (x
< y |
|
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
y
++
;
y
+=
(
x
<
y
?
-1
:
1
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
}
}
}
}
...
...
platforms/opencl/src/kernels/gbsaObc_nvidia.cl
View file @
0de92fdc
...
@@ -47,8 +47,8 @@ void computeBornSum(__global float* global_bornSum, __global float4* posq, __glo
...
@@ -47,8 +47,8 @@ void computeBornSum(__global float* global_bornSum, __global float4* posq, __glo
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
@@ -300,8 +300,8 @@ void computeGBSAForce1(__global float4* forceBuffers, __global float* energyBuff
...
@@ -300,8 +300,8 @@ void computeGBSAForce1(__global float4* forceBuffers, __global float* energyBuff
{
{
y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if (x
< y || x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
platforms/opencl/src/kernels/nonbonded_cpu.cl
View file @
0de92fdc
...
@@ -44,8 +44,8 @@ __kernel void computeNonbonded(__global float4* forceBuffers, __global float* en
...
@@ -44,8 +44,8 @@ __kernel void computeNonbonded(__global float4* forceBuffers, __global float* en
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
platforms/opencl/src/kernels/nonbonded_default.cl
View file @
0de92fdc
...
@@ -47,8 +47,8 @@ void computeNonbonded(__global float4* forceBuffers, __global float* energyBuffe
...
@@ -47,8 +47,8 @@ void computeNonbonded(__global float4* forceBuffers, __global float* energyBuffe
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
platforms/opencl/src/kernels/nonbonded_nvidia.cl
View file @
0de92fdc
...
@@ -49,8 +49,8 @@ void computeNonbonded(__global float4* forceBuffers, __global float* energyBuffe
...
@@ -49,8 +49,8 @@ void computeNonbonded(__global float4* forceBuffers, __global float* energyBuffe
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS+0.5f-sqrt
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if
(
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
if
(
x
<
y
|
| x
>= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y
++
;
y
+= (x < y ? -1 : 1)
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
}
}
}
...
...
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