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
6367ea49
Verified
Commit
6367ea49
authored
2 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Add `fmpi_partition_block_2d()`
parent
cec71102
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
src/fmpi_domain.c
+38
-2
38 additions, 2 deletions
src/fmpi_domain.c
with
38 additions
and
2 deletions
src/fmpi_domain.c
+
38
−
2
View file @
6367ea49
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#include
<assert.h>
#include
<assert.h>
#include
<stdlib.h>
// size_t, NULL, malloc(), free()
#include
<stdlib.h>
// size_t, NULL, malloc(), free()
#include
<string.h>
// memcpy()
#include
<string.h>
// memcpy()
#include
<stdio.h>
// Internal
// Internal
#include
"fmpi_data.h"
#include
"fmpi_data.h"
#include
"fmpi_stencil.h"
#include
"fmpi_stencil.h"
...
@@ -46,6 +45,12 @@
...
@@ -46,6 +45,12 @@
static
struct
fmpi_data
fmpi_partition_block_1d
(
static
struct
fmpi_data
fmpi_partition_block_1d
(
const
struct
fmpi_ctx
*
ctx
,
const
struct
fmpi_data
*
data
const
struct
fmpi_ctx
*
ctx
,
const
struct
fmpi_data
*
data
);
);
/*------------------------------------------------------------------------------
fmpi_partition_block_2d()
------------------------------------------------------------------------------*/
static
struct
fmpi_data
fmpi_partition_block_2d
(
const
struct
fmpi_ctx
*
ctx
,
const
struct
fmpi_data
*
data
);
/*------------------------------------------------------------------------------
/*------------------------------------------------------------------------------
fmpi_halo_1d()
fmpi_halo_1d()
------------------------------------------------------------------------------*/
------------------------------------------------------------------------------*/
...
@@ -152,7 +157,38 @@ static struct fmpi_data fmpi_partition_block_1d(
...
@@ -152,7 +157,38 @@ static struct fmpi_data fmpi_partition_block_1d(
};
};
}
}
/*------------------------------------------------------------------------------
/*------------------------------------------------------------------------------
fmpi_create_halo()
fmpi_partition_block_2d()
------------------------------------------------------------------------------*/
static
struct
fmpi_data
fmpi_partition_block_2d
(
const
struct
fmpi_ctx
*
const
ctx
,
const
struct
fmpi_data
*
const
data
)
{
assert
(
ctx
!=
NULL
);
assert
(
data
!=
NULL
);
size_t
dim_len
[
1
]
=
{
0
};
if
(
fmpi_mpi_dims_create
(
ctx
->
mpi
,
dim_len
,
1
)
!=
FMPI_SUCCESS
)
{
FMPI_RAISE_ERROR
(
ctx
->
err_handler
,
"FMPI"
,
"fmpi_mpi_dims_create() failed!"
);
}
const
size_t
rank
=
(
size_t
)
ctx
->
mpi
->
rank
;
const
size_t
cnt_per_proc
=
data
->
cnt
/
dim_len
[
0
];
const
size_t
rem
=
data
->
cnt
%
dim_len
[
0
];
const
size_t
cnt
=
(
rank
<
rem
)
?
(
cnt_per_proc
+
1
)
:
cnt_per_proc
;
const
size_t
size
=
cnt
*
data
->
type
.
size
;
const
size_t
offset
=
(
rank
*
size
)
+
(
rank
<
rem
?
0
:
(
rem
*
data
->
type
.
size
));
return
(
struct
fmpi_data
){
.
type
=
data
->
type
,
.
cnt
=
cnt
,
.
size
=
size
,
.
dim_len
=
{
data
->
dim_len
[
0
],
data
->
dim_len
[
1
]
/
dim_len
[
0
],
1
},
.
dim_cnt
=
2
,
.
raw
=
(
char
*
)
data
->
raw
+
offset
,
.
gpu
=
NULL
};
}
/*------------------------------------------------------------------------------
fmpi_halo_1d()
------------------------------------------------------------------------------*/
------------------------------------------------------------------------------*/
static
struct
fmpi_data
fmpi_halo_1d
(
static
struct
fmpi_data
fmpi_halo_1d
(
const
struct
fmpi_ctx
*
const
ctx
,
const
struct
fmpi_data
data
,
const
struct
fmpi_ctx
*
const
ctx
,
const
struct
fmpi_data
data
,
...
...
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