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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raphael.bach
fmpi
Commits
29d0db24
Verified
Commit
29d0db24
authored
3 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Add `fmpi_futhark_new_data_{sync,async}()`
parent
6b5f1fa3
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/internal/fmpi_futhark.h
+9
-2
9 additions, 2 deletions
include/internal/fmpi_futhark.h
src/fmpi_futhark.c
+25
-9
25 additions, 9 deletions
src/fmpi_futhark.c
src/fmpi_task.c
+29
-8
29 additions, 8 deletions
src/fmpi_task.c
with
63 additions
and
19 deletions
include/internal/fmpi_futhark.h
+
9
−
2
View file @
29d0db24
...
...
@@ -126,9 +126,16 @@ int fmpi_futhark_sync(const struct fmpi_futhark_ctx * ctx);
*/
_Bool
fmpi_futhark_check_error
(
const
struct
fmpi_futhark_ctx
*
ctx
,
const
char
*
func
);
/*------------------------------------------------------------------------------
fmpi_futhark_new_data()
fmpi_futhark_new_data
_sync
()
------------------------------------------------------------------------------*/
void
*
fmpi_futhark_new_data
(
void
*
fmpi_futhark_new_data_sync
(
const
struct
fmpi_futhark_ctx
*
ctx
,
const
void
*
data
,
enum
fmpi_type_base
type
,
size_t
dim_cnt
,
size_t
x
,
size_t
y
,
size_t
z
);
/*------------------------------------------------------------------------------
fmpi_futhark_new_data_async()
------------------------------------------------------------------------------*/
void
*
fmpi_futhark_new_data_async
(
const
struct
fmpi_futhark_ctx
*
ctx
,
const
void
*
data
,
enum
fmpi_type_base
type
,
size_t
dim_cnt
,
size_t
x
,
size_t
y
,
size_t
z
);
...
...
This diff is collapsed.
Click to expand it.
src/fmpi_futhark.c
+
25
−
9
View file @
29d0db24
...
...
@@ -156,9 +156,26 @@ _Bool fmpi_futhark_check_error(
return
false
;
}
/*------------------------------------------------------------------------------
fmpi_futhark_new_data()
fmpi_futhark_new_data
_sync
()
------------------------------------------------------------------------------*/
void
*
fmpi_futhark_new_data
(
void
*
fmpi_futhark_new_data_sync
(
const
struct
fmpi_futhark_ctx
*
const
ctx
,
const
void
*
const
data
,
const
enum
fmpi_type_base
type
,
const
size_t
dim_cnt
,
const
size_t
x
,
const
size_t
y
,
const
size_t
z
){
assert
(
ctx
!=
NULL
);
assert
(
data
!=
NULL
);
assert
(
dim_cnt
<=
FMPI_DIM_MAX
);
const
size_t
idx
=
FMPI_PRIV_FUTHARK_FUNC_IDX
(
dim_cnt
,
type
);
void
*
new_data
=
fmpi_futhark_new_data_func_list
[
idx
](
ctx
,
data
,
x
,
y
,
z
);
fmpi_futhark_sync
(
ctx
);
fmpi_futhark_check_error
(
ctx
,
"futhark_new_##T##_##D##"
);
return
new_data
;
}
/*------------------------------------------------------------------------------
fmpi_futhark_new_data_async()
------------------------------------------------------------------------------*/
void
*
fmpi_futhark_new_data_async
(
const
struct
fmpi_futhark_ctx
*
const
ctx
,
const
void
*
const
data
,
const
enum
fmpi_type_base
type
,
const
size_t
dim_cnt
,
const
size_t
x
,
const
size_t
y
,
const
size_t
z
...
...
@@ -236,18 +253,17 @@ void * fmpi_futhark_get_data_async(
#define FMPI_FUTHARK_DEFINITION(D, T) \
void * fmpi_futhark_new_##D##d_##T( \
const struct fmpi_futhark_ctx * const ctx, const void * const
array
, \
const struct fmpi_futhark_ctx * const ctx, const void * const
data
, \
const size_t x, const size_t y, const size_t z \
){ \
_Static_assert((D) <= FMPI_DIM_MAX, ""); \
assert(ctx != NULL); \
assert(
array
!= NULL); \
struct futhark_##T##_##D##d * data = FMPI_FUTHARK_NEW_##D(T, ctx->ctx,
array
, x, y, z); \
if(data == NULL) { \
fmpi_futhark_check_error
(ctx, CPL_STRINGIFY(futhark_new_##T##_##D##d)); \
assert(
data
!= NULL); \
struct futhark_##T##_##D##d *
new_
data = FMPI_FUTHARK_NEW_##D(T, ctx->ctx,
data
, x, y, z); \
if(
new_
data == NULL) { \
FMPI_RAISE_FUTHARK_ERROR
(ctx, CPL_STRINGIFY(futhark_new_##T##_##D##d)
"() failed!"
); \
} \
fmpi_futhark_sync(ctx); \
return data; \
return new_data; \
} \
int fmpi_futhark_free_##D##d_##T( \
const struct fmpi_futhark_ctx * const ctx, void * const data \
...
...
This diff is collapsed.
Click to expand it.
src/fmpi_task.c
+
29
−
8
View file @
29d0db24
...
...
@@ -64,14 +64,35 @@ struct fmpi_task fmpi_task_register(
FMPI_RAISE_ERROR
(
ctx
->
err_handler
,
"FMPI"
,
"fmpi_new_domain() failed!"
);
continue
;
}
void
*
start
=
fmpi_futhark_new_data
(
void
*
data
=
NULL
;
if
(
task
.
type
==
FMPI_TASK_TYPE_SYNC
)
{
data
=
fmpi_futhark_new_data_sync
(
ctx
->
fut
,
task
.
domains
[
i
].
parts
[
rank
].
start
,
task
.
domains
[
i
].
data
.
type
.
base
,
task
.
domains
[
i
].
data
.
dim_cnt
,
task
.
domains
[
i
].
parts
[
rank
].
dim_len
[
0
],
task
.
domains
[
i
].
parts
[
rank
].
dim_len
[
1
],
task
.
domains
[
i
].
parts
[
rank
].
dim_len
[
2
]
);
if
(
data
==
NULL
)
{
FMPI_RAISE_ERROR
(
ctx
->
err_handler
,
"FMPI"
,
"fmpi_futhark_new_data_sync() failed!"
);
}
}
else
{
data
=
fmpi_futhark_new_data_async
(
ctx
->
fut
,
task
.
domains
[
i
].
parts
[
rank
].
start
,
task
.
domains
[
i
].
data
.
type
.
base
,
task
.
domains
[
i
].
data
.
dim_cnt
,
task
.
domains
[
i
].
parts
[
rank
].
dim_len
[
0
],
task
.
domains
[
i
].
parts
[
rank
].
dim_len
[
1
],
task
.
domains
[
i
].
parts
[
rank
].
dim_len
[
2
]
);
task
.
args
.
in
[
i
].
start
=
start
;
if
(
data
==
NULL
)
{
FMPI_RAISE_ERROR
(
ctx
->
err_handler
,
"FMPI"
,
"fmpi_futhark_new_data_async() failed!"
);
}
}
task
.
args
.
in
[
i
].
start
=
data
;
}
ctx
->
tasks
[
ctx
->
task_cnt
++
]
=
task
;
if
(
task
.
type
==
FMPI_TASK_TYPE_SYNC
)
{
...
...
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