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
0f14ff96
Verified
Commit
0f14ff96
authored
3 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Add `fmpi_futhark_get_data_sync()`
parent
571bee89
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
+7
-0
7 additions, 0 deletions
include/internal/fmpi_futhark.h
include/internal/generic/fmpi_futhark_generic.h
+3
-0
3 additions, 0 deletions
include/internal/generic/fmpi_futhark_generic.h
src/fmpi_futhark.c
+41
-0
41 additions, 0 deletions
src/fmpi_futhark.c
with
51 additions
and
0 deletions
include/internal/fmpi_futhark.h
+
7
−
0
View file @
0f14ff96
...
@@ -132,6 +132,13 @@ void * fmpi_futhark_new_data(
...
@@ -132,6 +132,13 @@ void * fmpi_futhark_new_data(
const
struct
fmpi_futhark_ctx
*
ctx
,
const
void
*
data
,
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
enum
fmpi_type_base
type
,
size_t
dim_cnt
,
size_t
x
,
size_t
y
,
size_t
z
);
);
/*------------------------------------------------------------------------------
fmpi_futhark_get_data_sync()
------------------------------------------------------------------------------*/
void
*
fmpi_futhark_get_data_sync
(
const
struct
fmpi_futhark_ctx
*
ctx
,
void
*
in
,
void
*
out
,
enum
fmpi_type_base
type
,
size_t
dim_cnt
);
/*==============================================================================
/*==============================================================================
MACRO
MACRO
==============================================================================*/
==============================================================================*/
...
...
This diff is collapsed.
Click to expand it.
include/internal/generic/fmpi_futhark_generic.h
+
3
−
0
View file @
0f14ff96
...
@@ -69,6 +69,9 @@ void * fmpi_futhark_new_##D##d_##T( \
...
@@ -69,6 +69,9 @@ void * fmpi_futhark_new_##D##d_##T( \
); \
); \
void fmpi_futhark_free_##D##d_##T( \
void fmpi_futhark_free_##D##d_##T( \
const struct fmpi_futhark_ctx * ctx, void * array \
const struct fmpi_futhark_ctx * ctx, void * array \
); \
int fmpi_futhark_values_##D##d_##T( \
const struct fmpi_futhark_ctx * ctx, void * in, void * out \
)
)
FMPI_DECLARE_FUNCS_DT
(
FMPI_FUTHARK_DECLARATION
,
1
,
FMPI_FUTHARK_TYPES
);
FMPI_DECLARE_FUNCS_DT
(
FMPI_FUTHARK_DECLARATION
,
1
,
FMPI_FUTHARK_TYPES
);
...
...
This diff is collapsed.
Click to expand it.
src/fmpi_futhark.c
+
41
−
0
View file @
0f14ff96
...
@@ -44,6 +44,15 @@ static const fmpi_futhark_new_data_func fmpi_futhark_new_data_func_list[] = {
...
@@ -44,6 +44,15 @@ static const fmpi_futhark_new_data_func fmpi_futhark_new_data_func_list[] = {
FMPI_FUTHARK_FUNC_ENTRY_LIST
(
new
,
2
),
FMPI_FUTHARK_FUNC_ENTRY_LIST
(
new
,
2
),
FMPI_FUTHARK_FUNC_ENTRY_LIST
(
new
,
3
)
FMPI_FUTHARK_FUNC_ENTRY_LIST
(
new
,
3
)
};
};
typedef
int
(
*
fmpi_futhark_get_data_func
)(
const
struct
fmpi_futhark_ctx
*
ctx
,
void
*
in
,
void
*
out
);
static
const
fmpi_futhark_get_data_func
fmpi_futhark_get_data_func_list
[]
=
{
FMPI_FUTHARK_FUNC_ENTRY_LIST
(
values
,
1
),
FMPI_FUTHARK_FUNC_ENTRY_LIST
(
values
,
2
),
FMPI_FUTHARK_FUNC_ENTRY_LIST
(
values
,
3
)
};
/*==============================================================================
/*==============================================================================
MACRO
MACRO
==============================================================================*/
==============================================================================*/
...
@@ -151,6 +160,29 @@ void * fmpi_futhark_new_data(
...
@@ -151,6 +160,29 @@ void * fmpi_futhark_new_data(
const
size_t
idx
=
FMPI_PRIV_FUTHARK_FUNC_IDX
(
dim_cnt
,
type
);
const
size_t
idx
=
FMPI_PRIV_FUTHARK_FUNC_IDX
(
dim_cnt
,
type
);
return
fmpi_futhark_new_data_func_list
[
idx
](
ctx
,
data
,
x
,
y
,
z
);
return
fmpi_futhark_new_data_func_list
[
idx
](
ctx
,
data
,
x
,
y
,
z
);
}
}
/*------------------------------------------------------------------------------
fmpi_futhark_get_data()
------------------------------------------------------------------------------*/
void
*
fmpi_futhark_get_data_sync
(
const
struct
fmpi_futhark_ctx
*
const
ctx
,
void
*
const
in
,
void
*
const
out
,
const
enum
fmpi_type_base
type
,
const
size_t
dim_cnt
){
assert
(
ctx
!=
NULL
);
assert
(
in
!=
NULL
);
assert
(
out
!=
NULL
);
assert
(
dim_cnt
<=
FMPI_DIM_MAX
);
const
size_t
idx
=
FMPI_PRIV_FUTHARK_FUNC_IDX
(
dim_cnt
,
type
);
const
int
err
=
fmpi_futhark_get_data_func_list
[
idx
](
ctx
,
in
,
out
);
if
(
err
!=
FUTHARK_SUCCESS
)
{
FMPI_RAISE_FUTHARK_ERROR
(
ctx
,
"futhark_values_##T##_##D##d() failed!"
);
return
NULL
;
}
fmpi_futhark_sync
(
ctx
);
if
(
fmpi_futhark_check_error
(
ctx
,
"futhark_values_##T##_##D##d"
)
==
true
)
{
return
NULL
;
}
return
out
;
}
#define FMPI_FUTHARK_DEFINITION(D, T) \
#define FMPI_FUTHARK_DEFINITION(D, T) \
void * fmpi_futhark_new_##D##d_##T( \
void * fmpi_futhark_new_##D##d_##T( \
...
@@ -178,6 +210,15 @@ void fmpi_futhark_free_##D##d_##T( \
...
@@ -178,6 +210,15 @@ void fmpi_futhark_free_##D##d_##T( \
if(err != 0) { \
if(err != 0) { \
fmpi_futhark_check_error(ctx, CPL_STRINGIFY(futhark_free_##T##_##D##d)); \
fmpi_futhark_check_error(ctx, CPL_STRINGIFY(futhark_free_##T##_##D##d)); \
} \
} \
} \
int fmpi_futhark_values_##D##d_##T( \
const struct fmpi_futhark_ctx * const ctx, void * const in, void * const out \
){ \
_Static_assert((D) <= FMPI_DIM_MAX, ""); \
assert(ctx != NULL); \
assert(in != NULL); \
assert(out != NULL); \
return futhark_values_##T##_##D##d(ctx->ctx, in, out); \
}
}
FMPI_DEFINE_FUNCS_DT
(
FMPI_FUTHARK_DEFINITION
,
1
,
FMPI_FUTHARK_TYPES
)
FMPI_DEFINE_FUNCS_DT
(
FMPI_FUTHARK_DEFINITION
,
1
,
FMPI_FUTHARK_TYPES
)
...
...
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