diff --git a/runtime/starpu/control/runtime_descriptor.c b/runtime/starpu/control/runtime_descriptor.c index ee4817fe4cc35abf5a73baffad8b224fcf79452a..2ed4ba05a14db73dc624e812b14ad36e6769d70d 100644 --- a/runtime/starpu/control/runtime_descriptor.c +++ b/runtime/starpu/control/runtime_descriptor.c @@ -20,26 +20,11 @@ * @author Raphael Boucherie * @author Samuel Thibault * @author Loris Lucido - * @date 2023-07-06 + * @date 2023-08-22 * */ #include "chameleon_starpu.h" -/** - * Set the tag sizes - */ -#if defined(CHAMELEON_USE_MPI) - -#ifndef HAVE_STARPU_MPI_DATA_REGISTER -#define starpu_mpi_data_register( handle_, tag_, owner_ ) \ - do { \ - starpu_data_set_rank( (handle_), (owner_) ); \ - starpu_data_set_tag( (handle_), (tag_) ); \ - } while(0) -#endif - -#endif - /** * Malloc/Free of the data */ @@ -289,42 +274,6 @@ void RUNTIME_flush() #endif } -/** - * Different implementations of the flush call based on StarPU version - */ -#if defined(HAVE_STARPU_DATA_WONT_USE) - -static inline void -chameleon_starpu_data_wont_use( starpu_data_handle_t handle ) { - starpu_data_wont_use( handle ); -} - -#elif defined(HAVE_STARPU_IDLE_PREFETCH) - -static inline void -chameleon_starpu_data_flush( void *_handle) -{ - starpu_data_handle_t handle = (starpu_data_handle_t)_handle; - starpu_data_idle_prefetch_on_node(handle, STARPU_MAIN_RAM, 1); - starpu_data_release_on_node(handle, -1); -} - -static inline void -chameleon_starpu_data_wont_use( starpu_data_handle_t handle ) { - starpu_data_acquire_on_node_cb( handle, -1, STARPU_R, - chameleon_starpu_data_flush, handle ); -} - -#else - -static inline void -chameleon_starpu_data_wont_use( starpu_data_handle_t handle ) { - starpu_data_acquire_cb( handle, STARPU_R, - (void (*)(void*))&starpu_data_release, handle ); -} - -#endif - void RUNTIME_desc_flush( const CHAM_desc_t *desc, const RUNTIME_sequence_t *sequence ) { diff --git a/runtime/starpu/include/chameleon_starpu.h.in b/runtime/starpu/include/chameleon_starpu.h.in index 8d421ddbb5234d073ba9ea71b3c97ff3046ff9fc..407f1bb78cac287b866ca2dc3d8acb4aa37e5126 100644 --- a/runtime/starpu/include/chameleon_starpu.h.in +++ b/runtime/starpu/include/chameleon_starpu.h.in @@ -19,7 +19,7 @@ * @author Samuel Thibault * @author Loris Lucido * @author Terry Cojean - * @date 2023-07-06 + * @date 2023-08-22 * */ #ifndef _chameleon_starpu_h_ @@ -166,6 +166,9 @@ void chameleon_starpu_tag_release( int64_t min ); void RUNTIME_set_reduction_methods(starpu_data_handle_t handle, cham_flttype_t dtyp); +#include "runtime_mpi.h" +#include "runtime_wontuse.h" + #if defined(CHAMELEON_USE_MPI) && defined(HAVE_STARPU_MPI_CACHED_RECEIVE) static inline int chameleon_starpu_data_iscached(const CHAM_desc_t *A, int m, int n) diff --git a/runtime/starpu/include/runtime_mpi.h b/runtime/starpu/include/runtime_mpi.h new file mode 100644 index 0000000000000000000000000000000000000000..6d307bc6ae597ec075caf05c7dcbd382a16c4043 --- /dev/null +++ b/runtime/starpu/include/runtime_mpi.h @@ -0,0 +1,41 @@ +/** + * + * @file starpu/runtime_mpi.h + * + * @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + * Univ. Bordeaux. All rights reserved. + * + *** + * + * @brief Chameleon StarPU mpi function implementation + * + * @version 1.3.0 + * @author Mathieu Faverge + * @date 2023-08-22 + * + */ +#ifndef _runtime_mpi_h_ +#define _runtime_mpi_h_ + +/** + * Set the tag sizes + */ +#if defined(CHAMELEON_USE_MPI) + +#if !defined(HAVE_STARPU_MPI_DATA_REGISTER) +static inline starpu_mpi_data_register( starpu_data_handle_t handle, int64_t tag, int owner ) +{ + starpu_data_set_rank( handle, owner ); + starpu_data_set_tag( handle, tag ); +} +#endif + +#else + +static inline starpu_mpi_data_register( starpu_data_handle_t, int64_t, int ) +{ +} + +#endif + +#endif /* _runtime_mpi_h_ */ diff --git a/runtime/starpu/include/runtime_wontuse.h b/runtime/starpu/include/runtime_wontuse.h new file mode 100644 index 0000000000000000000000000000000000000000..c5b1526d84156cbb004aa39fe114a8e395f6b32d --- /dev/null +++ b/runtime/starpu/include/runtime_wontuse.h @@ -0,0 +1,57 @@ +/** + * + * @file starpu/runtime_wontuse.h + * + * @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + * Univ. Bordeaux. All rights reserved. + * + *** + * + * @brief Chameleon StarPU wont use implementations to flush pieces of data + * + * @version 1.3.0 + * @author Mathieu Faverge + * @date 2023-08-22 + * + */ +#ifndef _runtime_wontuse_h_ +#define _runtime_wontuse_h_ + +#include "chameleon_starpu.h" + +/** + * Different implementations of the flush call based on StarPU version + */ +#if defined(HAVE_STARPU_DATA_WONT_USE) + +static inline void +chameleon_starpu_data_wont_use( starpu_data_handle_t handle ) { + starpu_data_wont_use( handle ); +} + +#elif defined(HAVE_STARPU_IDLE_PREFETCH) + +static inline void +chameleon_starpu_data_flush( void *_handle) +{ + starpu_data_handle_t handle = (starpu_data_handle_t)_handle; + starpu_data_idle_prefetch_on_node( handle, STARPU_MAIN_RAM, 1 ); + starpu_data_release_on_node( handle, -1 ); +} + +static inline void +chameleon_starpu_data_wont_use( starpu_data_handle_t handle ) { + starpu_data_acquire_on_node_cb( handle, -1, STARPU_R, + chameleon_starpu_data_flush, handle ); +} + +#else + +static inline void +chameleon_starpu_data_wont_use( starpu_data_handle_t handle ) { + starpu_data_acquire_cb( handle, STARPU_R, + (void (*)(void*))&starpu_data_release, handle ); +} + +#endif +#endif /* _runtime_wontuse_h_ */