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
a1672665
Verified
Commit
a1672665
authored
2 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Add `fmpi_mpi_dims_create()`
parent
bdf128dc
No related branches found
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
+6
-0
6 additions, 0 deletions
include/internal/fmpi_mpi.h
src/fmpi_mpi.c
+22
-0
22 additions, 0 deletions
src/fmpi_mpi.c
with
28 additions
and
0 deletions
include/internal/fmpi_mpi.h
+
6
−
0
View file @
a1672665
...
...
@@ -237,6 +237,12 @@ int fmpi_mpi_world_reduce_in_place(
const
struct
fmpi_mpi_ctx
*
ctx
,
void
*
buf
,
size_t
cnt
,
MPI_Datatype
type
,
MPI_Op
op
);
/*------------------------------------------------------------------------------
fmpi_mpi_dims_create()
------------------------------------------------------------------------------*/
int
fmpi_mpi_dims_create
(
const
struct
fmpi_mpi_ctx
*
ctx
,
size_t
*
const
dim_len
,
size_t
dim_cnt
);
/*==============================================================================
GUARD
==============================================================================*/
...
...
This diff is collapsed.
Click to expand it.
src/fmpi_mpi.c
+
22
−
0
View file @
a1672665
...
...
@@ -32,6 +32,7 @@
// External
#include
<mpi.h>
// Internal
#include
"internal/fmpi_common.h"
#include
"internal/fmpi_error.h"
#include
"internal/fmpi_type.h"
/*==============================================================================
...
...
@@ -314,3 +315,24 @@ int fmpi_mpi_world_reduce_in_place(
}
return
err
;
}
/*------------------------------------------------------------------------------
fmpi_mpi_dims_create()
------------------------------------------------------------------------------*/
int
fmpi_mpi_dims_create
(
const
struct
fmpi_mpi_ctx
*
const
ctx
,
size_t
*
const
dim_len
,
const
size_t
dim_cnt
){
assert
(
ctx
!=
NULL
);
assert
(
dim_len
!=
NULL
);
assert
(
dim_cnt
<=
FMPI_DIM_MAX
);
int
dims
[
FMPI_DIM_MAX
];
for
(
size_t
i
=
0
;
i
<
dim_cnt
;
i
++
)
{
dims
[
i
]
=
(
int
)
dim_len
[
i
];
}
const
int
err
=
MPI_Dims_create
(
ctx
->
size
,
(
int
)
dim_cnt
,
dims
);
for
(
size_t
i
=
0
;
i
<
dim_cnt
;
i
++
)
{
assert
(
dims
[
i
]
>=
0
);
dim_len
[
i
]
=
(
size_t
)
dims
[
i
];
}
return
fmpi_mpi_check_error
(
ctx
,
err
,
"MPI_Dims_create"
);
}
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