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
403e4744
Commit
403e4744
authored
Nov 29, 2016
by
Peter Eastman
Browse files
Fixes to CustomIntegrator
parent
9f717609
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
7 deletions
+9
-7
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+3
-2
platforms/cuda/src/kernels/customIntegratorPerDof.cu
platforms/cuda/src/kernels/customIntegratorPerDof.cu
+1
-1
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+4
-3
platforms/opencl/src/kernels/customIntegratorPerDof.cl
platforms/opencl/src/kernels/customIntegratorPerDof.cl
+1
-1
No files found.
platforms/cuda/src/CudaKernels.cpp
View file @
403e4744
...
...
@@ -7109,6 +7109,7 @@ void CudaIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context,
needsForces
[
step
-
1
]
=
(
needsForces
[
step
]
||
needsForces
[
step
-
1
]);
needsEnergy
[
step
-
1
]
=
(
needsEnergy
[
step
]
||
needsEnergy
[
step
-
1
]);
needsGlobals
[
step
-
1
]
=
(
needsGlobals
[
step
]
||
needsGlobals
[
step
-
1
]);
computeBothForceAndEnergy
[
step
-
1
]
=
(
computeBothForceAndEnergy
[
step
]
||
computeBothForceAndEnergy
[
step
-
1
]);
}
// Loop over all steps and create the kernels for them.
...
...
@@ -7187,7 +7188,7 @@ void CudaIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context,
args1
.
push_back
(
NULL
);
args1
.
push_back
(
NULL
);
args1
.
push_back
(
NULL
);
if
(
cu
.
getUseDoublePrecision
())
if
(
cu
.
getUseDoublePrecision
()
||
cu
.
getUseMixedPrecision
()
)
args1
.
push_back
(
&
energy
);
else
args1
.
push_back
(
&
energyFloat
);
...
...
@@ -7282,7 +7283,7 @@ void CudaIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context,
kineticEnergyArgs
.
push_back
(
NULL
);
kineticEnergyArgs
.
push_back
(
NULL
);
kineticEnergyArgs
.
push_back
(
&
uniformRandoms
->
getDevicePointer
());
if
(
cu
.
getUseDoublePrecision
())
if
(
cu
.
getUseDoublePrecision
()
||
cu
.
getUseMixedPrecision
()
)
kineticEnergyArgs
.
push_back
(
&
energy
);
else
kineticEnergyArgs
.
push_back
(
&
energyFloat
);
...
...
platforms/cuda/src/kernels/customIntegratorPerDof.cu
View file @
403e4744
...
...
@@ -34,7 +34,7 @@ inline __device__ mixed4 convertFromDouble4(double4 a) {
extern
"C"
__global__
void
computePerDof
(
real4
*
__restrict__
posq
,
real4
*
__restrict__
posqCorrection
,
mixed4
*
__restrict__
posDelta
,
mixed4
*
__restrict__
velm
,
const
long
long
*
__restrict__
force
,
const
mixed2
*
__restrict__
dt
,
const
mixed
*
__restrict__
globals
,
mixed
*
__restrict__
sum
,
const
float4
*
__restrict__
gaussianValues
,
unsigned
int
gaussianBaseIndex
,
const
float4
*
__restrict__
uniformValues
,
const
real
energy
,
mixed
*
__restrict__
energyParamDerivs
const
mixed
energy
,
mixed
*
__restrict__
energyParamDerivs
PARAMETER_ARGUMENTS
)
{
mixed
stepSize
=
dt
[
0
].
y
;
int
index
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
...
...
platforms/opencl/src/OpenCLKernels.cpp
View file @
403e4744
...
...
@@ -7398,6 +7398,7 @@ void OpenCLIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context
needsForces
[
step
-
1
]
=
(
needsForces
[
step
]
||
needsForces
[
step
-
1
]);
needsEnergy
[
step
-
1
]
=
(
needsEnergy
[
step
]
||
needsEnergy
[
step
-
1
]);
needsGlobals
[
step
-
1
]
=
(
needsGlobals
[
step
]
||
needsGlobals
[
step
-
1
]);
computeBothForceAndEnergy
[
step
-
1
]
=
(
computeBothForceAndEnergy
[
step
]
||
computeBothForceAndEnergy
[
step
-
1
]);
}
// Loop over all steps and create the kernels for them.
...
...
@@ -7568,7 +7569,7 @@ void OpenCLIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context
kineticEnergyKernel
.
setArg
<
cl
::
Buffer
>
(
index
++
,
sumBuffer
->
getDeviceBuffer
());
index
+=
2
;
kineticEnergyKernel
.
setArg
<
cl
::
Buffer
>
(
index
++
,
uniformRandoms
->
getDeviceBuffer
());
if
(
cl
.
getUseDoublePrecision
())
if
(
cl
.
getUseDoublePrecision
()
||
cl
.
getUseMixedPrecision
()
)
kineticEnergyKernel
.
setArg
<
cl_double
>
(
index
++
,
0.0
);
else
kineticEnergyKernel
.
setArg
<
cl_float
>
(
index
++
,
0.0
f
);
...
...
@@ -7717,7 +7718,7 @@ void OpenCLIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegr
kernels
[
step
][
0
].
setArg
<
cl_uint
>
(
9
,
integration
.
prepareRandomNumbers
(
requiredGaussian
[
step
]));
kernels
[
step
][
0
].
setArg
<
cl
::
Buffer
>
(
8
,
integration
.
getRandom
().
getDeviceBuffer
());
kernels
[
step
][
0
].
setArg
<
cl
::
Buffer
>
(
10
,
uniformRandoms
->
getDeviceBuffer
());
if
(
cl
.
getUseDoublePrecision
())
if
(
cl
.
getUseDoublePrecision
()
||
cl
.
getUseMixedPrecision
()
)
kernels
[
step
][
0
].
setArg
<
cl_double
>
(
11
,
energy
);
else
kernels
[
step
][
0
].
setArg
<
cl_float
>
(
11
,
(
cl_float
)
energy
);
...
...
@@ -7735,7 +7736,7 @@ void OpenCLIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegr
kernels
[
step
][
0
].
setArg
<
cl_uint
>
(
9
,
integration
.
prepareRandomNumbers
(
requiredGaussian
[
step
]));
kernels
[
step
][
0
].
setArg
<
cl
::
Buffer
>
(
8
,
integration
.
getRandom
().
getDeviceBuffer
());
kernels
[
step
][
0
].
setArg
<
cl
::
Buffer
>
(
10
,
uniformRandoms
->
getDeviceBuffer
());
if
(
cl
.
getUseDoublePrecision
())
if
(
cl
.
getUseDoublePrecision
()
||
cl
.
getUseMixedPrecision
()
)
kernels
[
step
][
0
].
setArg
<
cl_double
>
(
11
,
energy
);
else
kernels
[
step
][
0
].
setArg
<
cl_float
>
(
11
,
(
cl_float
)
energy
);
...
...
platforms/opencl/src/kernels/customIntegratorPerDof.cl
View file @
403e4744
...
...
@@ -26,7 +26,7 @@ void storePos(__global real4* restrict posq, __global real4* restrict posqCorrec
__kernel
void
computePerDof
(
__global
real4*
restrict
posq,
__global
real4*
restrict
posqCorrection,
__global
mixed4*
restrict
posDelta,
__global
mixed4*
restrict
velm,
__global
const
real4*
restrict
force,
__global
const
mixed2*
restrict
dt,
__global
const
mixed*
restrict
globals,
__global
mixed*
restrict
sum,
__global
const
float4*
restrict
gaussianValues,
unsigned
int
gaussianBaseIndex,
__global
const
float4*
restrict
uniformValues,
const
real
energy,
__global
mixed*
restrict
energyParamDerivs
const
mixed
energy,
__global
mixed*
restrict
energyParamDerivs
PARAMETER_ARGUMENTS
)
{
mixed
stepSize
=
dt[0].y
;
int
index
=
get_global_id
(
0
)
;
...
...
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