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
5bae4f89
Verified
Commit
5bae4f89
authored
3 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Make `fmpi_task_run_{sync, async}()` return an error code
parent
bc64a248
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/fmpi_task.h
+9
-5
9 additions, 5 deletions
include/fmpi_task.h
include/internal/generic/fmpi_task_generic.h
+3
-3
3 additions, 3 deletions
include/internal/generic/fmpi_task_generic.h
src/fmpi_task.c
+9
-4
9 additions, 4 deletions
src/fmpi_task.c
with
21 additions
and
12 deletions
include/fmpi_task.h
+
9
−
5
View file @
5bae4f89
...
...
@@ -80,7 +80,7 @@ typedef struct fmpi_task_args {
* TODO
* }
*/
typedef
void
(
*
fmpi_task_func
)(
typedef
int
(
*
fmpi_task_func
)(
const
struct
fmpi_ctx
*
ctx
,
const
struct
fmpi_task_args
*
args
);
/*------------------------------------------------------------------------------
...
...
@@ -132,7 +132,9 @@ struct fmpi_task fmpi_task_register(
* @param[in] ctx : A pointer to a fmpi_ctx.
* @param[in] task : A pointer to a fmpi_task.
*
* @return Nothing.
* @return
* - @success: `0`.
* - @failure: An error code different from `0`.
*
* @warning
* - \b [UB] \p{ctx} must not be `NULL`.
...
...
@@ -142,7 +144,7 @@ struct fmpi_task fmpi_task_register(
* TODO
* }
*/
void
fmpi_task_run_sync
(
const
struct
fmpi_ctx
*
ctx
,
const
struct
fmpi_task
*
task
);
int
fmpi_task_run_sync
(
const
struct
fmpi_ctx
*
ctx
,
const
struct
fmpi_task
*
task
);
/*------------------------------------------------------------------------------
fmpi_task_run_async()
------------------------------------------------------------------------------*/
...
...
@@ -152,7 +154,9 @@ void fmpi_task_run_sync(const struct fmpi_ctx * ctx, const struct fmpi_task * ta
* @param[in] ctx : A pointer to a fmpi_ctx.
* @param[in] task : A pointer to a fmpi_task.
*
* @return Nothing.
* @return
* - @success: `0`.
* - @failure: An error code different from `0`.
*
* @warning
* - \b [UB] \p{ctx} must not be `NULL`.
...
...
@@ -162,7 +166,7 @@ void fmpi_task_run_sync(const struct fmpi_ctx * ctx, const struct fmpi_task * ta
* TODO
* }
*/
void
fmpi_task_run_async
(
const
struct
fmpi_ctx
*
ctx
,
const
struct
fmpi_task
*
task
);
int
fmpi_task_run_async
(
const
struct
fmpi_ctx
*
ctx
,
const
struct
fmpi_task
*
task
);
/*==============================================================================
MACRO
==============================================================================*/
...
...
This diff is collapsed.
Click to expand it.
include/internal/generic/fmpi_task_generic.h
+
3
−
3
View file @
5bae4f89
...
...
@@ -35,14 +35,14 @@
#define FMPI_PRIV_TASK_CONCAT_(A, B) A##B
#define FMPI_TASK_DEFINITION(FUNC, N) \
void
FUNC##_##N(const struct fmpi_ctx * ctx, const struct fmpi_task_args * args); \
void
FUNC##_##N( \
int
FUNC##_##N(const struct fmpi_ctx * ctx, const struct fmpi_task_args * args); \
int
FUNC##_##N( \
const struct fmpi_ctx * const ctx, const struct fmpi_task_args * const args \
){ \
assert(ctx != NULL); \
assert(args != NULL); \
assert(args->cnt == N); \
FMPI_TASK_FUNC_##N(FUNC, ctx->fut->ctx, args); \
return
FMPI_TASK_FUNC_##N(FUNC, ctx->fut->ctx, args); \
}
#define FMPI_TASK_REGISTER_IMPL(ctx, func, stencil, ...) \
...
...
This diff is collapsed.
Click to expand it.
src/fmpi_task.c
+
9
−
4
View file @
5bae4f89
...
...
@@ -25,6 +25,7 @@
#include
"fmpi_task.h"
// C Standard Library
#include
<assert.h>
#include
<stdbool.h>
#include
<stddef.h>
// NULL, size_t
// Internal
#include
"fmpi_domain.h"
...
...
@@ -74,21 +75,25 @@ struct fmpi_task fmpi_task_register(
/*------------------------------------------------------------------------------
fmpi_task_run_sync()
------------------------------------------------------------------------------*/
void
fmpi_task_run_sync
(
int
fmpi_task_run_sync
(
const
struct
fmpi_ctx
*
const
ctx
,
const
struct
fmpi_task
*
const
task
){
assert
(
ctx
!=
NULL
);
assert
(
task
!=
NULL
);
task
->
func
(
ctx
,
&
task
->
args
);
const
int
err_id
=
task
->
func
(
ctx
,
&
task
->
args
);
fmpi_futhark_sync
(
ctx
->
fut
);
if
(
fmpi_futhark_check_error
(
ctx
->
fut
,
""
)
==
true
)
{
return
-
1
;
}
return
err_id
;
}
/*------------------------------------------------------------------------------
fmpi_task_run_async()
------------------------------------------------------------------------------*/
void
fmpi_task_run_async
(
int
fmpi_task_run_async
(
const
struct
fmpi_ctx
*
const
ctx
,
const
struct
fmpi_task
*
const
task
){
assert
(
ctx
!=
NULL
);
assert
(
task
!=
NULL
);
task
->
func
(
ctx
,
&
task
->
args
);
return
task
->
func
(
ctx
,
&
task
->
args
);
}
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