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
e68027ab
Commit
e68027ab
authored
Dec 18, 2014
by
peastman
Browse files
Optimization to CPU PME
parent
bf8de1fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
plugins/cpupme/src/CpuPmeKernels.cpp
plugins/cpupme/src/CpuPmeKernels.cpp
+11
-5
plugins/cpupme/src/CpuPmeKernels.h
plugins/cpupme/src/CpuPmeKernels.h
+2
-2
No files found.
plugins/cpupme/src/CpuPmeKernels.cpp
View file @
e68027ab
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2013 Stanford University and the Authors.
*
* Portions copyright (c) 2013
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -350,9 +350,9 @@ void CpuCalcPmeReciprocalForceKernel::initialize(int xsize, int ysize, int zsize
...
@@ -350,9 +350,9 @@ void CpuCalcPmeReciprocalForceKernel::initialize(int xsize, int ysize, int zsize
fftwf_init_threads
();
fftwf_init_threads
();
hasInitializedThreads
=
true
;
hasInitializedThreads
=
true
;
}
}
gridx
=
findFFTDimension
(
xsize
);
gridx
=
findFFTDimension
(
xsize
,
false
);
gridy
=
findFFTDimension
(
ysize
);
gridy
=
findFFTDimension
(
ysize
,
false
);
gridz
=
findFFTDimension
(
zsize
);
gridz
=
findFFTDimension
(
zsize
,
true
);
this
->
numParticles
=
numParticles
;
this
->
numParticles
=
numParticles
;
this
->
alpha
=
alpha
;
this
->
alpha
=
alpha
;
force
.
resize
(
4
*
numParticles
);
force
.
resize
(
4
*
numParticles
);
...
@@ -572,12 +572,18 @@ bool CpuCalcPmeReciprocalForceKernel::isProcessorSupported() {
...
@@ -572,12 +572,18 @@ bool CpuCalcPmeReciprocalForceKernel::isProcessorSupported() {
return
isVec4Supported
();
return
isVec4Supported
();
}
}
int
CpuCalcPmeReciprocalForceKernel
::
findFFTDimension
(
int
minimum
)
{
int
CpuCalcPmeReciprocalForceKernel
::
findFFTDimension
(
int
minimum
,
bool
isZ
)
{
if
(
minimum
<
1
)
if
(
minimum
<
1
)
return
1
;
return
1
;
while
(
true
)
{
while
(
true
)
{
// Attempt to factor the current value.
// Attempt to factor the current value.
if
(
isZ
&&
minimum
%
2
==
1
)
{
// Force the last dimension to be even, since this produces better performance in FFTW.
minimum
++
;
continue
;
}
int
unfactored
=
minimum
;
int
unfactored
=
minimum
;
for
(
int
factor
=
2
;
factor
<
8
;
factor
++
)
{
for
(
int
factor
=
2
;
factor
<
8
;
factor
++
)
{
while
(
unfactored
>
1
&&
unfactored
%
factor
==
0
)
while
(
unfactored
>
1
&&
unfactored
%
factor
==
0
)
...
...
plugins/cpupme/src/CpuPmeKernels.h
View file @
e68027ab
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2013 Stanford University and the Authors.
*
* Portions copyright (c) 2013
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -98,7 +98,7 @@ private:
...
@@ -98,7 +98,7 @@ private:
/**
/**
* Select a size for one grid dimension that FFTW can handle efficiently.
* Select a size for one grid dimension that FFTW can handle efficiently.
*/
*/
int
findFFTDimension
(
int
minimum
);
int
findFFTDimension
(
int
minimum
,
bool
isZ
);
static
bool
hasInitializedThreads
;
static
bool
hasInitializedThreads
;
static
int
numThreads
;
static
int
numThreads
;
int
gridx
,
gridy
,
gridz
,
numParticles
;
int
gridx
,
gridy
,
gridz
,
numParticles
;
...
...
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