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
0d5e0b55
"wrappers/vscode:/vscode.git/clone" did not exist on "91e353a85c8478bf9ad01e7521562638b64f658f"
Commit
0d5e0b55
authored
Aug 15, 2014
by
peastman
Browse files
Eliminated some unnecessary memory allocation in CpuCustomManyParticleForce
parent
14d3c584
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
platforms/cpu/include/CpuCustomManyParticleForce.h
platforms/cpu/include/CpuCustomManyParticleForce.h
+2
-0
platforms/cpu/src/CpuCustomManyParticleForce.cpp
platforms/cpu/src/CpuCustomManyParticleForce.cpp
+6
-3
No files found.
platforms/cpu/include/CpuCustomManyParticleForce.h
View file @
0d5e0b55
...
...
@@ -199,6 +199,7 @@ public:
CompiledExpressionSet
expressionSet
;
Lepton
::
CompiledExpression
energyExpression
;
std
::
vector
<
std
::
vector
<
int
>
>
particleParamIndices
;
std
::
vector
<
int
>
permutedParticles
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>
deltaPairs
;
std
::
vector
<
ParticleTermInfo
>
particleTerms
;
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
...
...
@@ -207,6 +208,7 @@ public:
AlignedArray
<
fvec4
>
delta
;
std
::
vector
<
float
>
normDelta
;
std
::
vector
<
float
>
norm2Delta
;
AlignedArray
<
fvec4
>
f
;
double
energy
;
ThreadData
(
const
CustomManyParticleForce
&
force
,
Lepton
::
ParsedExpression
&
energyExpr
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>
>&
distances
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>
>&
angles
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>
>&
dihedrals
);
...
...
platforms/cpu/src/CpuCustomManyParticleForce.cpp
View file @
0d5e0b55
...
...
@@ -147,6 +147,7 @@ void CpuCustomManyParticleForce::threadComputeForce(ThreadPool& threads, int thr
if
(
useCutoff
)
{
// Loop over interactions from the neighbor list.
vector
<
int
>
particles
;
while
(
true
)
{
int
blockIndex
=
gmx_atomic_fetch_add
(
reinterpret_cast
<
gmx_atomic_t
*>
(
atomicCounter
),
1
);
if
(
blockIndex
>=
neighborList
->
getNumBlocks
())
...
...
@@ -161,7 +162,7 @@ void CpuCustomManyParticleForce::threadComputeForce(ThreadPool& threads, int thr
// again later, but the neighbor list also includes padding atoms that it marks as exclusions, so
// we need to remove those now.
vector
<
int
>
particles
;
particles
.
resize
(
0
)
;
for
(
int
j
=
0
;
j
<
numNeighbors
;
j
++
)
if
((
exclusions
[
j
]
&
(
1
<<
i
))
==
0
)
particles
.
push_back
(
neighbors
[
j
]);
...
...
@@ -238,7 +239,7 @@ void CpuCustomManyParticleForce::loopOverInteractions(vector<int>& availablePart
void
CpuCustomManyParticleForce
::
calculateOneIxn
(
vector
<
int
>&
particleSet
,
RealOpenMM
**
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
// Select the ordering to use for the particles.
vector
<
int
>
permutedParticles
(
num
Particles
PerSet
)
;
vector
<
int
>
&
permutedParticles
=
data
.
permuted
Particles
;
if
(
particleOrder
.
size
()
==
1
)
{
// There are no filters, so we don't need to worry about ordering.
...
...
@@ -297,7 +298,7 @@ void CpuCustomManyParticleForce::calculateOneIxn(vector<int>& particleSet, RealO
if
(
includeForces
)
{
// Apply forces based on individual particle coordinates.
AlignedArray
<
fvec4
>
f
(
numParticlesPerSet
)
;
AlignedArray
<
fvec4
>
&
f
=
data
.
f
;
for
(
int
i
=
0
;
i
<
numParticlesPerSet
;
i
++
)
f
[
i
]
=
fvec4
(
0.0
f
);
for
(
int
i
=
0
;
i
<
(
int
)
data
.
particleTerms
.
size
();
i
++
)
{
...
...
@@ -444,6 +445,8 @@ CpuCustomManyParticleForce::ThreadData::ThreadData(const CustomManyParticleForce
int
numParticlesPerSet
=
force
.
getNumParticlesPerSet
();
int
numPerParticleParameters
=
force
.
getNumPerParticleParameters
();
particleParamIndices
.
resize
(
numParticlesPerSet
);
permutedParticles
.
resize
(
numParticlesPerSet
);
f
.
resize
(
numParticlesPerSet
);
energyExpression
=
energyExpr
.
createCompiledExpression
();
expressionSet
.
registerExpression
(
energyExpression
);
...
...
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