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
2e83bfc8
Commit
2e83bfc8
authored
Jan 06, 2014
by
Peter Eastman
Browse files
Merged changes between repositories by hand
parents
5e2170ff
d91e3f19
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
39 deletions
+92
-39
openmmapi/src/ContextImpl.cpp
openmmapi/src/ContextImpl.cpp
+32
-5
platforms/cuda/src/CudaContext.cpp
platforms/cuda/src/CudaContext.cpp
+18
-12
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+8
-6
platforms/cuda/src/CudaPlatform.cpp
platforms/cuda/src/CudaPlatform.cpp
+16
-7
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+2
-2
platforms/opencl/src/OpenCLPlatform.cpp
platforms/opencl/src/OpenCLPlatform.cpp
+16
-7
No files found.
openmmapi/src/ContextImpl.cpp
View file @
2e83bfc8
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include "openmm/State.h"
#include "openmm/State.h"
#include "openmm/VirtualSite.h"
#include "openmm/VirtualSite.h"
#include "openmm/Context.h"
#include "openmm/Context.h"
#include <algorithm>
#include <iostream>
#include <iostream>
#include <map>
#include <map>
#include <utility>
#include <utility>
...
@@ -106,14 +107,40 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
...
@@ -106,14 +107,40 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
hasInitializedForces
=
true
;
hasInitializedForces
=
true
;
vector
<
string
>
integratorKernels
=
integrator
.
getKernelNames
();
vector
<
string
>
integratorKernels
=
integrator
.
getKernelNames
();
kernelNames
.
insert
(
kernelNames
.
begin
(),
integratorKernels
.
begin
(),
integratorKernels
.
end
());
kernelNames
.
insert
(
kernelNames
.
begin
(),
integratorKernels
.
begin
(),
integratorKernels
.
end
());
if
(
platform
==
0
)
this
->
platform
=
platform
=
&
Platform
::
findPlatform
(
kernelNames
);
// Select a platform to use.
else
if
(
!
platform
->
supportsKernels
(
kernelNames
))
throw
OpenMMException
(
"Specified a Platform for a Context which does not support all required kernels"
);
vector
<
pair
<
double
,
Platform
*>
>
candidatePlatforms
;
if
(
platform
==
NULL
)
{
for
(
int
i
=
0
;
i
<
Platform
::
getNumPlatforms
();
i
++
)
{
Platform
&
p
=
Platform
::
getPlatform
(
i
);
if
(
p
.
supportsKernels
(
kernelNames
))
candidatePlatforms
.
push_back
(
make_pair
(
p
.
getSpeed
(),
&
p
));
}
if
(
candidatePlatforms
.
size
()
==
0
)
throw
OpenMMException
(
"No Platform supports all the requested kernels"
);
sort
(
candidatePlatforms
.
begin
(),
candidatePlatforms
.
end
());
}
else
{
if
(
!
platform
->
supportsKernels
(
kernelNames
))
throw
OpenMMException
(
"Specified a Platform for a Context which does not support all required kernels"
);
candidatePlatforms
.
push_back
(
make_pair
(
platform
->
getSpeed
(),
platform
));
}
for
(
int
i
=
candidatePlatforms
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
try
{
this
->
platform
=
platform
=
candidatePlatforms
[
i
].
second
;
platform
->
contextCreated
(
*
this
,
properties
);
break
;
}
catch
(...)
{
if
(
i
>
0
)
continue
;
throw
;
}
}
// Create and initialize kernels and other objects.
// Create and initialize kernels and other objects.
platform
->
contextCreated
(
*
this
,
properties
);
initializeForcesKernel
=
platform
->
createKernel
(
CalcForcesAndEnergyKernel
::
Name
(),
*
this
);
initializeForcesKernel
=
platform
->
createKernel
(
CalcForcesAndEnergyKernel
::
Name
(),
*
this
);
initializeForcesKernel
.
getAs
<
CalcForcesAndEnergyKernel
>
().
initialize
(
system
);
initializeForcesKernel
.
getAs
<
CalcForcesAndEnergyKernel
>
().
initialize
(
system
);
updateStateDataKernel
=
platform
->
createKernel
(
UpdateStateDataKernel
::
Name
(),
*
this
);
updateStateDataKernel
=
platform
->
createKernel
(
UpdateStateDataKernel
::
Name
(),
*
this
);
...
...
platforms/cuda/src/CudaContext.cpp
View file @
2e83bfc8
...
@@ -156,9 +156,6 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
...
@@ -156,9 +156,6 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
CHECK_RESULT
(
cuDeviceGetAttribute
(
&
multiprocessors
,
CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT
,
device
));
CHECK_RESULT
(
cuDeviceGetAttribute
(
&
multiprocessors
,
CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT
,
device
));
int
numThreadBlocksPerComputeUnit
=
6
;
int
numThreadBlocksPerComputeUnit
=
6
;
numThreadBlocks
=
numThreadBlocksPerComputeUnit
*
multiprocessors
;
numThreadBlocks
=
numThreadBlocksPerComputeUnit
*
multiprocessors
;
bonded
=
new
CudaBondedUtilities
(
*
this
);
nonbonded
=
new
CudaNonbondedUtilities
(
*
this
);
int
numEnergyBuffers
=
max
(
numThreadBlocks
*
ThreadBlockSize
,
nonbonded
->
getNumEnergyBuffers
());
if
(
useDoublePrecision
)
{
if
(
useDoublePrecision
)
{
posq
=
CudaArray
::
create
<
double4
>
(
*
this
,
paddedNumAtoms
,
"posq"
);
posq
=
CudaArray
::
create
<
double4
>
(
*
this
,
paddedNumAtoms
,
"posq"
);
velm
=
CudaArray
::
create
<
double4
>
(
*
this
,
paddedNumAtoms
,
"velm"
);
velm
=
CudaArray
::
create
<
double4
>
(
*
this
,
paddedNumAtoms
,
"velm"
);
...
@@ -169,9 +166,6 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
...
@@ -169,9 +166,6 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
compilationDefines
[
"make_mixed2"
]
=
"make_double2"
;
compilationDefines
[
"make_mixed2"
]
=
"make_double2"
;
compilationDefines
[
"make_mixed3"
]
=
"make_double3"
;
compilationDefines
[
"make_mixed3"
]
=
"make_double3"
;
compilationDefines
[
"make_mixed4"
]
=
"make_double4"
;
compilationDefines
[
"make_mixed4"
]
=
"make_double4"
;
energyBuffer
=
CudaArray
::
create
<
double
>
(
*
this
,
numEnergyBuffers
,
"energyBuffer"
);
int
pinnedBufferSize
=
max
(
paddedNumAtoms
*
4
,
numEnergyBuffers
);
CHECK_RESULT
(
cuMemHostAlloc
(
&
pinnedBuffer
,
pinnedBufferSize
*
sizeof
(
double
),
0
));
}
}
else
if
(
useMixedPrecision
)
{
else
if
(
useMixedPrecision
)
{
posq
=
CudaArray
::
create
<
float4
>
(
*
this
,
paddedNumAtoms
,
"posq"
);
posq
=
CudaArray
::
create
<
float4
>
(
*
this
,
paddedNumAtoms
,
"posq"
);
...
@@ -184,9 +178,6 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
...
@@ -184,9 +178,6 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
compilationDefines
[
"make_mixed2"
]
=
"make_double2"
;
compilationDefines
[
"make_mixed2"
]
=
"make_double2"
;
compilationDefines
[
"make_mixed3"
]
=
"make_double3"
;
compilationDefines
[
"make_mixed3"
]
=
"make_double3"
;
compilationDefines
[
"make_mixed4"
]
=
"make_double4"
;
compilationDefines
[
"make_mixed4"
]
=
"make_double4"
;
energyBuffer
=
CudaArray
::
create
<
float
>
(
*
this
,
numEnergyBuffers
,
"energyBuffer"
);
int
pinnedBufferSize
=
max
(
paddedNumAtoms
*
4
,
numEnergyBuffers
);
CHECK_RESULT
(
cuMemHostAlloc
(
&
pinnedBuffer
,
pinnedBufferSize
*
sizeof
(
double
),
0
));
}
}
else
{
else
{
posq
=
CudaArray
::
create
<
float4
>
(
*
this
,
paddedNumAtoms
,
"posq"
);
posq
=
CudaArray
::
create
<
float4
>
(
*
this
,
paddedNumAtoms
,
"posq"
);
...
@@ -197,9 +188,6 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
...
@@ -197,9 +188,6 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
compilationDefines
[
"make_mixed2"
]
=
"make_float2"
;
compilationDefines
[
"make_mixed2"
]
=
"make_float2"
;
compilationDefines
[
"make_mixed3"
]
=
"make_float3"
;
compilationDefines
[
"make_mixed3"
]
=
"make_float3"
;
compilationDefines
[
"make_mixed4"
]
=
"make_float4"
;
compilationDefines
[
"make_mixed4"
]
=
"make_float4"
;
energyBuffer
=
CudaArray
::
create
<
float
>
(
*
this
,
numEnergyBuffers
,
"energyBuffer"
);
int
pinnedBufferSize
=
max
(
paddedNumAtoms
*
6
,
numEnergyBuffers
);
CHECK_RESULT
(
cuMemHostAlloc
(
&
pinnedBuffer
,
pinnedBufferSize
*
sizeof
(
float
),
0
));
}
}
posCellOffsets
.
resize
(
paddedNumAtoms
,
make_int4
(
0
,
0
,
0
,
0
));
posCellOffsets
.
resize
(
paddedNumAtoms
,
make_int4
(
0
,
0
,
0
,
0
));
...
@@ -236,6 +224,8 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
...
@@ -236,6 +224,8 @@ CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlocking
// Create utilities objects.
// Create utilities objects.
bonded
=
new
CudaBondedUtilities
(
*
this
);
nonbonded
=
new
CudaNonbondedUtilities
(
*
this
);
integration
=
new
CudaIntegrationUtilities
(
*
this
,
system
);
integration
=
new
CudaIntegrationUtilities
(
*
this
,
system
);
expression
=
new
CudaExpressionUtilities
(
*
this
);
expression
=
new
CudaExpressionUtilities
(
*
this
);
}
}
...
@@ -283,6 +273,22 @@ CudaContext::~CudaContext() {
...
@@ -283,6 +273,22 @@ CudaContext::~CudaContext() {
void
CudaContext
::
initialize
()
{
void
CudaContext
::
initialize
()
{
cuCtxSetCurrent
(
context
);
cuCtxSetCurrent
(
context
);
string
errorMessage
=
"Error initializing Context"
;
string
errorMessage
=
"Error initializing Context"
;
int
numEnergyBuffers
=
max
(
numThreadBlocks
*
ThreadBlockSize
,
nonbonded
->
getNumEnergyBuffers
());
if
(
useDoublePrecision
)
{
energyBuffer
=
CudaArray
::
create
<
double
>
(
*
this
,
numEnergyBuffers
,
"energyBuffer"
);
int
pinnedBufferSize
=
max
(
paddedNumAtoms
*
4
,
numEnergyBuffers
);
CHECK_RESULT
(
cuMemHostAlloc
(
&
pinnedBuffer
,
pinnedBufferSize
*
sizeof
(
double
),
0
));
}
else
if
(
useMixedPrecision
)
{
energyBuffer
=
CudaArray
::
create
<
float
>
(
*
this
,
numEnergyBuffers
,
"energyBuffer"
);
int
pinnedBufferSize
=
max
(
paddedNumAtoms
*
4
,
numEnergyBuffers
);
CHECK_RESULT
(
cuMemHostAlloc
(
&
pinnedBuffer
,
pinnedBufferSize
*
sizeof
(
double
),
0
));
}
else
{
energyBuffer
=
CudaArray
::
create
<
float
>
(
*
this
,
numEnergyBuffers
,
"energyBuffer"
);
int
pinnedBufferSize
=
max
(
paddedNumAtoms
*
6
,
numEnergyBuffers
);
CHECK_RESULT
(
cuMemHostAlloc
(
&
pinnedBuffer
,
pinnedBufferSize
*
sizeof
(
float
),
0
));
}
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
{
double
mass
=
system
.
getParticleMass
(
i
);
double
mass
=
system
.
getParticleMass
(
i
);
if
(
useDoublePrecision
||
useMixedPrecision
)
if
(
useDoublePrecision
||
useMixedPrecision
)
...
...
platforms/cuda/src/CudaKernels.cpp
View file @
2e83bfc8
...
@@ -1460,8 +1460,9 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
...
@@ -1460,8 +1460,9 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
int
numParticles
=
force
.
getNumParticles
();
int
numParticles
=
force
.
getNumParticles
();
sigmaEpsilon
=
CudaArray
::
create
<
float2
>
(
cu
,
cu
.
getPaddedNumAtoms
(),
"sigmaEpsilon"
);
sigmaEpsilon
=
CudaArray
::
create
<
float2
>
(
cu
,
cu
.
getPaddedNumAtoms
(),
"sigmaEpsilon"
);
CudaArray
&
posq
=
cu
.
getPosq
();
CudaArray
&
posq
=
cu
.
getPosq
();
float4
*
posqf
=
(
float4
*
)
cu
.
getPinnedBuffer
();
vector
<
double4
>
temp
(
posq
.
getSize
());
double4
*
posqd
=
(
double4
*
)
cu
.
getPinnedBuffer
();
float4
*
posqf
=
(
float4
*
)
&
temp
[
0
];
double4
*
posqd
=
(
double4
*
)
&
temp
[
0
];
vector
<
float2
>
sigmaEpsilonVector
(
cu
.
getPaddedNumAtoms
(),
make_float2
(
0
,
0
));
vector
<
float2
>
sigmaEpsilonVector
(
cu
.
getPaddedNumAtoms
(),
make_float2
(
0
,
0
));
vector
<
vector
<
int
>
>
exclusionList
(
numParticles
);
vector
<
vector
<
int
>
>
exclusionList
(
numParticles
);
double
sumSquaredCharges
=
0.0
;
double
sumSquaredCharges
=
0.0
;
...
@@ -1486,7 +1487,7 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
...
@@ -1486,7 +1487,7 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
exclusionList
[
exclusions
[
i
].
first
].
push_back
(
exclusions
[
i
].
second
);
exclusionList
[
exclusions
[
i
].
first
].
push_back
(
exclusions
[
i
].
second
);
exclusionList
[
exclusions
[
i
].
second
].
push_back
(
exclusions
[
i
].
first
);
exclusionList
[
exclusions
[
i
].
second
].
push_back
(
exclusions
[
i
].
first
);
}
}
posq
.
upload
(
cu
.
getPinnedBuffer
()
);
posq
.
upload
(
&
temp
[
0
]
);
sigmaEpsilon
->
upload
(
sigmaEpsilonVector
);
sigmaEpsilon
->
upload
(
sigmaEpsilonVector
);
bool
useCutoff
=
(
force
.
getNonbondedMethod
()
!=
NonbondedForce
::
NoCutoff
);
bool
useCutoff
=
(
force
.
getNonbondedMethod
()
!=
NonbondedForce
::
NoCutoff
);
bool
usePeriodic
=
(
force
.
getNonbondedMethod
()
!=
NonbondedForce
::
NoCutoff
&&
force
.
getNonbondedMethod
()
!=
NonbondedForce
::
CutoffNonPeriodic
);
bool
usePeriodic
=
(
force
.
getNonbondedMethod
()
!=
NonbondedForce
::
NoCutoff
&&
force
.
getNonbondedMethod
()
!=
NonbondedForce
::
CutoffNonPeriodic
);
...
@@ -2410,8 +2411,9 @@ void CudaCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOBCF
...
@@ -2410,8 +2411,9 @@ void CudaCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOBCF
cu
.
addAutoclearBuffer
(
*
bornSum
);
cu
.
addAutoclearBuffer
(
*
bornSum
);
cu
.
addAutoclearBuffer
(
*
bornForce
);
cu
.
addAutoclearBuffer
(
*
bornForce
);
CudaArray
&
posq
=
cu
.
getPosq
();
CudaArray
&
posq
=
cu
.
getPosq
();
float4
*
posqf
=
(
float4
*
)
cu
.
getPinnedBuffer
();
vector
<
double4
>
temp
(
posq
.
getSize
());
double4
*
posqd
=
(
double4
*
)
cu
.
getPinnedBuffer
();
float4
*
posqf
=
(
float4
*
)
&
temp
[
0
];
double4
*
posqd
=
(
double4
*
)
&
temp
[
0
];
vector
<
float2
>
paramsVector
(
cu
.
getPaddedNumAtoms
(),
make_float2
(
1
,
1
));
vector
<
float2
>
paramsVector
(
cu
.
getPaddedNumAtoms
(),
make_float2
(
1
,
1
));
const
double
dielectricOffset
=
0.009
;
const
double
dielectricOffset
=
0.009
;
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
...
@@ -2424,7 +2426,7 @@ void CudaCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOBCF
...
@@ -2424,7 +2426,7 @@ void CudaCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOBCF
else
else
posqf
[
i
]
=
make_float4
(
0
,
0
,
0
,
(
float
)
charge
);
posqf
[
i
]
=
make_float4
(
0
,
0
,
0
,
(
float
)
charge
);
}
}
posq
.
upload
(
cu
.
getPinnedBuffer
()
);
posq
.
upload
(
&
temp
[
0
]
);
params
->
upload
(
paramsVector
);
params
->
upload
(
paramsVector
);
prefactor
=
-
ONE_4PI_EPS0
*
((
1.0
/
force
.
getSoluteDielectric
())
-
(
1.0
/
force
.
getSolventDielectric
()));
prefactor
=
-
ONE_4PI_EPS0
*
((
1.0
/
force
.
getSoluteDielectric
())
-
(
1.0
/
force
.
getSolventDielectric
()));
bool
useCutoff
=
(
force
.
getNonbondedMethod
()
!=
GBSAOBCForce
::
NoCutoff
);
bool
useCutoff
=
(
force
.
getNonbondedMethod
()
!=
GBSAOBCForce
::
NoCutoff
);
...
...
platforms/cuda/src/CudaPlatform.cpp
View file @
2e83bfc8
...
@@ -179,15 +179,24 @@ CudaPlatform::PlatformData::PlatformData(ContextImpl* context, const System& sys
...
@@ -179,15 +179,24 @@ CudaPlatform::PlatformData::PlatformData(ContextImpl* context, const System& sys
searchPos
=
nextPos
+
1
;
searchPos
=
nextPos
+
1
;
}
}
devices
.
push_back
(
deviceIndexProperty
.
substr
(
searchPos
));
devices
.
push_back
(
deviceIndexProperty
.
substr
(
searchPos
));
for
(
int
i
=
0
;
i
<
(
int
)
devices
.
size
();
i
++
)
{
try
{
if
(
devices
[
i
].
length
()
>
0
)
{
for
(
int
i
=
0
;
i
<
(
int
)
devices
.
size
();
i
++
)
{
unsigned
int
deviceIndex
;
if
(
devices
[
i
].
length
()
>
0
)
{
stringstream
(
devices
[
i
])
>>
deviceIndex
;
unsigned
int
deviceIndex
;
contexts
.
push_back
(
new
CudaContext
(
system
,
deviceIndex
,
blocking
,
precisionProperty
,
compilerProperty
,
tempProperty
,
hostCompilerProperty
,
*
this
));
stringstream
(
devices
[
i
])
>>
deviceIndex
;
contexts
.
push_back
(
new
CudaContext
(
system
,
deviceIndex
,
blocking
,
precisionProperty
,
compilerProperty
,
tempProperty
,
hostCompilerProperty
,
*
this
));
}
}
}
if
(
contexts
.
size
()
==
0
)
contexts
.
push_back
(
new
CudaContext
(
system
,
-
1
,
blocking
,
precisionProperty
,
compilerProperty
,
tempProperty
,
hostCompilerProperty
,
*
this
));
}
catch
(...)
{
// If an exception was thrown, do our best to clean up memory.
for
(
int
i
=
0
;
i
<
(
int
)
contexts
.
size
();
i
++
)
delete
contexts
[
i
];
throw
;
}
}
if
(
contexts
.
size
()
==
0
)
contexts
.
push_back
(
new
CudaContext
(
system
,
-
1
,
blocking
,
precisionProperty
,
compilerProperty
,
tempProperty
,
hostCompilerProperty
,
*
this
));
stringstream
deviceIndex
,
deviceName
;
stringstream
deviceIndex
,
deviceName
;
for
(
int
i
=
0
;
i
<
(
int
)
contexts
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
contexts
.
size
();
i
++
)
{
if
(
i
>
0
)
{
if
(
i
>
0
)
{
...
...
platforms/opencl/src/OpenCLContext.cpp
View file @
2e83bfc8
...
@@ -253,8 +253,6 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
...
@@ -253,8 +253,6 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
paddedNumAtoms
=
TileSize
*
((
numAtoms
+
TileSize
-
1
)
/
TileSize
);
paddedNumAtoms
=
TileSize
*
((
numAtoms
+
TileSize
-
1
)
/
TileSize
);
numAtomBlocks
=
(
paddedNumAtoms
+
(
TileSize
-
1
))
/
TileSize
;
numAtomBlocks
=
(
paddedNumAtoms
+
(
TileSize
-
1
))
/
TileSize
;
numThreadBlocks
=
numThreadBlocksPerComputeUnit
*
device
.
getInfo
<
CL_DEVICE_MAX_COMPUTE_UNITS
>
();
numThreadBlocks
=
numThreadBlocksPerComputeUnit
*
device
.
getInfo
<
CL_DEVICE_MAX_COMPUTE_UNITS
>
();
bonded
=
new
OpenCLBondedUtilities
(
*
this
);
nonbonded
=
new
OpenCLNonbondedUtilities
(
*
this
);
if
(
useDoublePrecision
)
{
if
(
useDoublePrecision
)
{
posq
=
OpenCLArray
::
create
<
mm_double4
>
(
*
this
,
paddedNumAtoms
,
"posq"
);
posq
=
OpenCLArray
::
create
<
mm_double4
>
(
*
this
,
paddedNumAtoms
,
"posq"
);
velm
=
OpenCLArray
::
create
<
mm_double4
>
(
*
this
,
paddedNumAtoms
,
"velm"
);
velm
=
OpenCLArray
::
create
<
mm_double4
>
(
*
this
,
paddedNumAtoms
,
"velm"
);
...
@@ -343,6 +341,8 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
...
@@ -343,6 +341,8 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
// Create utilities objects.
// Create utilities objects.
bonded
=
new
OpenCLBondedUtilities
(
*
this
);
nonbonded
=
new
OpenCLNonbondedUtilities
(
*
this
);
integration
=
new
OpenCLIntegrationUtilities
(
*
this
,
system
);
integration
=
new
OpenCLIntegrationUtilities
(
*
this
,
system
);
expression
=
new
OpenCLExpressionUtilities
(
*
this
);
expression
=
new
OpenCLExpressionUtilities
(
*
this
);
}
}
...
...
platforms/opencl/src/OpenCLPlatform.cpp
View file @
2e83bfc8
...
@@ -143,15 +143,24 @@ OpenCLPlatform::PlatformData::PlatformData(const System& system, const string& p
...
@@ -143,15 +143,24 @@ OpenCLPlatform::PlatformData::PlatformData(const System& system, const string& p
searchPos
=
nextPos
+
1
;
searchPos
=
nextPos
+
1
;
}
}
devices
.
push_back
(
deviceIndexProperty
.
substr
(
searchPos
));
devices
.
push_back
(
deviceIndexProperty
.
substr
(
searchPos
));
for
(
int
i
=
0
;
i
<
(
int
)
devices
.
size
();
i
++
)
{
try
{
if
(
devices
[
i
].
length
()
>
0
)
{
for
(
int
i
=
0
;
i
<
(
int
)
devices
.
size
();
i
++
)
{
unsigned
int
deviceIndex
;
if
(
devices
[
i
].
length
()
>
0
)
{
stringstream
(
devices
[
i
])
>>
deviceIndex
;
unsigned
int
deviceIndex
;
contexts
.
push_back
(
new
OpenCLContext
(
system
,
platformIndex
,
deviceIndex
,
precisionProperty
,
*
this
));
stringstream
(
devices
[
i
])
>>
deviceIndex
;
contexts
.
push_back
(
new
OpenCLContext
(
system
,
platformIndex
,
deviceIndex
,
precisionProperty
,
*
this
));
}
}
}
if
(
contexts
.
size
()
==
0
)
contexts
.
push_back
(
new
OpenCLContext
(
system
,
platformIndex
,
-
1
,
precisionProperty
,
*
this
));
}
catch
(...)
{
// If an exception was thrown, do our best to clean up memory.
for
(
int
i
=
0
;
i
<
(
int
)
contexts
.
size
();
i
++
)
delete
contexts
[
i
];
throw
;
}
}
if
(
contexts
.
size
()
==
0
)
contexts
.
push_back
(
new
OpenCLContext
(
system
,
platformIndex
,
-
1
,
precisionProperty
,
*
this
));
stringstream
deviceIndex
,
deviceName
;
stringstream
deviceIndex
,
deviceName
;
for
(
int
i
=
0
;
i
<
(
int
)
contexts
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
contexts
.
size
();
i
++
)
{
if
(
i
>
0
)
{
if
(
i
>
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