diff --git a/control/control.c b/control/control.c index af8de2390d25bac1285d290e726a044b559e6aa4..62762469f26f788eb215811a663355b0489ef616 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 289f4cad9c32e4602b1beda5503aa60ac72725ad..a6175854e0a3dcdf4841e2d5a482d2856ef2bfb2 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 3030d12c5a346dc9cdcebe5f95445b5fa6b2082e..80705fc44f037c2bd094ea048aabe48add557612 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; } } @@ -179,6 +170,15 @@ chameleon_starpu_tag_release( int64_t min ) current = current->next; } + if ( current == NULL ) { +#if defined(CHAMELEON_DEBUG_STARPU) + fprintf( stderr, "chameleon_starpu_tag: FAILED to release [%ld,...] no set registered with this min value\n", + min ); +#endif + + return; + } + assert( current != NULL ); assert( current->min == min ); @@ -207,12 +207,8 @@ chameleon_starpu_tag_release( int64_t min ) * * @brief Initialize the StarPU tags manager. * - ******************************************************************************* - * - * @retval TODO - * ******************************************************************************/ -int +void chameleon_starpu_tag_init( ) { return CHAMELEON_SUCCESS; } diff --git a/runtime/starpu/control/runtime_workspace.c b/runtime/starpu/control/runtime_workspace.c index ad9b5cd9fd0d0abb8f7760b9a66c0936473f1281..bbbb5710e162a82f69a6e1c65aa2dde706688e84 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 diff --git a/runtime/starpu/include/chameleon_starpu.h.in b/runtime/starpu/include/chameleon_starpu.h.in index d967fac54efab35815205367f4b65fe082b48366..f98a29b177a5febd622385ca75c59a467a7fe5db 100644 --- a/runtime/starpu/include/chameleon_starpu.h.in +++ b/runtime/starpu/include/chameleon_starpu.h.in @@ -152,7 +152,7 @@ typedef struct starpu_option_request_s { /** * MPI tag management */ -int chameleon_starpu_tag_init( ); +void chameleon_starpu_tag_init( ); int64_t chameleon_starpu_tag_book( int64_t nbtags ); void chameleon_starpu_tag_release( int64_t min ); diff --git a/testing/parameters.c b/testing/parameters.c index 8f6e1f4adb390c137411f0abf2222685b56b2415..f8b936946e77cc610b90adbb88fc34fdc76bc25a 100644 --- a/testing/parameters.c +++ b/testing/parameters.c @@ -305,7 +305,13 @@ void parameters_read( parameter_t *param, const char *values ) { - int range = (values != NULL) && ( strchr( values, ':' ) != NULL ); + int range; + + if ( values == NULL ) { + fprintf( stderr, "Error passing NULL parameter to read\n" ); + exit(EXIT_FAILURE); + } + range = (values != NULL) && ( strchr( values, ':' ) != NULL ); /* If we have a ranged of integer values */ if ( range ) diff --git a/testing/testing_zgesvd.c b/testing/testing_zgesvd.c index 6c1509e3ae73c65560567b0e6106b55a94971856..14564be3eb446f01a8e3b9983b4d2ac0fae5b1a7 100644 --- a/testing/testing_zgesvd.c +++ b/testing/testing_zgesvd.c @@ -239,8 +239,8 @@ testing_zgesvd_std( run_arg_list_t *args, int check ) if ( hres != 0 ) { free( D ); free( S ); - if ( U ) { free( U ); } - if ( Vt ) { free( Vt ); } + free( U ); + free( Vt ); return hres; } /* @@ -269,8 +269,8 @@ testing_zgesvd_std( run_arg_list_t *args, int check ) free( A ); free( D ); free( S ); - if ( U ) { free( U ); } - if ( Vt ) { free( Vt ); } + free( U ); + free( Vt ); CHAMELEON_Desc_Destroy( &descT ); return hres; diff --git a/testing/testing_zunglq.c b/testing/testing_zunglq.c index 63bc4daeed11fbaa3c2a551af9f5588d4d30876e..7b140ef8ef9901f406652d84773a4746a5bdb779 100644 --- a/testing/testing_zunglq.c +++ b/testing/testing_zunglq.c @@ -81,9 +81,9 @@ testing_zunglq_desc( run_arg_list_t *args, int check ) CHAMELEON_zplrnt_Tile( descA, seedA ); hres = CHAMELEON_zgelqf_Tile( descA, descT ); if ( hres != CHAMELEON_SUCCESS ) { - CHAMELEON_Desc_Flush( descA, test_data.sequence ); - CHAMELEON_Desc_Flush( descT, test_data.sequence ); - CHAMELEON_Desc_Flush( descQ, test_data.sequence ); + CHAMELEON_Desc_Destroy( &descA ); + CHAMELEON_Desc_Destroy( &descT ); + CHAMELEON_Desc_Destroy( &descQ ); return hres; } @@ -171,6 +171,12 @@ testing_zunglq_std( run_arg_list_t *args, int check ) /* Fills the matrix with random values */ CHAMELEON_zplrnt( K, N, A, LDA, seedA ); hres = CHAMELEON_zgelqf( K, N, A, LDA, descT ); + if ( hres != CHAMELEON_SUCCESS ) { + free( A ); + free( Qlap ); + CHAMELEON_Desc_Destroy( &descT ); + return hres; + } /* Calculates the solution */ testing_start( &test_data ); diff --git a/testing/testing_zunglq_hqr.c b/testing/testing_zunglq_hqr.c index 63f922a7eaf4c6201287d7df1b7e8201b9cb7316..e0d74d5230c49f5a4a71316600b0083eb8bf6ab5 100644 --- a/testing/testing_zunglq_hqr.c +++ b/testing/testing_zunglq_hqr.c @@ -88,10 +88,11 @@ testing_zunglq_hqr_desc( run_arg_list_t *args, int check ) CHAMELEON_zplrnt_Tile( descA, seedA ); hres = CHAMELEON_zgelqf_param_Tile( &qrtree, descA, descTS, descTT ); if ( hres != CHAMELEON_SUCCESS ) { - CHAMELEON_Desc_Flush( descA, test_data.sequence ); - CHAMELEON_Desc_Flush( descTS, test_data.sequence ); - CHAMELEON_Desc_Flush( descTT, test_data.sequence ); - CHAMELEON_Desc_Flush( descQ, test_data.sequence ); + CHAMELEON_Desc_Destroy( &descA ); + CHAMELEON_Desc_Destroy( &descTS ); + CHAMELEON_Desc_Destroy( &descTT ); + CHAMELEON_Desc_Destroy( &descQ ); + libhqr_finalize( &qrtree ); return hres; } @@ -189,6 +190,14 @@ testing_zunglq_hqr_std( run_arg_list_t *args, int check ) /* Fills the matrix with random values */ CHAMELEON_zplrnt( K, N, A, LDA, seedA ); hres = CHAMELEON_zgelqf_param( &qrtree, K, N, A, LDA, descTS, descTT ); + if ( hres != CHAMELEON_SUCCESS ) { + free( A ); + free( Qlap ); + CHAMELEON_Desc_Destroy( &descTS ); + CHAMELEON_Desc_Destroy( &descTT ); + libhqr_finalize( &qrtree ); + return hres; + } /* Calculates the solution */ testing_start( &test_data ); diff --git a/testing/testing_zungqr.c b/testing/testing_zungqr.c index 1a719e929650901f75eafad5efa63fa136f8587f..a617589257311efeb5c1d0f0ce2a11ddd95e40ed 100644 --- a/testing/testing_zungqr.c +++ b/testing/testing_zungqr.c @@ -81,9 +81,9 @@ testing_zungqr_desc( run_arg_list_t *args, int check ) CHAMELEON_zplrnt_Tile( descA, seedA ); hres = CHAMELEON_zgeqrf_Tile( descA, descT ); if ( hres != CHAMELEON_SUCCESS ) { - CHAMELEON_Desc_Flush( descA, test_data.sequence ); - CHAMELEON_Desc_Flush( descT, test_data.sequence ); - CHAMELEON_Desc_Flush( descQ, test_data.sequence ); + CHAMELEON_Desc_Destroy( &descA ); + CHAMELEON_Desc_Destroy( &descT ); + CHAMELEON_Desc_Destroy( &descQ ); return hres; } @@ -171,6 +171,12 @@ testing_zungqr_std( run_arg_list_t *args, int check ) /* Fills the matrix with random values */ CHAMELEON_zplrnt( M, K, A, LDA, seedA ); hres = CHAMELEON_zgeqrf( M, K, A, LDA, descT ); + if ( hres != CHAMELEON_SUCCESS ) { + free( A ); + free( Qlap ); + CHAMELEON_Desc_Destroy( &descT ); + return hres; + } /* Calculates the solution */ testing_start( &test_data ); diff --git a/testing/testing_zungqr_hqr.c b/testing/testing_zungqr_hqr.c index e8f26af0596fb8f26710c28a166cba1b82a67101..ae96c2def57b0eb20e4815f71bb6ddff8d044dcd 100644 --- a/testing/testing_zungqr_hqr.c +++ b/testing/testing_zungqr_hqr.c @@ -88,10 +88,11 @@ testing_zungqr_hqr_desc( run_arg_list_t *args, int check ) CHAMELEON_zplrnt_Tile( descA, seedA ); hres = CHAMELEON_zgeqrf_param_Tile( &qrtree, descA, descTS, descTT ); if ( hres != CHAMELEON_SUCCESS ) { - CHAMELEON_Desc_Flush( descA, test_data.sequence ); - CHAMELEON_Desc_Flush( descTS, test_data.sequence ); - CHAMELEON_Desc_Flush( descTT, test_data.sequence ); - CHAMELEON_Desc_Flush( descQ, test_data.sequence ); + CHAMELEON_Desc_Destroy( &descA ); + CHAMELEON_Desc_Destroy( &descTS ); + CHAMELEON_Desc_Destroy( &descTT ); + CHAMELEON_Desc_Destroy( &descQ ); + libhqr_finalize( &qrtree ); return hres; } @@ -189,6 +190,14 @@ testing_zungqr_hqr_std( run_arg_list_t *args, int check ) /* Fills the matrix with random values */ CHAMELEON_zplrnt( M, K, A, LDA, seedA ); hres = CHAMELEON_zgeqrf_param( &qrtree, M, K, A, LDA, descTS, descTT ); + if ( hres != CHAMELEON_SUCCESS ) { + free( A ); + free( Qlap ); + CHAMELEON_Desc_Destroy( &descTS ); + CHAMELEON_Desc_Destroy( &descTT ); + libhqr_finalize( &qrtree ); + return hres; + } /* Calculates the solution */ testing_start( &test_data ); diff --git a/tools/find_sources.sh b/tools/find_sources.sh index c37572683d59dcf4349ef5a53e0e3db3cea868ed..94a46a0e1653f5b585eb9adfbbfdcf0ee7d02686 100755 --- a/tools/find_sources.sh +++ b/tools/find_sources.sh @@ -37,6 +37,9 @@ do sed -i "\:^$file.*:d" filelist.txt done +# Remove fortran header file that is incorrectly parsed as a C file +sed -i '/fortran\.h/d' filelist.txt + # Remove external header files for file in coreblas/include/coreblas/cblas.h coreblas/include/coreblas/lapacke.h coreblas/include/coreblas/lapacke_config.h coreblas/include/coreblas/lapacke_mangling.h do