Commit 5dc364ef authored by Mathieu Faverge's avatar Mathieu Faverge

Merge branch 'feature-openmp' into 'master'

Add OpenMP support for shared memory systems

See merge request solverstack/chameleon!108
parents 1f74f316 195a1bf8
...@@ -93,6 +93,18 @@ build_parsec: ...@@ -93,6 +93,18 @@ build_parsec:
BUILD_OPTIONS: "-DCHAMELEON_SCHED=PARSEC" BUILD_OPTIONS: "-DCHAMELEON_SCHED=PARSEC"
VERSION: parsec VERSION: parsec
build_openmp:
<<: *build_script
artifacts:
name: build_openmp
expire_in: 48 hours
paths:
- build
- chameleon_openmp.log
variables:
BUILD_OPTIONS: "-DCHAMELEON_SCHED=OPENMP"
VERSION: openmp
test_starpu_branches: test_starpu_branches:
<<: *test_script <<: *test_script
variables: variables:
...@@ -239,6 +251,42 @@ test_parsec_master: ...@@ -239,6 +251,42 @@ test_parsec_master:
only: only:
- master@solverstack/chameleon - master@solverstack/chameleon
test_openmp_branches:
<<: *test_script
variables:
TESTS_RESTRICTION: "-R \"test_shm_s|test_mpi_s\""
VERSION: openmp
dependencies:
- build_openmp
artifacts:
name: test_openmp
expire_in: 48 hours
paths:
- build
- chameleon_openmp.log
- chameleon_openmp.lcov
only:
- branches
except:
- master
test_openmp_master:
<<: *test_script
variables:
TESTS_RESTRICTION: "-R \"_shm_|_mpi_\""
VERSION: openmp
dependencies:
- build_openmp
artifacts:
name: test_openmp
expire_in: 48 hours
paths:
- build
- chameleon_openmp.log
- chameleon_openmp.lcov
only:
- master@solverstack/chameleon
coverage: coverage:
stage: analyse stage: analyse
dependencies: dependencies:
...@@ -246,11 +294,13 @@ coverage: ...@@ -246,11 +294,13 @@ coverage:
- test_starpu_simgrid_branches - test_starpu_simgrid_branches
- test_quark_branches - test_quark_branches
- test_parsec_branches - test_parsec_branches
- test_openmp_branches
script: script:
- lcov -a chameleon_starpu.lcov - lcov -a chameleon_starpu.lcov
-a chameleon_starpu_simgrid.lcov -a chameleon_starpu_simgrid.lcov
-a chameleon_quark.lcov -a chameleon_quark.lcov
-a chameleon_parsec.lcov -a chameleon_parsec.lcov
-a chameleon_openmp.lcov
-o chameleon.lcov -o chameleon.lcov
- lcov --summary chameleon.lcov - lcov --summary chameleon.lcov
only: only:
...@@ -289,6 +339,7 @@ sonarqube: ...@@ -289,6 +339,7 @@ sonarqube:
- test_starpu_simgrid_master - test_starpu_simgrid_master
- test_quark_master - test_quark_master
- test_parsec_master - test_parsec_master
- test_openmp_master
artifacts: artifacts:
name: chameleon_analysis name: chameleon_analysis
expire_in: 1 week expire_in: 1 week
......
...@@ -108,7 +108,7 @@ option(CHAMELEON_USE_MIGRATE ...@@ -108,7 +108,7 @@ option(CHAMELEON_USE_MIGRATE
# ----------------------------- # -----------------------------
# Create a list of possible runtime # Create a list of possible runtime
set(CHAMELEON_SCHED_list PARSEC STARPU QUARK set(CHAMELEON_SCHED_list PARSEC STARPU QUARK OPENMP
CACHE INTERNAL "List of available runtimes" ) CACHE INTERNAL "List of available runtimes" )
set( CHAMELEON_SCHED_PARSEC OFF CACHE INTERNAL set( CHAMELEON_SCHED_PARSEC OFF CACHE INTERNAL
...@@ -120,6 +120,9 @@ set(CHAMELEON_SCHED_STARPU OFF CACHE INTERNAL ...@@ -120,6 +120,9 @@ set(CHAMELEON_SCHED_STARPU OFF CACHE INTERNAL
set(CHAMELEON_SCHED_QUARK OFF CACHE INTERNAL set(CHAMELEON_SCHED_QUARK OFF CACHE INTERNAL
"Enable Quark scheduler as the default runtime "Enable Quark scheduler as the default runtime
(Conflict with other CHAMELEON_SCHED_* options)") (Conflict with other CHAMELEON_SCHED_* options)")
set(CHAMELEON_SCHED_OPENMP OFF CACHE INTERNAL
"Enable OpenMP scheduler as the default runtime
(Conflict with other CHAMELEON_SCHED_* options)")
set( CHAMELEON_SCHED STARPU set( CHAMELEON_SCHED STARPU
CACHE STRING "Choose the chameleon internal runtime from ${CHAMELEON_SCHED_list}") CACHE STRING "Choose the chameleon internal runtime from ${CHAMELEON_SCHED_list}")
...@@ -892,6 +895,22 @@ if( CHAMELEON_SCHED_QUARK ) ...@@ -892,6 +895,22 @@ if( CHAMELEON_SCHED_QUARK )
endif() endif()
if( CHAMELEON_SCHED_OPENMP )
find_package(OpenMP REQUIRED)
if ( OPENMP_FOUND )
message("-- ${Blue}Add definition CHAMELEON_SCHED_OPENMP"
" - Activate OpenMP in Chameleon${ColourReset}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}")
# TODO: check for compiler support for "_Pragma"
else ( OPENMP_FOUND )
message(FATAL_ERROR "Something went wrong when finding OpenMP")
endif ( OPENMP_FOUND )
endif( CHAMELEON_SCHED_OPENMP )
# getopt # getopt
check_include_files(getopt.h CHAMELEON_HAVE_GETOPT_H) check_include_files(getopt.h CHAMELEON_HAVE_GETOPT_H)
if (CHAMELEON_HAVE_GETOPT_H) if (CHAMELEON_HAVE_GETOPT_H)
...@@ -937,6 +956,9 @@ endif() ...@@ -937,6 +956,9 @@ endif()
if (CHAMELEON_SCHED_STARPU) if (CHAMELEON_SCHED_STARPU)
list(APPEND CHAMELEON_LIBRARIES chameleon_starpu) list(APPEND CHAMELEON_LIBRARIES chameleon_starpu)
endif() endif()
if (CHAMELEON_SCHED_OPENMP)
list(APPEND CHAMELEON_LIBRARIES chameleon_openmp)
endif()
list(APPEND CHAMELEON_LIBRARIES hqr) list(APPEND CHAMELEON_LIBRARIES hqr)
set(CHAMELEON_LIBRARIES_DEP ${CHAMELEON_LIBRARIES} ${CHAMELEON_DEP}) set(CHAMELEON_LIBRARIES_DEP ${CHAMELEON_LIBRARIES} ${CHAMELEON_DEP})
......
...@@ -29,7 +29,7 @@ if ( CHAMELEON_USE_CUDA ) ...@@ -29,7 +29,7 @@ if ( CHAMELEON_USE_CUDA )
set( CHAMELEON_COPY_DIAG ON ) set( CHAMELEON_COPY_DIAG ON )
else() else()
option(CHAMELEON_COPY_DIAG option(CHAMELEON_COPY_DIAG
"This options enables the duplication of the diagonal tiles in some algorithm to avoid anti-dependencies on lower/upper triangular parts (Might be useful to StarPU)" ON) "This options enables the duplication of the diagonal tiles in some algorithm to avoid anti-dependencies on lower/upper triangular parts (Might be useful to StarPU and OpenMP)" ON)
endif() endif()
if ( CHAMELEON_SCHED_QUARK ) if ( CHAMELEON_SCHED_QUARK )
...@@ -296,6 +296,8 @@ elseif(CHAMELEON_SCHED_PARSEC) ...@@ -296,6 +296,8 @@ elseif(CHAMELEON_SCHED_PARSEC)
target_link_libraries(chameleon chameleon_parsec) target_link_libraries(chameleon chameleon_parsec)
elseif(CHAMELEON_SCHED_QUARK) elseif(CHAMELEON_SCHED_QUARK)
target_link_libraries(chameleon chameleon_quark) target_link_libraries(chameleon chameleon_quark)
elseif(CHAMELEON_SCHED_OPENMP)
target_link_libraries(chameleon chameleon_openmp)
endif() endif()
if (NOT CHAMELEON_SIMULATION) if (NOT CHAMELEON_SIMULATION)
# Depends on coreblas only for set_coreblas_gemm3m_enabled() (Maybe we should change that) # Depends on coreblas only for set_coreblas_gemm3m_enabled() (Maybe we should change that)
......
...@@ -30,11 +30,11 @@ extern "C" { ...@@ -30,11 +30,11 @@ extern "C" {
/** /**
* FORTRAN API - auxiliary function prototypes * FORTRAN API - auxiliary function prototypes
*/ */
void CHAMELEON_INIT(int *CORES, int *NGPUS, int *INFO) void __CHAMELEON_INIT(int *CORES, int *NGPUS, int *INFO)
{ *INFO = CHAMELEON_Init(*CORES, *NGPUS); } { *INFO = __chameleon_init(*CORES, *NGPUS); }
void CHAMELEON_FINALIZE(int *INFO) void __CHAMELEON_FINALIZE(int *INFO)
{ *INFO = CHAMELEON_Finalize(); } { *INFO = __chameleon_finalize(); }
void CHAMELEON_ENABLE(int *lever, int *INFO) void CHAMELEON_ENABLE(int *lever, int *INFO)
{ *INFO = CHAMELEON_Enable(*lever); } { *INFO = CHAMELEON_Enable(*lever); }
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#define CHAMELEON_WS_FNAME(lcname, UCNAME) CHAMELEON_GLOBAL(chameleon_alloc_workspace_##lcname, CHAMELEON_ALLOC_WORKSPACE_##UCNAME) #define CHAMELEON_WS_FNAME(lcname, UCNAME) CHAMELEON_GLOBAL(chameleon_alloc_workspace_##lcname, CHAMELEON_ALLOC_WORKSPACE_##UCNAME)
#define CHAMELEON_WST_FNAME(lcname, UCNAME) CHAMELEON_GLOBAL(chameleon_alloc_workspace_##lcname##_tile, CHAMELEON_ALLOC_WORKSPACE_##UCNAME##_TILE) #define CHAMELEON_WST_FNAME(lcname, UCNAME) CHAMELEON_GLOBAL(chameleon_alloc_workspace_##lcname##_tile, CHAMELEON_ALLOC_WORKSPACE_##UCNAME##_TILE)
#define CHAMELEON_INIT CHAMELEON_GLOBAL(chameleon_init, CHAMELEON_INIT) #define __CHAMELEON_INIT CHAMELEON_GLOBAL(__chameleon_init, __CHAMELEON_INIT)
#define CHAMELEON_FINALIZE CHAMELEON_GLOBAL(chameleon_finalize, CHAMELEON_FINALIZE) #define __CHAMELEON_FINALIZE CHAMELEON_GLOBAL(__chameleon_finalize, __CHAMELEON_FINALIZE)
#define CHAMELEON_ENABLE CHAMELEON_GLOBAL(chameleon_enable, CHAMELEON_ENABLE) #define CHAMELEON_ENABLE CHAMELEON_GLOBAL(chameleon_enable, CHAMELEON_ENABLE)
#define CHAMELEON_DISABLE CHAMELEON_GLOBAL(chameleon_disable, CHAMELEON_DISABLE) #define CHAMELEON_DISABLE CHAMELEON_GLOBAL(chameleon_disable, CHAMELEON_DISABLE)
#define CHAMELEON_SET CHAMELEON_GLOBAL(chameleon_set, CHAMELEON_SET) #define CHAMELEON_SET CHAMELEON_GLOBAL(chameleon_set, CHAMELEON_SET)
...@@ -46,4 +46,20 @@ ...@@ -46,4 +46,20 @@
#define CHAMELEON_LAPACK_TO_TILE CHAMELEON_GLOBAL(chameleon_lapack_to_tile, CHAMELEON_LAPACK_TO_TILE) #define CHAMELEON_LAPACK_TO_TILE CHAMELEON_GLOBAL(chameleon_lapack_to_tile, CHAMELEON_LAPACK_TO_TILE)
#define CHAMELEON_TILE_TO_LAPACK CHAMELEON_GLOBAL(chameleon_tile_to_lapack, CHAMELEON_TILE_TO_LAPACK) #define CHAMELEON_TILE_TO_LAPACK CHAMELEON_GLOBAL(chameleon_tile_to_lapack, CHAMELEON_TILE_TO_LAPACK)
#if defined(CHAMELEON_SCHED_OPENMP)
#define CHAMELEON_INIT(nworkers, ncudas)\
CALL __CHAMELEON_INIT(nworkers, ncudas)\
!$omp parallel\
!$omp master
#define CHAMELEON_FINALIZE()\
!$omp end master\
!$omp end parallel\
CALL __CHAMELEON_FINALIZE()
#else
#define CHAMELEON_INIT(nworkers, ncudas)\
CALL __CHAMELEON_INIT(nworkers, ncudas)
#define CHAMELEON_FINALIZE()\
CALL __CHAMELEON_FINALIZE()
#endif
#endif /* _chameleon_f77_h_ */ #endif /* _chameleon_f77_h_ */
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* *
* @ingroup Control * @ingroup Control
* *
* CHAMELEON_Init - Initialize CHAMELEON. * @brief Initialize CHAMELEON.
* *
****************************************************************************** ******************************************************************************
* *
...@@ -46,20 +46,19 @@ ...@@ -46,20 +46,19 @@
* *
****************************************************************************** ******************************************************************************
* *
* @return * @retval CHAMELEON_SUCCESS successful exit
* \retval CHAMELEON_SUCCESS successful exit
* *
*/ */
int CHAMELEON_Init(int cores, int gpus) int __chameleon_init(int cores, int gpus)
{ {
return CHAMELEON_InitPar(cores, gpus, -1); return __chameleon_initpar(cores, gpus, -1);
} }
/** /**
* *
* @ingroup Control * @ingroup Control
* *
* CHAMELEON_InitPar - Initialize CHAMELEON. * @brief Initialize CHAMELEON.
* *
****************************************************************************** ******************************************************************************
* *
...@@ -74,11 +73,10 @@ int CHAMELEON_Init(int cores, int gpus) ...@@ -74,11 +73,10 @@ int CHAMELEON_Init(int cores, int gpus)
* *
****************************************************************************** ******************************************************************************
* *
* @return * @retval CHAMELEON_SUCCESS successful exit
* \retval CHAMELEON_SUCCESS successful exit
* *
*/ */
int CHAMELEON_InitPar(int ncpus, int ncudas, int nthreads_per_worker) int __chameleon_initpar(int ncpus, int ncudas, int nthreads_per_worker)
{ {
CHAM_context_t *chamctxt; CHAM_context_t *chamctxt;
...@@ -119,15 +117,14 @@ int CHAMELEON_InitPar(int ncpus, int ncudas, int nthreads_per_worker) ...@@ -119,15 +117,14 @@ int CHAMELEON_InitPar(int ncpus, int ncudas, int nthreads_per_worker)
* *
* @ingroup Control * @ingroup Control
* *
* CHAMELEON_Finalize - Finalize CHAMELEON. * @brief Finalize CHAMELEON.
* *
****************************************************************************** ******************************************************************************
* *
* @return * @retval CHAMELEON_SUCCESS successful exit
* \retval CHAMELEON_SUCCESS successful exit
* *
*/ */
int CHAMELEON_Finalize(void) int __chameleon_finalize(void)
{ {
CHAM_context_t *chamctxt = chameleon_context_self(); CHAM_context_t *chamctxt = chameleon_context_self();
if (chamctxt == NULL) { if (chamctxt == NULL) {
......
...@@ -79,9 +79,9 @@ int main(int argc, char *argv[]) { ...@@ -79,9 +79,9 @@ int main(int argc, char *argv[]) {
print_header( argv[0], iparam); print_header( argv[0], iparam);
/* Initialize CHAMELEON with main parameters */ /* Initialize CHAMELEON with main parameters */
if ( CHAMELEON_Init( NCPU, NGPU ) != CHAMELEON_SUCCESS ) { int rc = CHAMELEON_Init( NCPU, NGPU );
fprintf(stderr, "Error initializing CHAMELEON library\n"); if (rc != CHAMELEON_SUCCESS) {
return EXIT_FAILURE; goto finalize;
} }
/* /*
...@@ -170,8 +170,14 @@ int main(int argc, char *argv[]) { ...@@ -170,8 +170,14 @@ int main(int argc, char *argv[]) {
free(B); free(B);
free(X); free(X);
finalize:
/*
* Required semicolon to have at least one inst
* before the end of OpenMP block.
*/
;
/* Finalize CHAMELEON */ /* Finalize CHAMELEON */
CHAMELEON_Finalize(); CHAMELEON_Finalize();
return EXIT_SUCCESS; return rc;
} }
...@@ -74,9 +74,9 @@ int main(int argc, char *argv[]) { ...@@ -74,9 +74,9 @@ int main(int argc, char *argv[]) {
print_header( argv[0], iparam); print_header( argv[0], iparam);
/* Initialize CHAMELEON with main parameters */ /* Initialize CHAMELEON with main parameters */
if ( CHAMELEON_Init( NCPU, NGPU ) != CHAMELEON_SUCCESS ) { int rc = CHAMELEON_Init( NCPU, NGPU );
fprintf(stderr, "Error initializing CHAMELEON library\n"); if (rc != CHAMELEON_SUCCESS) {
return EXIT_FAILURE; goto finalize;
} }
/* Question chameleon to get the block (tile) size (number of columns) */ /* Question chameleon to get the block (tile) size (number of columns) */
...@@ -220,8 +220,14 @@ int main(int argc, char *argv[]) { ...@@ -220,8 +220,14 @@ int main(int argc, char *argv[]) {
CHAMELEON_Desc_Destroy( &descX ); CHAMELEON_Desc_Destroy( &descX );
CHAMELEON_Desc_Destroy( &descAC ); CHAMELEON_Desc_Destroy( &descAC );
finalize:
/*
* Required semicolon to have at least one inst
* before the end of OpenMP block.
*/
;
/* Finalize CHAMELEON */ /* Finalize CHAMELEON */
CHAMELEON_Finalize(); CHAMELEON_Finalize();
return EXIT_SUCCESS; return rc;
} }
...@@ -75,11 +75,12 @@ int main(int argc, char *argv[]) { ...@@ -75,11 +75,12 @@ int main(int argc, char *argv[]) {
print_header( argv[0], iparam); print_header( argv[0], iparam);
/* Initialize CHAMELEON with main parameters */ /* Initialize CHAMELEON with main parameters */
if ( CHAMELEON_Init( NCPU, NGPU ) != CHAMELEON_SUCCESS ) { int rc = CHAMELEON_Init( NCPU, NGPU );
fprintf(stderr, "Error initializing CHAMELEON library\n"); if (rc != CHAMELEON_SUCCESS) {
return EXIT_FAILURE; goto finalize;
} }
/* Question chameleon to get the block (tile) size (number of columns) */ /* Question chameleon to get the block (tile) size (number of columns) */
CHAMELEON_Get( CHAMELEON_TILE_SIZE, &NB ); CHAMELEON_Get( CHAMELEON_TILE_SIZE, &NB );
...@@ -201,8 +202,14 @@ int main(int argc, char *argv[]) { ...@@ -201,8 +202,14 @@ int main(int argc, char *argv[]) {
CHAMELEON_Desc_Destroy( &descX ); CHAMELEON_Desc_Destroy( &descX );
CHAMELEON_Desc_Destroy( &descAC ); CHAMELEON_Desc_Destroy( &descAC );
finalize:
/*
* Required semicolon to have at least one inst
* before the end of OpenMP block.
*/
;
/* Finalize CHAMELEON */ /* Finalize CHAMELEON */
CHAMELEON_Finalize(); CHAMELEON_Finalize();
return EXIT_SUCCESS; return rc;
} }
...@@ -53,7 +53,6 @@ int main(int argc, char *argv[]) { ...@@ -53,7 +53,6 @@ int main(int argc, char *argv[]) {
RUNTIME_sequence_t *sequence = NULL; RUNTIME_sequence_t *sequence = NULL;
/* CHAMELEON request uniquely identifies each asynchronous function call */ /* CHAMELEON request uniquely identifies each asynchronous function call */
RUNTIME_request_t request = RUNTIME_REQUEST_INITIALIZER; RUNTIME_request_t request = RUNTIME_REQUEST_INITIALIZER;
int status;
/* initialize some parameters with default values */ /* initialize some parameters with default values */
int iparam[IPARAM_SIZEOF]; int iparam[IPARAM_SIZEOF];
...@@ -83,9 +82,9 @@ int main(int argc, char *argv[]) { ...@@ -83,9 +82,9 @@ int main(int argc, char *argv[]) {
print_header( argv[0], iparam); print_header( argv[0], iparam);
/* Initialize CHAMELEON with main parameters */ /* Initialize CHAMELEON with main parameters */
if ( CHAMELEON_Init( NCPU, NGPU ) != CHAMELEON_SUCCESS ) { int rc = CHAMELEON_Init( NCPU, NGPU );
fprintf(stderr, "Error initializing CHAMELEON library\n"); if (rc != CHAMELEON_SUCCESS) {
return EXIT_FAILURE; goto finalize;
} }
/* Question chameleon to get the block (tile) size (number of columns) */ /* Question chameleon to get the block (tile) size (number of columns) */
...@@ -141,10 +140,10 @@ int main(int argc, char *argv[]) { ...@@ -141,10 +140,10 @@ int main(int argc, char *argv[]) {
* have been terminated */ * have been terminated */
CHAMELEON_Sequence_Wait(sequence); CHAMELEON_Sequence_Wait(sequence);
status = sequence->status; rc = sequence->status;
if ( status != 0 ) { if ( rc != CHAMELEON_SUCCESS ) {
fprintf(stderr, "Error in computation (%d)\n", status); fprintf(stderr, "Error in computation (%d)\n", rc);
return EXIT_FAILURE; goto finalize;
} }
CHAMELEON_Sequence_Destroy(sequence); CHAMELEON_Sequence_Destroy(sequence);
...@@ -195,8 +194,14 @@ int main(int argc, char *argv[]) { ...@@ -195,8 +194,14 @@ int main(int argc, char *argv[]) {
CHAMELEON_Desc_Destroy( &descX ); CHAMELEON_Desc_Destroy( &descX );
CHAMELEON_Desc_Destroy( &descAC ); CHAMELEON_Desc_Destroy( &descAC );
finalize:
/*
* Required semicolon to have at least one inst
* before the end of OpenMP block.
*/
;
/* Finalize CHAMELEON */ /* Finalize CHAMELEON */
CHAMELEON_Finalize(); CHAMELEON_Finalize();
return EXIT_SUCCESS; return rc;
} }
...@@ -53,7 +53,6 @@ int main(int argc, char *argv[]) { ...@@ -53,7 +53,6 @@ int main(int argc, char *argv[]) {
RUNTIME_sequence_t *sequence = NULL; RUNTIME_sequence_t *sequence = NULL;
/* CHAMELEON request uniquely identifies each asynchronous function call */ /* CHAMELEON request uniquely identifies each asynchronous function call */
RUNTIME_request_t request = RUNTIME_REQUEST_INITIALIZER; RUNTIME_request_t request = RUNTIME_REQUEST_INITIALIZER;
int status;
/* initialize some parameters with default values */ /* initialize some parameters with default values */
int iparam[IPARAM_SIZEOF]; int iparam[IPARAM_SIZEOF];
...@@ -86,9 +85,9 @@ int main(int argc, char *argv[]) { ...@@ -86,9 +85,9 @@ int main(int argc, char *argv[]) {
print_header( argv[0], iparam); print_header( argv[0], iparam);
/* Initialize CHAMELEON with main parameters */ /* Initialize CHAMELEON with main parameters */
if ( CHAMELEON_Init( NCPU, NGPU ) != CHAMELEON_SUCCESS ) { int rc = CHAMELEON_Init( NCPU, NGPU );
fprintf(stderr, "Error initializing CHAMELEON library\n"); if (rc != CHAMELEON_SUCCESS) {
return EXIT_FAILURE; goto finalize;
} }
/* set some specific parameters related to CHAMELEON: blocks size and inner-blocking size */ /* set some specific parameters related to CHAMELEON: blocks size and inner-blocking size */
...@@ -145,10 +144,10 @@ int main(int argc, char *argv[]) { ...@@ -145,10 +144,10 @@ int main(int argc, char *argv[]) {
* have been terminated */ * have been terminated */
CHAMELEON_Sequence_Wait(sequence); CHAMELEON_Sequence_Wait(sequence);
status = sequence->status; rc = sequence->status;
if ( status != 0 ) { if ( rc != CHAMELEON_SUCCESS ) {
fprintf(stderr, "Error in computation (%d)\n", status); fprintf(stderr, "Error in computation (%d)\n", rc);
return EXIT_FAILURE; goto finalize;
} }
CHAMELEON_Sequence_Destroy(sequence); CHAMELEON_Sequence_Destroy(sequence);
...@@ -199,6 +198,12 @@ int main(int argc, char *argv[]) { ...@@ -199,6 +198,12 @@ int main(int argc, char *argv[]) {
CHAMELEON_Desc_Destroy( &descX ); CHAMELEON_Desc_Destroy( &descX );
CHAMELEON_Desc_Destroy( &descAC ); CHAMELEON_Desc_Destroy( &descAC );
finalize:
/*
* Required semicolon to have at least one inst
* before the end of OpenMP block.
*/
;
/* Finalize CHAMELEON */ /* Finalize CHAMELEON */
CHAMELEON_Finalize(); CHAMELEON_Finalize();
......
...@@ -54,7 +54,6 @@ int main(int argc, char *argv[]) { ...@@ -54,7 +54,6 @@ int main(int argc, char *argv[]) {
RUNTIME_sequence_t *sequence = NULL; RUNTIME_sequence_t *sequence = NULL;
/* CHAMELEON request uniquely identifies each asynchronous function call */ /* CHAMELEON request uniquely identifies each asynchronous function call */
RUNTIME_request_t request = RUNTIME_REQUEST_INITIALIZER; RUNTIME_request_t request = RUNTIME_REQUEST_INITIALIZER;
int status;
/* initialize some parameters with default values */ /* initialize some parameters with default values */
int iparam[IPARAM_SIZEOF]; int iparam[IPARAM_SIZEOF];
...@@ -84,9 +83,9 @@ int main(int argc, char *argv[]) { ...@@ -84,9 +83,9 @@ int main(int argc, char *argv[]) {
NGPU = iparam[IPARAM_NCUDAS]; NGPU = iparam[IPARAM_NCUDAS];
/* Initialize CHAMELEON with main parameters */ /* Initialize CHAMELEON with main parameters */
if ( CHAMELEON_Init( NCPU, NGPU ) != CHAMELEON_SUCCESS ) { int rc = CHAMELEON_Init( NCPU, NGPU );
fprintf(stderr, "Error initializing CHAMELEON library\n"); if (rc != CHAMELEON_SUCCESS) {
return EXIT_FAILURE; goto finalize;
} }
/* set some specific parameters related to CHAMELEON: blocks size and inner-blocking size */ /* set some specific parameters related to CHAMELEON: blocks size and inner-blocking size */
...@@ -167,10 +166,10 @@ int main(int argc, char *argv[]) { ...@@ -167,10 +166,10 @@ int main(int argc, char *argv[]) {
* have been terminated */ * have been terminated */
CHAMELEON_Sequence_Wait(sequence); CHAMELEON_Sequence_Wait(sequence);
status = sequence->status; rc = sequence->status;
if ( status != 0 ) { if ( rc != CHAMELEON_SUCCESS ) {
fprintf(stderr, "Error in computation (%d)\n", status); fprintf(stderr, "Error in computation (%d)\n", rc);
return EXIT_FAILURE; goto finalize;
} }
CHAMELEON_Sequence_Destroy(sequence); CHAMELEON_Sequence_Destroy(sequence);
...@@ -225,6 +224,12 @@ int main(int argc, char *argv[]) { ...@@ -225,6 +224,12 @@ int main(int argc, char *argv[]) {
CHAMELEON_Desc_Destroy( &descX ); CHAMELEON_Desc_Destroy( &descX );
CHAMELEON_Desc_Destroy( &descAC ); CHAMELEON_Desc_Destroy( &descAC );
finalize:
/*
* Required semicolon to have at least one inst
* before the end of OpenMP block.
*/
;
/* Finalize CHAMELEON */ /* Finalize CHAMELEON */
CHAMELEON_Finalize(); CHAMELEON_Finalize();
......
...@@ -58,7 +58,6 @@ int main(int argc, char *argv[]) { ...@@ -58,7 +58,6 @@ int main(int argc, char *argv[]) {
RUNTIME_sequence_t *sequence = NULL; RUNTIME_sequence_t *sequence = NULL;
/* CHAMELEON request uniquely identifies each asynchronous function call */ /* CHAMELEON request uniquely identifies each asynchronous function call */
RUNTIME_request_t request = RUNTIME_REQUEST_INITIALIZER; RUNTIME_request_t request = RUNTIME_REQUEST_INITIALIZER;
int status;
/* initialize some parameters with default values */ /* initialize some parameters with default values */
int iparam[IPARAM_SIZEOF]; int iparam[IPARAM_SIZEOF];
...@@ -88,9 +87,9 @@ int main(int argc, char *argv[]) { ...@@ -88,9 +87,9 @@ int main(int argc, char *argv[]) {
NGPU = iparam[IPARAM_NCUDAS]; NGPU = iparam[IPARAM_NCUDAS];
/* Initialize CHAMELEON with main parameters */ /* Initialize CHAMELEON with main parameters */
if ( CHAMELEON_Init( NCPU, NGPU ) != CHAMELEON_SUCCESS ) { int rc = CHAMELEON_Init( NCPU, NGPU );
fprintf(stderr, "Error initializing CHAMELEON library\n"); if (rc != CHAMELEON_SUCCESS) {
return EXIT_FAILURE; goto finalize;
} }
/* set some specific parameters related to CHAMELEON: blocks size and inner-blocking size */ /* set some specific parameters related to CHAMELEON: blocks size and inner-blocking size */
...@@ -175,10 +174,10 @@ int main(int argc, char *argv[]) { ...@@ -175,10 +174,10 @@ int main(int argc, char *argv[]) {
* have been terminated */