From 3f741ad358d5a102d71a04ecf27e1413d7d9ebdf Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Thu, 30 Mar 2023 14:32:25 +0200 Subject: [PATCH] sonarqube: keep cleaning code smells hip: replace deprecated hipMallocHost by hipHostMalloc --- control/control.c | 34 ++++++++++++---------- include/chameleon/struct.h | 2 +- runtime/starpu/control/runtime_tags.c | 15 +--------- runtime/starpu/control/runtime_workspace.c | 6 ++-- 4 files changed, 23 insertions(+), 34 deletions(-) diff --git a/control/control.c b/control/control.c index af8de2390..62762469f 100644 --- a/control/control.c +++ b/control/control.c @@ -94,22 +94,24 @@ int __chameleon_initpar(int ncpus, int ngpus, int nthreads_per_worker) chamctxt->mpi_outer_init = 1; # else { - int flag = 0, provided = 0; - MPI_Initialized( &flag ); - chamctxt->mpi_outer_init = flag; - if ( !flag ) { - /* MPI_THREAD_SERIALIZED should be enough. - * In testings, only StarPU's internal thread performs - * communications, and *then* Chameleon performs communications in - * the check step. */ - const int required = MPI_THREAD_MULTIPLE; - if ( MPI_Init_thread( NULL, NULL, required, &provided ) != MPI_SUCCESS) { - chameleon_fatal_error("CHAMELEON_Init", "MPI_Init_thread() failed"); - } - if ( provided < required ) { - chameleon_fatal_error("CHAMELEON_Init", "MPI_Init_thread() was not able to provide the requested thread support (MPI_THREAD_MULTIPLE), this may be an issue if the level provided is not enough for the underlying runtime system."); - } - } + int flag = 0, provided = 0; + MPI_Initialized( &flag ); + chamctxt->mpi_outer_init = flag; + if ( !flag ) { + /* MPI_THREAD_SERIALIZED should be enough. + * In testings, only StarPU's internal thread performs + * communications, and *then* Chameleon performs communications in + * the check step. */ + const int required = MPI_THREAD_MULTIPLE; + if ( MPI_Init_thread( NULL, NULL, required, &provided ) != MPI_SUCCESS) { + chameleon_fatal_error("CHAMELEON_Init", "MPI_Init_thread() failed"); + } + if ( provided < required ) { + chameleon_fatal_error("CHAMELEON_Init", + "MPI_Init_thread() was not able to provide the requested thread support (MPI_THREAD_MULTIPLE),\n" + "this may be an issue if the level provided is not enough for the underlying runtime system." ); + } + } } # endif #endif diff --git a/include/chameleon/struct.h b/include/chameleon/struct.h index 289f4cad9..a6175854e 100644 --- a/include/chameleon/struct.h +++ b/include/chameleon/struct.h @@ -121,7 +121,7 @@ struct chameleon_desc_s { int register_mat; // 1 if we have to register mat - else 0 (handled by the application) int myrank; // MPI rank of the descriptor int ooc; // 1 if the matrix is not to fit in memory - int64_t mpitag; // First MPI tag used by the decriptor + int64_t mpitag; // First MPI tag used by the descriptor void *schedopt; // scheduler (QUARK|StarPU) specific structure }; diff --git a/runtime/starpu/control/runtime_tags.c b/runtime/starpu/control/runtime_tags.c index 3f10ddbc9..80705fc44 100644 --- a/runtime/starpu/control/runtime_tags.c +++ b/runtime/starpu/control/runtime_tags.c @@ -49,12 +49,8 @@ static int64_t starpu_tag_ub = 0; * * @brief Initialize the StarPU tags manager. * - ******************************************************************************* - * - * @retval TODO - * ******************************************************************************/ -int +void chameleon_starpu_tag_init( void ) { if (!starpu_tag_ub) { @@ -67,11 +63,6 @@ chameleon_starpu_tag_init( void ) if ( !ok ) { chameleon_error("chameleon_starpu_tag_init", "MPI_TAG_UB not known by StarPU\n"); } - - return CHAMELEON_SUCCESS; - } - else { - return CHAMELEON_ERR_REINITIALIZED; } } @@ -216,10 +207,6 @@ chameleon_starpu_tag_release( int64_t min ) * * @brief Initialize the StarPU tags manager. * - ******************************************************************************* - * - * @retval TODO - * ******************************************************************************/ void chameleon_starpu_tag_init( ) { diff --git a/runtime/starpu/control/runtime_workspace.c b/runtime/starpu/control/runtime_workspace.c index ad9b5cd9f..bbbb5710e 100644 --- a/runtime/starpu/control/runtime_workspace.c +++ b/runtime/starpu/control/runtime_workspace.c @@ -23,15 +23,15 @@ #if defined(CHAMELEON_USE_CUDA) #define GPU_WORKER_TYPE STARPU_CUDA_WORKER -#define gpuMallocHost cudaMallocHost +#define gpuMallocHost( _ptr_, _size_ ) cudaMallocHost( (_ptr_), (_size_) ) #define gpuMalloc cudaMalloc #define gpuFreeHost cudaFreeHost #define gpuFree cudaFree #elif defined(CHAMELEON_USE_HIP) #define GPU_WORKER_TYPE STARPU_HIP_WORKER -#define gpuMallocHost hipMallocHost +#define gpuMallocHost( _ptr_, _size_ ) hipHostMalloc( (_ptr_), (_size_), 0 ) #define gpuMalloc hipMalloc -#define gpuFreeHost hipFreeHost +#define gpuFreeHost hipHostFree #define gpuFree hipFree #endif -- GitLab