Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arbd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tbgl
tools
arbd
Commits
eb5ef427
Commit
eb5ef427
authored
9 years ago
by
cmaffeo2
Browse files
Options
Downloads
Plain Diff
Merge branch 'clean' into atoms
parents
a3d0b59d
202f3996
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RigidBodyController.cu
+11
-24
11 additions, 24 deletions
RigidBodyController.cu
with
11 additions
and
24 deletions
RigidBodyController.cu
+
11
−
24
View file @
eb5ef427
...
...
@@ -167,24 +167,10 @@ void RigidBodyController::initializeForcePairs() {
}
void
RigidBodyController
::
updateForces
(
int
s
)
{
/*––{ RBTODO }–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––.
| probably coalesce kernel calls, or move this to a device kernel caller |
| |
| - consider removing references (unless they are optimized out!) --- |
| - caclulate numthreads && numblocks |
| |
| all threads in a block should: ---------------------------------------- |
| (1) apply the same transformations to get the data point position in a |
| destination grid ----------------------------------------------------- |
| (2) reduce forces and torques to the same location ------------------- |
| (3) ??? ------------------------------------------------------------- |
| |
| Opportunities for memory bandwidth savings: |
`–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
// int numBlocks = (num * numReplicas) / NUM_THREADS + (num * numReplicas % NUM_THREADS == 0 ? 0 : 1);
// int numBlocks = 1;
/* int numThreads = 256; */
if
(
s
<=
1
)
gpuErrchk
(
cudaProfilerStart
()
);
// clear old forces
for
(
int
i
=
0
;
i
<
rigidBodyByType
.
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
rigidBodyByType
[
i
].
size
();
j
++
)
{
...
...
@@ -202,11 +188,12 @@ void RigidBodyController::updateForces(int s) {
fp
->
retrieveForcesForGrid
(
fp
->
lastRbGridID
);
fp
->
lastRbGridID
=
-
1
;
// sync streams
for
(
int
i
=
0
;
i
<
NUMSTREAMS
;
i
++
)
{
const
cudaStream_t
&
s
=
fp
->
stream
[
i
];
gpuErrchk
(
cudaStreamSynchronize
(
s
));
}
// stream sync was slower than device sync
/* for (int i = 0; i < NUMSTREAMS; i++) { */
/* const cudaStream_t &s = RigidBodyForcePair::stream[i]; */
/* gpuErrchk(cudaStreamSynchronize( s )); */
/* } */
gpuErrchk
(
cudaDeviceSynchronize
());
for
(
int
i
=
0
;
i
<
forcePairs
.
size
();
i
++
)
forcePairs
[
i
].
processGPUForces
();
...
...
@@ -277,7 +264,6 @@ int RigidBodyForcePair::lastRbGridID = -1; /* used to schedule kernel interactio
RigidBodyForcePair
*
RigidBodyForcePair
::
lastRbForcePair
=
NULL
;
void
RigidBodyForcePair
::
createStreams
()
{
gpuErrchk
(
cudaProfilerStart
()
);
for
(
int
i
=
0
;
i
<
NUMSTREAMS
;
i
++
)
gpuErrchk
(
cudaStreamCreate
(
&
(
stream
[
i
])
)
);
// gpuErrchk( cudaStreamCreateWithFlags( &(stream[i]) , cudaStreamNonBlocking ) );
...
...
@@ -355,7 +341,8 @@ void RigidBodyForcePair::callGridForceKernel(int pairId, int s) {
B1
,
B2
,
c
,
forces_d
[
i
],
torques_d
[
i
]);
}
// retrieveForcesForGrid(i); // this is slower than approach below, unsure why
if
(
lastRbGridID
>=
0
)
lastRbForcePair
->
retrieveForcesForGrid
(
lastRbGridID
);
lastRbForcePair
=
this
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment