Skip to content
Snippets Groups Projects
Verified Commit ac643c85 authored by raphael.bach's avatar raphael.bach
Browse files

Split `fmpi_type.h` in two files

parent 34ba269a
No related branches found
No related tags found
No related merge requests found
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#include <stddef.h> // size_t #include <stddef.h> // size_t
// Internal // Internal
#include "internal/fmpi_common.h" #include "internal/fmpi_common.h"
#include "internal/fmpi_type.h"
#include "internal/generic/fmpi_data_generic.h" #include "internal/generic/fmpi_data_generic.h"
#include "internal/generic/fmpi_type.h"
/*============================================================================== /*==============================================================================
TYPE TYPE
==============================================================================*/ ==============================================================================*/
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#include <stddef.h> // size_t #include <stddef.h> // size_t
// Internal // Internal
#include "fmpi_error.h" #include "fmpi_error.h"
#include "internal/fmpi_type.h"
#include "internal/generic/fmpi_futhark_generic.h" #include "internal/generic/fmpi_futhark_generic.h"
#include "internal/generic/fmpi_type.h"
/*============================================================================== /*==============================================================================
STRUCT STRUCT
==============================================================================*/ ==============================================================================*/
......
// SPDX-License-Identifier: 0BSD
/*!
* @file
* @date 20.06.2022
* @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_TYPE_H_20220620234502
#define FMPI_TYPE_H_20220620234502
/*==============================================================================
INCLUDE
==============================================================================*/
// C Standard Library
#include <stddef.h> // size_t
// Internal
#include "internal/generic/fmpi_type_generic.h"
/*==============================================================================
TYPE
==============================================================================*/
typedef enum fmpi_type_base {
FMPI_TYPE_START = 0,
FMPI_TYPE_i8 = 0,
FMPI_TYPE_i16 = 1,
FMPI_TYPE_i32 = 2,
FMPI_TYPE_i64 = 3,
FMPI_TYPE_u8 = 4,
FMPI_TYPE_u16 = 5,
FMPI_TYPE_u32 = 6,
FMPI_TYPE_u64 = 7,
FMPI_TYPE_f32 = 8,
FMPI_TYPE_f64 = 9,
FMPI_TYPE_bool = 10,
FMI_TYPE_END
} fmpi_type_base;
/**
* Derived types
*
* - The Futhark C API passes parameters to a Futhark function differently
* depending on their type being an `arithmetic type`, a `struct type` or an
* `array type`.
* - Loosely based on the definition of derived types in C17 6.2.5
*/
typedef enum fmpi_type_derived {
FMPI_TYPE_NONE, //!< Arithmetic type
FMPI_TYPE_ARRAY //!< Array type
} fmpi_type_derived;
typedef struct fmpi_type {
enum fmpi_type_base base;
enum fmpi_type_derived derived;
size_t size;
} fmpi_type;
/*==============================================================================
GUARD
==============================================================================*/
#endif // FMPI_TYPE_H_20220620234502
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <stddef.h> // size_t #include <stddef.h> // size_t
// Internal // Internal
#include "fmpi_generic.h" #include "fmpi_generic.h"
#include "fmpi_type_generic.h"
/*============================================================================== /*==============================================================================
MACRO MACRO
==============================================================================*/ ==============================================================================*/
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
// Internal // Internal
#include "../fmpi_common.h" #include "../fmpi_common.h"
#include "fmpi_generic.h" #include "fmpi_generic.h"
#include "fmpi_type_generic.h"
/*============================================================================== /*==============================================================================
MACRO MACRO
==============================================================================*/ ==============================================================================*/
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#include "../../../external/cpl/cpl_map.h" #include "../../../external/cpl/cpl_map.h"
#include "../../../external/cpl/cpl_token.h" #include "../../../external/cpl/cpl_token.h"
#include "../../../external/cpl/cpl_util.h" #include "../../../external/cpl/cpl_util.h"
// Internal
#include "fmpi_type.h"
/*============================================================================== /*==============================================================================
MACRO MACRO
==============================================================================*/ ==============================================================================*/
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <stddef.h> // size_t #include <stddef.h> // size_t
// Internal // Internal
#include "fmpi_generic.h" #include "fmpi_generic.h"
#include "fmpi_type_generic.h"
/*============================================================================== /*==============================================================================
MACRO MACRO
==============================================================================*/ ==============================================================================*/
......
...@@ -27,10 +27,9 @@ ...@@ -27,10 +27,9 @@
INCLUDE INCLUDE
==============================================================================*/ ==============================================================================*/
// C Standard Library // C Standard Library
#include <stddef.h> // size_t
#include <stdint.h> #include <stdint.h>
/*============================================================================== /*==============================================================================
TYPEDEF TYPE
==============================================================================*/ ==============================================================================*/
// Match C type name with Futhark type name // Match C type name with Futhark type name
typedef int8_t i8; typedef int8_t i8;
...@@ -44,44 +43,6 @@ typedef uint64_t u64; ...@@ -44,44 +43,6 @@ typedef uint64_t u64;
typedef float f32; typedef float f32;
typedef double f64; typedef double f64;
typedef _Bool bool; typedef _Bool bool;
/*==============================================================================
ENUM
==============================================================================*/
typedef enum fmpi_type_base {
FMPI_TYPE_START = 0,
FMPI_TYPE_i8 = 0,
FMPI_TYPE_i16 = 1,
FMPI_TYPE_i32 = 2,
FMPI_TYPE_i64 = 3,
FMPI_TYPE_u8 = 4,
FMPI_TYPE_u16 = 5,
FMPI_TYPE_u32 = 6,
FMPI_TYPE_u64 = 7,
FMPI_TYPE_f32 = 8,
FMPI_TYPE_f64 = 9,
FMPI_TYPE_bool = 10,
FMI_TYPE_END
} fmpi_type_base;
/**
* Derived types
*
* - The Futhark C API passes parameters to a Futhark function differently
* depending on their type being an `arithmetic type`, a `struct type` or an
* `array type`.
* - Loosely based on the definition of derived types in C17 6.2.5
*/
typedef enum fmpi_type_derived {
FMPI_TYPE_NONE, //!< Arithmetic type
FMPI_TYPE_ARRAY //!< Array type
} fmpi_type_derived;
/*==============================================================================
STRUCT
==============================================================================*/
typedef struct fmpi_type {
enum fmpi_type_base base;
enum fmpi_type_derived derived;
size_t size;
} fmpi_type;
/*============================================================================== /*==============================================================================
DEFINE DEFINE
==============================================================================*/ ==============================================================================*/
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// Internal // Internal
#include "internal/fmpi_common.h" #include "internal/fmpi_common.h"
#include "internal/fmpi_ctx.h" #include "internal/fmpi_ctx.h"
#include "internal/generic/fmpi_type.h" #include "internal/fmpi_type.h"
/*============================================================================== /*==============================================================================
PUBLIC FUNCTION DEFINITION PUBLIC FUNCTION DEFINITION
==============================================================================*/ ==============================================================================*/
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
// Internal // Internal
#include "internal/fmpi_common.h" #include "internal/fmpi_common.h"
#include "internal/fmpi_futhark_entry.h" #include "internal/fmpi_futhark_entry.h"
#include "internal/fmpi_type.h"
#include "internal/generic/fmpi_generic.h" #include "internal/generic/fmpi_generic.h"
/*============================================================================== /*==============================================================================
STATIC STATIC
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "internal/fmpi_futhark_entry.h" #include "internal/fmpi_futhark_entry.h"
#include "internal/fmpi_mpi.h" #include "internal/fmpi_mpi.h"
#include "internal/generic/fmpi_generic.h" #include "internal/generic/fmpi_generic.h"
#include "internal/generic/fmpi_type_generic.h"
/*============================================================================== /*==============================================================================
PUBLIC FUNCTION DEFINITION PUBLIC FUNCTION DEFINITION
==============================================================================*/ ==============================================================================*/
......
...@@ -60,6 +60,7 @@ struct fmpi_task fmpi_task_register( ...@@ -60,6 +60,7 @@ struct fmpi_task fmpi_task_register(
if(task.domains[i].parts == NULL) { if(task.domains[i].parts == NULL) {
FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_new_domain() failed!"); FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_new_domain() failed!");
continue; continue;
struct fmpi_type t;
} }
void * start = fmpi_futhark_new_data( void * start = fmpi_futhark_new_data(
ctx->fut, task.domains[i].parts[rank].start, task.domains[i].data.type.base, ctx->fut, task.domains[i].parts[rank].start, task.domains[i].data.type.base,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment