Commit ba7225f3 authored by MARAIT Gilles's avatar MARAIT Gilles

Try to add mt with openblas

parent 278a5c04
......@@ -384,9 +384,8 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
endif()
else()
message(FATAL_ERROR "BLASMT is enabled but no parallel LAPACK was found."
"Please provide a parallel lapack library in your environment."
"For now only Intel MKL BLAS/LAPACK provider is fully supported."
)
"Please provide a parallel lapack library in your environment."
)
endif()
else()
list(APPEND MAPHYS_EXTRA_LIBRARIES ${LAPACK_LIBRARIES})
......@@ -418,6 +417,9 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
endif()
if (MAPHYS_BLASMT)
if (BLAS_LIBRARIES)
if("${LAPACK_LIBRARIES}" MATCHES "openblas")
add_definitions(-DUSE_OPENBLAS_)
endif()
add_definitions(-DMULTITHREAD_VERSION)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
if (BLAS_PAR_LIBRARIES)
......
......@@ -3,12 +3,12 @@
! error messages
#ifdef MAPHYS_BACKTRACE_ERROR
! CHCKASSRT and ASSRT macros requires :
! - the usage of "maphys_error_mod"
! - the usage of "maphys_error_mod"
! - the definition of the string FLNAME.
!
! Warning on their usage, since F90 line are truncated to 132 characters.
! - "x" + "res" must take ? characters
! - MPH_ONFAILURE_* "x" must take less than 20 characters
! - MPH_ONFAILURE_* "x" must take less than 20 characters
! (with 20 spaces at the begining of the line)
!
#define CHCKASSRT( x, res ) Call mph_check( (x) , __LINE__, res, FLNAME );
......@@ -24,22 +24,32 @@
#define MPH_ONFAILURE_RETURN(x) If(x<0) Return;
#endif
! mkl -- num threads controls
! Multithreading config
#if MULTITHREAD_VERSION
#define BLAS_SET_NUM_THREADS( x ) Call omp_set_num_threads( (x) ); \
Call mkl_set_num_threads( (x) );\
Call omp_set_dynamic( 0 );\
Call mkl_set_dynamic( 0 );
#ifdef USE_OPENBLAS_
! Openblas multithread
#define BLAS_SET_NUM_THREADS( x ) Call openblas_set_num_threads( (x) )
! Call omp_set_num_threads( (x) ); \
! Call omp_set_dynamic( 0 );
#else
! mkl multithreads
#define BLAS_SET_NUM_THREADS( x ) Call omp_set_num_threads( (x) ); \
Call mkl_set_num_threads( (x) ); \
Call omp_set_dynamic( 0 ); \
Call mkl_set_dynamic( 0 );
#endif
#else
#define BLAS_SET_NUM_THREADS( x )
! No multithreading
#define BLAS_SET_NUM_THREADS( x )
#endif
!
! specifics checks / assertions
!
! a routine info
! a routine info
#define CHCKRINFO( x ) CHCKASSRT( x >= 0, x )
! an allocation
#define CHCKALLOC( x ) CHCKASSRT( x == 0, x )
......@@ -47,4 +57,3 @@
#define CHCKIO( x ) CHCKASSRT( x == 0, x )
! an MPI communication
#define ASSRTMPI( x ) ASSRT( x == MPI_SUCCESS )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment