Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mpi-cuda
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
Service Desk
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
Bryce Allen
mpi-cuda
Commits
349837e9
Commit
349837e9
authored
3 years ago
by
Bryce Allen
Browse files
Options
Downloads
Patches
Plain Diff
fix mpi init/set device order
parent
df5f830a
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
mpi_daxpy_gt.cc
+11
-9
11 additions, 9 deletions
mpi_daxpy_gt.cc
with
11 additions
and
9 deletions
mpi_daxpy_gt.cc
+
11
−
9
View file @
349837e9
...
...
@@ -47,29 +47,31 @@ void set_rank_device(int n_ranks, int rank) {
int
main
(
int
argc
,
char
**
argv
)
{
int
n
=
1024
;
int
world_size
,
world_rank
;
int
world_size
,
world_rank
,
device_id
;
uint32_t
vendor_id
;
double
a
=
2.0
;
double
sum
=
0.0
;
auto
x
=
gt
::
empty
<
double
>
({
n
});
auto
y
=
gt
::
empty
<
double
>
({
n
});
auto
d_x
=
gt
::
empty_device
<
double
>
({
n
});
auto
d_y
=
gt
::
empty_device
<
double
>
({
n
});
MPI_Init
(
NULL
,
NULL
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
world_size
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
world_rank
);
set_rank_device
(
world_size
,
world_rank
);
auto
x
=
gt
::
empty
<
double
>
({
n
});
auto
y
=
gt
::
empty
<
double
>
({
n
});
auto
d_x
=
gt
::
empty_device
<
double
>
({
n
});
auto
d_y
=
gt
::
empty_device
<
double
>
({
n
});
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
x
[
i
]
=
i
+
1
;
y
[
i
]
=
-
i
-
1
;
}
set_rank_device
(
world_size
,
world_rank
);
vendor_id
=
gt
::
backend
::
clib
::
device_get_vendor_id
(
gt
::
backend
::
clib
::
device_
get
()
);
device_id
=
gt
::
backend
::
clib
::
device_get
(
);
vendor_id
=
gt
::
backend
::
clib
::
device_get_vendor_id
(
device_
id
);
gt
::
blas
::
handle_t
*
h
=
gt
::
blas
::
create
();
...
...
@@ -87,7 +89,7 @@ int main(int argc, char **argv) {
//printf("%f\n", y[i]);
sum
+=
y
[
i
];
}
printf
(
"%d/%d [%x] SUM = %f
\n
"
,
world_rank
,
world_size
,
vendor_id
,
sum
);
printf
(
"%d/%d [%
d:0x%08
x] SUM = %f
\n
"
,
world_rank
,
world_size
,
device_id
,
vendor_id
,
sum
);
MPI_Finalize
();
...
...
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