Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fmpi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
raphael.bach
fmpi
Commits
f633bb0a
Verified
Commit
f633bb0a
authored
2 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Add `fmpi_mpi_reduce_in_place()`
parent
2acb166b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/internal/fmpi_mpi.h
+7
-0
7 additions, 0 deletions
include/internal/fmpi_mpi.h
src/fmpi_mpi.c
+19
-0
19 additions, 0 deletions
src/fmpi_mpi.c
with
26 additions
and
0 deletions
include/internal/fmpi_mpi.h
+
7
−
0
View file @
f633bb0a
...
@@ -223,6 +223,13 @@ int fmpi_mpi_world_gather_in_place(
...
@@ -223,6 +223,13 @@ int fmpi_mpi_world_gather_in_place(
const
struct
fmpi_mpi_ctx
*
ctx
,
void
*
buf
,
MPI_Datatype
type
,
const
struct
fmpi_mpi_ctx
*
ctx
,
void
*
buf
,
MPI_Datatype
type
,
size_t
send_cnt
,
size_t
recv_cnt
size_t
send_cnt
,
size_t
recv_cnt
);
);
/*------------------------------------------------------------------------------
fmpi_mpi_reduce_in_place()
------------------------------------------------------------------------------*/
int
fmpi_mpi_reduce_in_place
(
const
struct
fmpi_mpi_ctx
*
ctx
,
void
*
buf
,
size_t
cnt
,
MPI_Datatype
type
,
MPI_Op
op
,
int
root
,
MPI_Comm
comm
);
/*==============================================================================
/*==============================================================================
GUARD
GUARD
==============================================================================*/
==============================================================================*/
...
...
This diff is collapsed.
Click to expand it.
src/fmpi_mpi.c
+
19
−
0
View file @
f633bb0a
...
@@ -274,3 +274,22 @@ int fmpi_mpi_world_gather_in_place(
...
@@ -274,3 +274,22 @@ int fmpi_mpi_world_gather_in_place(
}
}
return
err
;
return
err
;
}
}
/*------------------------------------------------------------------------------
fmpi_mpi_reduce_in_place()
------------------------------------------------------------------------------*/
int
fmpi_mpi_reduce_in_place
(
const
struct
fmpi_mpi_ctx
*
const
ctx
,
void
*
const
buf
,
const
size_t
cnt
,
MPI_Datatype
type
,
MPI_Op
op
,
const
int
root
,
MPI_Comm
comm
){
assert
(
ctx
!=
NULL
);
assert
(
buf
!=
NULL
);
assert
(
cnt
<=
INT_MAX
);
int
err
=
MPI_SUCCESS
;
if
(
ctx
->
rank
==
root
)
{
err
=
MPI_Reduce
(
MPI_IN_PLACE
,
buf
,
(
int
)
cnt
,
type
,
op
,
root
,
comm
);
}
else
{
err
=
MPI_Reduce
(
buf
,
buf
,
(
int
)
cnt
,
type
,
op
,
root
,
comm
);
}
return
fmpi_mpi_check_error
(
ctx
,
err
,
"MPI_Reduce"
);
}
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