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
2cb112f0
Commit
2cb112f0
authored
Mar 25, 2010
by
Peter Eastman
Browse files
Optimization (reduce bank conflicts)
parent
9ecb1797
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
15 deletions
+5
-15
platforms/cuda/src/kernels/kCalculateObcGbsaBornSum.cu
platforms/cuda/src/kernels/kCalculateObcGbsaBornSum.cu
+5
-4
platforms/cuda/src/kernels/kCalculateObcGbsaBornSum.h
platforms/cuda/src/kernels/kCalculateObcGbsaBornSum.h
+0
-11
No files found.
platforms/cuda/src/kernels/kCalculateObcGbsaBornSum.cu
View file @
2cb112f0
...
@@ -45,6 +45,7 @@ struct Atom {
...
@@ -45,6 +45,7 @@ struct Atom {
float
r
;
float
r
;
float
sr
;
float
sr
;
float
sum
;
float
sum
;
float
padding
;
};
};
static
__constant__
cudaGmxSimulation
cSim
;
static
__constant__
cudaGmxSimulation
cSim
;
...
@@ -97,8 +98,8 @@ void GetCalculateObcGbsaBornSumSim(gpuContext gpu)
...
@@ -97,8 +98,8 @@ void GetCalculateObcGbsaBornSumSim(gpuContext gpu)
#include "kCalculateObcGbsaBornSum.h"
#include "kCalculateObcGbsaBornSum.h"
__global__
__global__
__launch_bounds__
(
384
,
1
)
__launch_bounds__
(
384
,
1
)
void
kClearObcGbsaBornSum_kernel
()
void
kClearObcGbsaBornSum_kernel
()
{
{
unsigned
int
pos
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
unsigned
int
pos
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
...
@@ -109,8 +110,8 @@ void kClearObcGbsaBornSum_kernel()
...
@@ -109,8 +110,8 @@ void kClearObcGbsaBornSum_kernel()
}
}
}
}
__global__
__global__
__launch_bounds__
(
384
,
1
)
__launch_bounds__
(
384
,
1
)
void
kReduceObcGbsaBornSum_kernel
()
void
kReduceObcGbsaBornSum_kernel
()
{
{
unsigned
int
pos
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
);
unsigned
int
pos
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
);
...
...
platforms/cuda/src/kernels/kCalculateObcGbsaBornSum.h
View file @
2cb112f0
...
@@ -41,12 +41,6 @@ __launch_bounds__(G8X_NONBOND_THREADS_PER_BLOCK, 1)
...
@@ -41,12 +41,6 @@ __launch_bounds__(G8X_NONBOND_THREADS_PER_BLOCK, 1)
void
METHOD_NAME
(
kCalculateObcGbsa
,
BornSum_kernel
)(
unsigned
int
*
workUnit
)
void
METHOD_NAME
(
kCalculateObcGbsa
,
BornSum_kernel
)(
unsigned
int
*
workUnit
)
{
{
extern
__shared__
Atom
sA
[];
extern
__shared__
Atom
sA
[];
/*
unsigned int numWorkUnits = cSim.pInteractionCount[0];
int end = numWorkUnits / gridDim.x;
int pos = end - (threadIdx.x >> GRIDBITS) - 1;
*/
unsigned
int
totalWarps
=
cSim
.
nonbond_blocks
*
cSim
.
nonbond_threads_per_block
/
GRID
;
unsigned
int
totalWarps
=
cSim
.
nonbond_blocks
*
cSim
.
nonbond_threads_per_block
/
GRID
;
unsigned
int
warp
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
)
/
GRID
;
unsigned
int
warp
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
)
/
GRID
;
unsigned
int
numWorkUnits
=
cSim
.
pInteractionCount
[
0
];
unsigned
int
numWorkUnits
=
cSim
.
pInteractionCount
[
0
];
...
@@ -60,12 +54,10 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
...
@@ -60,12 +54,10 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
float
*
tempBuffer
=
(
float
*
)
&
sA
[
cSim
.
nonbond_threads_per_block
];
float
*
tempBuffer
=
(
float
*
)
&
sA
[
cSim
.
nonbond_threads_per_block
];
#endif
#endif
//while (pos >= 0)
while
(
pos
<
end
)
while
(
pos
<
end
)
{
{
// Extract cell coordinates from appropriate work unit
// Extract cell coordinates from appropriate work unit
//unsigned int x = workUnit[pos + (blockIdx.x*numWorkUnits)/gridDim.x];
unsigned
int
x
=
workUnit
[
pos
];
unsigned
int
x
=
workUnit
[
pos
];
unsigned
int
y
=
((
x
>>
2
)
&
0x7fff
)
<<
GRIDBITS
;
unsigned
int
y
=
((
x
>>
2
)
&
0x7fff
)
<<
GRIDBITS
;
x
=
(
x
>>
17
)
<<
GRIDBITS
;
x
=
(
x
>>
17
)
<<
GRIDBITS
;
...
@@ -162,7 +154,6 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
...
@@ -162,7 +154,6 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
sA
[
threadIdx
.
x
].
sum
=
apos
.
w
=
0
.
0
f
;
sA
[
threadIdx
.
x
].
sum
=
apos
.
w
=
0
.
0
f
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
//unsigned int flags = cSim.pInteractionFlag[pos + (blockIdx.x*numWorkUnits)/gridDim.x];
unsigned
int
flags
=
cSim
.
pInteractionFlag
[
pos
];
unsigned
int
flags
=
cSim
.
pInteractionFlag
[
pos
];
if
(
flags
==
0
)
if
(
flags
==
0
)
{
{
...
@@ -339,8 +330,6 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
...
@@ -339,8 +330,6 @@ void METHOD_NAME(kCalculateObcGbsa, BornSum_kernel)(unsigned int* workUnit)
cSim
.
pBornSum
[
offset
]
=
sA
[
threadIdx
.
x
].
sum
;
cSim
.
pBornSum
[
offset
]
=
sA
[
threadIdx
.
x
].
sum
;
#endif
#endif
}
}
//pos -= cSim.nonbond_workBlock;
pos
++
;
pos
++
;
}
}
}
}
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