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
79011828
"vscode:/vscode.git/clone" did not exist on "0d78f22fa250de1fd2768dbd105f6c2668f253ca"
Commit
79011828
authored
Oct 14, 2013
by
peastman
Browse files
Assorted optimizations
parent
f1533707
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
platforms/cpu/include/CpuNonbondedForce.h
platforms/cpu/include/CpuNonbondedForce.h
+3
-2
platforms/cpu/src/CpuNeighborList.cpp
platforms/cpu/src/CpuNeighborList.cpp
+8
-7
platforms/cpu/src/CpuNonbondedForce.cpp
platforms/cpu/src/CpuNonbondedForce.cpp
+3
-3
No files found.
platforms/cpu/include/CpuNonbondedForce.h
View file @
79011828
...
@@ -176,9 +176,10 @@ private:
...
@@ -176,9 +176,10 @@ private:
pthread_cond_t
startCondition
,
endCondition
;
pthread_cond_t
startCondition
,
endCondition
;
pthread_mutex_t
lock
;
pthread_mutex_t
lock
;
// The following variables are used to make information accessible to the individual threads.
// The following variables are used to make information accessible to the individual threads.
int
numberOfAtoms
;
float
*
posq
;
float
*
posq
;
std
::
vector
<
std
::
pair
<
float
,
float
>
>
atomParameters
;
std
::
pair
<
float
,
float
>
const
*
atomParameters
;
std
::
vector
<
std
::
set
<
int
>
>
exclusions
;
std
::
set
<
int
>
const
*
exclusions
;
bool
includeEnergy
;
bool
includeEnergy
;
static
const
float
TWO_OVER_SQRT_PI
;
static
const
float
TWO_OVER_SQRT_PI
;
...
...
platforms/cpu/src/CpuNeighborList.cpp
View file @
79011828
...
@@ -117,13 +117,9 @@ public:
...
@@ -117,13 +117,9 @@ public:
for
(
Voxel
::
const_iterator
itemIter
=
voxel
.
begin
();
itemIter
!=
voxel
.
end
();
++
itemIter
)
{
for
(
Voxel
::
const_iterator
itemIter
=
voxel
.
begin
();
itemIter
!=
voxel
.
end
();
++
itemIter
)
{
const
int
atomJ
=
itemIter
->
second
;
const
int
atomJ
=
itemIter
->
second
;
// Ignore self hits
// Avoid duplicate entries.
if
(
atomI
>=
atomJ
)
if
(
atomJ
>=
atomI
)
continue
;
break
;
// Ignore exclusions.
if
(
exclusions
[
atomI
].
find
(
atomJ
)
!=
exclusions
[
atomI
].
end
())
continue
;
__m128
posJ
=
_mm_loadu_ps
(
itemIter
->
first
);
__m128
posJ
=
_mm_loadu_ps
(
itemIter
->
first
);
__m128
delta
=
_mm_sub_ps
(
posJ
,
posI
);
__m128
delta
=
_mm_sub_ps
(
posJ
,
posI
);
...
@@ -134,6 +130,11 @@ public:
...
@@ -134,6 +130,11 @@ public:
float
dSquared
=
_mm_cvtss_f32
(
_mm_dp_ps
(
delta
,
delta
,
0x71
));
float
dSquared
=
_mm_cvtss_f32
(
_mm_dp_ps
(
delta
,
delta
,
0x71
));
if
(
dSquared
>
maxDistanceSquared
)
if
(
dSquared
>
maxDistanceSquared
)
continue
;
continue
;
// Ignore exclusions.
if
(
exclusions
[
atomI
].
find
(
atomJ
)
!=
exclusions
[
atomI
].
end
())
continue
;
neighbors
.
push_back
(
make_pair
(
atomI
,
atomJ
));
neighbors
.
push_back
(
make_pair
(
atomI
,
atomJ
));
}
}
}
}
...
...
platforms/cpu/src/CpuNonbondedForce.cpp
View file @
79011828
...
@@ -340,9 +340,10 @@ void CpuNonbondedForce::calculateDirectIxn(int numberOfAtoms, float* posq, const
...
@@ -340,9 +340,10 @@ void CpuNonbondedForce::calculateDirectIxn(int numberOfAtoms, float* posq, const
const
vector
<
set
<
int
>
>&
exclusions
,
float
*
forces
,
float
*
totalEnergy
)
{
const
vector
<
set
<
int
>
>&
exclusions
,
float
*
forces
,
float
*
totalEnergy
)
{
// Record the parameters for the threads.
// Record the parameters for the threads.
this
->
numberOfAtoms
=
numberOfAtoms
;
this
->
posq
=
posq
;
this
->
posq
=
posq
;
this
->
atomParameters
=
atomParameters
;
this
->
atomParameters
=
&
atomParameters
[
0
]
;
this
->
exclusions
=
exclusions
;
this
->
exclusions
=
&
exclusions
[
0
]
;
includeEnergy
=
(
totalEnergy
!=
NULL
);
includeEnergy
=
(
totalEnergy
!=
NULL
);
// Signal the threads to start running and wait for them to finish.
// Signal the threads to start running and wait for them to finish.
...
@@ -413,7 +414,6 @@ void CpuNonbondedForce::runThread(int index, vector<float>& threadForce, double&
...
@@ -413,7 +414,6 @@ void CpuNonbondedForce::runThread(int index, vector<float>& threadForce, double&
threadEnergy
=
0
;
threadEnergy
=
0
;
double
*
energyPtr
=
(
includeEnergy
?
&
threadEnergy
:
NULL
);
double
*
energyPtr
=
(
includeEnergy
?
&
threadEnergy
:
NULL
);
int
numberOfAtoms
=
atomParameters
.
size
();
threadForce
.
resize
(
4
*
numberOfAtoms
,
0.0
f
);
threadForce
.
resize
(
4
*
numberOfAtoms
,
0.0
f
);
for
(
int
i
=
0
;
i
<
4
*
numberOfAtoms
;
i
++
)
for
(
int
i
=
0
;
i
<
4
*
numberOfAtoms
;
i
++
)
threadForce
[
i
]
=
0.0
f
;
threadForce
[
i
]
=
0.0
f
;
...
...
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