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
84cbefbf
Verified
Commit
84cbefbf
authored
2 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Add `fmpi_mpi_world_reduce_in_place()`
parent
f633bb0a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/internal/fmpi_mpi.h
+7
-0
7 additions, 0 deletions
include/internal/fmpi_mpi.h
src/fmpi_mpi.c
+21
-0
21 additions, 0 deletions
src/fmpi_mpi.c
src/fmpi_task.c
+10
-13
10 additions, 13 deletions
src/fmpi_task.c
with
38 additions
and
13 deletions
include/internal/fmpi_mpi.h
+
7
−
0
View file @
84cbefbf
...
@@ -230,6 +230,13 @@ int fmpi_mpi_reduce_in_place(
...
@@ -230,6 +230,13 @@ int fmpi_mpi_reduce_in_place(
const
struct
fmpi_mpi_ctx
*
ctx
,
void
*
buf
,
size_t
cnt
,
MPI_Datatype
type
,
const
struct
fmpi_mpi_ctx
*
ctx
,
void
*
buf
,
size_t
cnt
,
MPI_Datatype
type
,
MPI_Op
op
,
int
root
,
MPI_Comm
comm
MPI_Op
op
,
int
root
,
MPI_Comm
comm
);
);
/*------------------------------------------------------------------------------
fmpi_mpi_world_reduce_in_place()
------------------------------------------------------------------------------*/
int
fmpi_mpi_world_reduce_in_place
(
const
struct
fmpi_mpi_ctx
*
ctx
,
void
*
buf
,
size_t
cnt
,
MPI_Datatype
type
,
MPI_Op
op
);
/*==============================================================================
/*==============================================================================
GUARD
GUARD
==============================================================================*/
==============================================================================*/
...
...
This diff is collapsed.
Click to expand it.
src/fmpi_mpi.c
+
21
−
0
View file @
84cbefbf
...
@@ -293,3 +293,24 @@ int fmpi_mpi_reduce_in_place(
...
@@ -293,3 +293,24 @@ int fmpi_mpi_reduce_in_place(
}
}
return
fmpi_mpi_check_error
(
ctx
,
err
,
"MPI_Reduce"
);
return
fmpi_mpi_check_error
(
ctx
,
err
,
"MPI_Reduce"
);
}
}
/*------------------------------------------------------------------------------
fmpi_mpi_world_reduce_in_place()
------------------------------------------------------------------------------*/
int
fmpi_mpi_world_reduce_in_place
(
const
struct
fmpi_mpi_ctx
*
const
ctx
,
void
*
const
buf
,
const
size_t
cnt
,
MPI_Datatype
type
,
MPI_Op
op
){
assert
(
ctx
!=
NULL
);
assert
(
buf
!=
NULL
);
assert
(
cnt
<=
INT_MAX
);
const
int
err
=
fmpi_mpi_reduce_in_place
(
ctx
,
buf
,
cnt
,
type
,
op
,
ctx
->
root
,
ctx
->
world
);
if
(
err
!=
FMPI_SUCCESS
)
{
FMPI_RAISE_ERROR
(
ctx
->
err_handler
,
"FMPI"
,
"fmpi_mpi_reduce_in_place() failed!"
);
}
return
err
;
}
This diff is collapsed.
Click to expand it.
src/fmpi_task.c
+
10
−
13
View file @
84cbefbf
...
@@ -180,22 +180,19 @@ int fmpi_task_finalize(
...
@@ -180,22 +180,19 @@ int fmpi_task_finalize(
assert
(
ctx
!=
NULL
);
assert
(
ctx
!=
NULL
);
assert
(
task
!=
NULL
);
assert
(
task
!=
NULL
);
if
(
op
==
FMPI_TASK_OP_NONE
)
{
if
(
op
==
FMPI_TASK_OP_NONE
)
{
return
0
;
return
FMPI_SUCCESS
;
}
}
if
(
op
==
FMPI_TASK_OP_SUM
)
{
if
(
op
==
FMPI_TASK_OP_SUM
)
{
if
(
fmpi_mpi_is_root
(
ctx
->
mpi
))
{
const
int
err
=
fmpi_mpi_world_reduce_in_place
(
MPI_Reduce
(
ctx
->
mpi
,
task
->
args
.
out
.
raw
,
task
->
args
.
out
.
cnt
,
MPI_IN_PLACE
,
task
->
args
.
out
.
raw
,
(
int
)
task
->
args
.
out
.
cnt
,
fmpi_mpi_type
(
task
->
args
.
out
.
type
.
base
),
MPI_SUM
fmpi_mpi_type
(
task
->
args
.
out
.
type
.
base
),
MPI_SUM
,
);
ctx
->
mpi
->
root
,
ctx
->
mpi
->
world
if
(
err
!=
FMPI_SUCCESS
)
{
);
FMPI_RAISE_ERROR
(
ctx
->
err_handler
,
"FMPI"
,
}
else
{
"fmpi_mpi_world_reduce_in_place() failed!"
MPI_Reduce
(
task
->
args
.
out
.
raw
,
task
->
args
.
out
.
raw
,
(
int
)
task
->
args
.
out
.
cnt
,
fmpi_mpi_type
(
task
->
args
.
out
.
type
.
base
),
MPI_SUM
,
ctx
->
mpi
->
root
,
ctx
->
mpi
->
world
);
);
}
}
return
err
;
}
}
return
0
;
return
FMPI_SUCCESS
;
}
}
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