Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sample-sort
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kchndrs2
sample-sort
Commits
911f717d
Commit
911f717d
authored
6 years ago
by
kchndrs2
Browse files
Options
Downloads
Patches
Plain Diff
Fix timing bug and splitter rng bug
Change-Id: I9bc07d23798ea01832b10e208b6ba945ef8ff3d8
parent
3cd53b3f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sort.C
+13
-4
13 additions, 4 deletions
sort.C
with
13 additions
and
4 deletions
sort.C
+
13
−
4
View file @
911f717d
...
...
@@ -61,10 +61,12 @@ struct timezone { int tz_minuteswest;
void
generateSetOfNumbers
(
int
arr
[],
int
n
)
{
int
p
[
10
]
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
int
p
[
n
];
for
(
int
i
=
0
;
i
<
n
;
i
++
)
p
[
i
]
=
i
;
//shuffle p
for
(
int
i
=
9
;
i
>
0
;
--
i
)
for
(
int
i
=
n
;
i
>
0
;
--
i
)
{
//get swap index
int
j
=
rand
()
%
i
;
...
...
@@ -137,7 +139,7 @@ int main(int argc, char** argv) {
MPI_Get_processor_name
(
processor_name
,
&
name_len
);
int
nProcs
=
world_size
;
int
s
=
2
;
int
s
=
64
;
int
dataCount
=
1
<<
12
;
int
data_per_proc
=
dataCount
/
nProcs
;
...
...
@@ -272,9 +274,11 @@ int main(int argc, char** argv) {
int
final_data
[
dataCount
];
int
global_count
=
0
;
int
total_bucket_size
=
0
;
for
(
int
i
=
0
;
i
<
nProcs
;
i
++
){
int
num_b
;
MPI_Recv
(
&
num_b
,
1
,
MPI_INT
,
i
,
0
,
MPI_COMM_WORLD
,
MPI_STATUS_IGNORE
);
total_bucket_size
+=
num_b
;
int
data_new
[
num_b
];
MPI_Recv
(
data_new
,
num_b
,
MPI_INT
,
i
,
0
,
MPI_COMM_WORLD
,
MPI_STATUS_IGNORE
);
for
(
int
j
=
0
;
j
<
num_b
;
j
++
){
...
...
@@ -285,6 +289,8 @@ int main(int argc, char** argv) {
}
}
printf
(
"
\n
Proc-%d's bucket size=%d
\n
"
,
world_rank
,
total_bucket_size
);
for
(
int
j
=
0
;
j
<
nProcs
;
j
++
){
MPI_Wait
(
&
request1
[
j
],
&
status1
[
j
]);
MPI_Wait
(
&
request2
[
j
],
&
status2
[
j
]);
...
...
@@ -305,7 +311,10 @@ int main(int argc, char** argv) {
" out of %d processors
\n
"
,
processor_name
,
world_rank
,
world_size
);
#endif
int
dummy
=
nProcs
;
MPI_Bcast
(
&
dummy
,
1
,
MPI_INT
,
0
,
MPI_COMM_WORLD
);
//Barrier for timing
MPI_Barrier
(
MPI_COMM_WORLD
);
if
(
world_rank
==
0
)
printf
(
"
\n
Time = %lf
\n
"
,
mysecond_
()
-
start_time
);
// Finalize the MPI environment.
...
...
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