Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs267
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
recolic-hust
cs267
Commits
97d1ba7f
There was an error fetching the commit references. Please try again later.
Unverified
Commit
97d1ba7f
authored
6 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
sync
parent
758b25c9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hw2/serial.cu
+10
-2
10 additions, 2 deletions
hw2/serial.cu
with
10 additions
and
2 deletions
hw2/serial.cu
+
10
−
2
View file @
97d1ba7f
...
...
@@ -116,7 +116,14 @@ namespace r267 {
RLIB_MACRO_ACCESS_2D_DICT
(
0
,
index
).
clear
();
}
__global__
void
kernel_fill_dicts
(
dict_element_type
*
__restrict__
_dict_buf_ptr
,
int
grid_size
,
particle_t
*
__restrict__
particles
)
{
__global__
void
kernel_fill_dicts
(
dict_element_type
*
__restrict__
_dict_buf_ptr
,
int
grid_size
,
particle_t
*
__restrict__
particles
,
int
n
)
{
for
(
int
index
=
0
;
index
<
n
;
++
index
)
{
int
a
=
floor
(
particles
[
index
].
x
/
cutoff
);
int
b
=
floor
(
particles
[
index
].
y
/
cutoff
);
RLIB_MACRO_ACCESS_2D_DICT
(
a
,
b
).
thread_safe_push_back
(
index
);
}
return
;
int
index
=
threadIdx
.
x
+
blockIdx
.
x
*
CUDA_MAX_THREAD_PER_BLOCK
;
int
a
=
floor
(
particles
[
index
].
x
/
cutoff
);
int
b
=
floor
(
particles
[
index
].
y
/
cutoff
);
...
...
@@ -211,11 +218,12 @@ int main(int argc, char **argv) {
//
// move particles
//
r267
::
kernel_fill_dicts
<<<
1
,
1
>>>
(
_dict_buf_ptr
.
get
(),
grid_size
,
particles
,
n
);
const
auto
buffer_size
=
n
;
const
auto
threads
=
std
::
min
(
buffer_size
,
CUDA_MAX_THREAD_PER_BLOCK
);
const
auto
blocks
=
buffer_size
/
CUDA_MAX_THREAD_PER_BLOCK
+
1
;
//printf("debug: blocks=%d, threads=%d\n", blocks, threads);
r267
::
kernel_fill_dicts
<<<
blocks
,
threads
>>>
(
_dict_buf_ptr
.
get
(),
grid_size
,
particles
);
//
r267::kernel_fill_dicts<<<blocks, threads>>>(_dict_buf_ptr.get(), grid_size, particles);
r267
::
apply_force_helper
<<<
blocks
,
threads
>>>
(
particles
,
buffer_size
,
_dict_buf_ptr
.
get
(),
grid_size
,
&
r267_stats
->
dmin
,
&
r267_stats
->
davg
,
&
r267_stats
->
navg
);
rlib
::
cuda_assert
(
cudaDeviceSynchronize
());
//printf("in-kernel debug: dmin=%f\n", r267_stats->dmin);
...
...
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