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
8b0b7cc0
Verified
Commit
8b0b7cc0
authored
3 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Add `FMPI_TASK_REGISTER()` and `fmpi_task_generic.h`
parent
ae90e912
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/array_sum/main.c
+5
-8
5 additions, 8 deletions
examples/array_sum/main.c
include/fmpi_task.h
+7
-1
7 additions, 1 deletion
include/fmpi_task.h
include/internal/generic/fmpi_task_generic.h
+88
-0
88 additions, 0 deletions
include/internal/generic/fmpi_task_generic.h
with
100 additions
and
9 deletions
examples/array_sum/main.c
+
5
−
8
View file @
8b0b7cc0
...
@@ -35,14 +35,11 @@ int main(int argc, char * argv[])
...
@@ -35,14 +35,11 @@ int main(int argc, char * argv[])
0
,
0
,
0
,
0
,
0
,
0
,
0
,
17
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
17
,
};
};
T
out
=
0
;
T
out
=
0
;
struct
fmpi_data
data_in
=
fmpi_data_1d
(
ctx
,
in
,
64
);
struct
fmpi_task
array_sum_task
=
FMPI_TASK_REGISTER
(
struct
fmpi_data
data_out
=
fmpi_data_1d
(
ctx
,
&
out
,
1
);
ctx
,
fut_array_sum
,
struct
fmpi_task_args
array_sum_args
=
{
fmpi_data_1d
(
ctx
,
&
out
,
1
),
.
in
=
{
data_in
},
fmpi_data_1d
(
ctx
,
in
,
64
),
.
out
=
data_out
,
);
.
cnt
=
1
};
struct
fmpi_task
array_sum_task
=
fmpi_task_register
(
ctx
,
fut_array_sum
,
&
array_sum_args
);
fmpi_task_run
(
ctx
,
&
array_sum_task
);
fmpi_task_run
(
ctx
,
&
array_sum_task
);
if
(
fmpi_is_root
(
ctx
))
{
if
(
fmpi_is_root
(
ctx
))
{
printf
(
"sum=%ld
\n
"
,
*
(
T
*
)
array_sum_task
.
args
.
out
.
start
);
printf
(
"sum=%ld
\n
"
,
*
(
T
*
)
array_sum_task
.
args
.
out
.
start
);
...
...
This diff is collapsed.
Click to expand it.
include/fmpi_task.h
+
7
−
1
View file @
8b0b7cc0
...
@@ -28,10 +28,11 @@
...
@@ -28,10 +28,11 @@
==============================================================================*/
==============================================================================*/
// C Standard Library
// C Standard Library
#include
<stddef.h>
#include
<stddef.h>
// External
// Internal
// Internal
#include
"fmpi_data.h"
#include
"fmpi_data.h"
#include
"internal/fmpi_ctx.h"
#include
"internal/fmpi_ctx.h"
#include
"internal/fmpi_futhark.h"
#include
"internal/generic/fmpi_task_generic.h"
/*==============================================================================
/*==============================================================================
DEFINE
DEFINE
==============================================================================*/
==============================================================================*/
...
@@ -144,6 +145,11 @@ void fmpi_task_run(const struct fmpi_ctx * ctx, const struct fmpi_task * task);
...
@@ -144,6 +145,11 @@ void fmpi_task_run(const struct fmpi_ctx * ctx, const struct fmpi_task * task);
/*==============================================================================
/*==============================================================================
MACRO
MACRO
==============================================================================*/
==============================================================================*/
/*------------------------------------------------------------------------------
FMPI_TASK_REGISTER()
------------------------------------------------------------------------------*/
#define FMPI_TASK_REGISTER(ctx, func, ...) \
FMPI_TASK_REGISTER_IMPL(ctx, func, __VA_ARGS__)
/*------------------------------------------------------------------------------
/*------------------------------------------------------------------------------
FMPI_TASK_FUTHARK_SYNC()
FMPI_TASK_FUTHARK_SYNC()
------------------------------------------------------------------------------*/
------------------------------------------------------------------------------*/
...
...
This diff is collapsed.
Click to expand it.
include/internal/generic/fmpi_task_generic.h
0 → 100644
+
88
−
0
View file @
8b0b7cc0
// SPDX-License-Identifier: 0BSD
/*!
* @file
* @license{
* BSD Zero Clause License
*
* Copyright (c) 2022 by Raphael Bach
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* }
*/
/*==============================================================================
GUARD
==============================================================================*/
#ifndef FMPI_TASK_GENERIC_H_20220515003504
#define FMPI_TASK_GENERIC_H_20220515003504
/*==============================================================================
INCLUDE
==============================================================================*/
// External
#include
"../../../external/cpl/cpl_arg.h"
/*==============================================================================
MACRO
==============================================================================*/
#define FMPI_PRIV_TASK_CONCAT(A, B) FMPI_PRIV_TASK_CONCAT_(A, B)
#define FMPI_PRIV_TASK_CONCAT_(A, B) A##B
#define FMPI_TASK_REGISTER_IMPL(ctx, func, ...) \
FMPI_PRIV_TASK_CONCAT(FMPI_TASK_REGISTER_, CPL_ARG_COUNT(__VA_ARGS__)) \
(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_1(ctx, func, arg_out) \
fmpi_task_register((ctx), (func), &(struct fmpi_task_args){ \
.out = (arg_out), \
.cnt = 0 \
})
#define FMPI_TASK_REGISTER_N(ctx, func, arg_out, ...) \
fmpi_task_register((ctx), (func), &(struct fmpi_task_args){ \
.in = {__VA_ARGS__}, \
.out = (arg_out), \
.cnt = CPL_ARG_COUNT(__VA_ARGS__)-1 \
})
#define FMPI_TASK_REGISTER_2(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_3(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_4(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_5(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_6(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_7(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_8(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_9(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_10(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_11(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_12(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_13(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_14(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_15(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_16(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_17(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_18(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_19(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_20(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_21(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_22(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_23(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_24(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_25(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_26(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_27(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_28(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_29(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_30(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_31(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
#define FMPI_TASK_REGISTER_32(ctx, func, ...) FMPI_TASK_REGISTER_N(ctx, func, __VA_ARGS__)
/*==============================================================================
GUARD
==============================================================================*/
#endif // FMPI_TASK_GENERIC_H_20220515003504
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