diff --git a/CMakeLists.txt b/CMakeLists.txt index 525c916133da05c4f5fdc79f32f55ac32662c821..c7b08abfd9c3b5ec15ee923800c95f662743ec0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,6 +197,9 @@ if (CHAMELEON_ENABLE_CUDA AND NOT CHAMELEON_USE_CUDA) message("-- ${BoldGreen}CHAMELEON_USE_CUDA is set to OFF, turn it ON to use CUDA (unsupported by Quark)${ColourReset}") endif() +# Enable Hmat-OSS kernels +option(CHAMELEON_USE_HMAT "Enable hmat-oss kernels" OFF) + option(CHAMELEON_RUNTIME_SYNC "Enable synchronous task submission when available to debug the code without parallelism" OFF) if (CHAMELEON_RUNTIME_SYNC) message("-- ${BoldGreen}CHAMELEON_RUNTIME_SYNC is set to ON, turn it OFF to avoid synchronisation in the tasks submission${ColourReset}") @@ -262,6 +265,27 @@ mark_as_advanced(CHAMELEON_COPY_DIAG) ################################ add_subdirectory(hqr) +############################################################################### +# Build dependency HMAT-OSS library # +##################################### +if ( CHAMELEON_USE_HMAT ) + find_package(HMAT REQUIRED) + if(HMAT_FOUND) + # hmat-oss target is not correctly defined + add_library(HMAT::hmat-oss INTERFACE IMPORTED) + + set_target_properties(HMAT::hmat-oss PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${HMAT_INCLUDE_DIRS}" + INTERFACE_COMPILE_DEFINITIONS "${HMAT_DEFINITIONS}" + INTERFACE_LINK_DIRECTORIES "${HMAT_LIBRARY_DIRS}" + INTERFACE_LINK_LIBRARIES "hmat-oss" + ) + message( STATUS "HMAT: Found" ) + else() + message( ERROR "HMAT: Not found" ) + endif() +endif() + ############################################################################### # Look for dependencies # ######################### diff --git a/cmake_modules/PrintOpts.cmake b/cmake_modules/PrintOpts.cmake index 8aac5f8b4c6b6ed1325ed2a1e1d46bfa4e3a519c..c439626b1739980c5201303e9826f723f6b4d792 100644 --- a/cmake_modules/PrintOpts.cmake +++ b/cmake_modules/PrintOpts.cmake @@ -82,6 +82,7 @@ set(dep_message "${dep_message}" " Kernels specific\n" " BLAS ................: ${BLAS_VENDOR_FOUND}\n" " LAPACK...............: ${LAPACK_VENDOR_FOUND}\n" +" HMAT-OSS.............: ${CHAMELEON_USE_HMAT}\n" "\n" " Simulation mode .....: ${CHAMELEON_SIMULATION}\n" "\n" diff --git a/cmake_modules/local_subs.py b/cmake_modules/local_subs.py index c26498a1fd7d9761dd14d36f3f0e5ca6b61d2ae5..10a56bd0e1e3b0531944fbd926a71231cd887539 100644 --- a/cmake_modules/local_subs.py +++ b/cmake_modules/local_subs.py @@ -52,6 +52,7 @@ subs = { ('ChamPattern', 'ChamRealFloat', 'ChamRealDouble', 'ChamRealFloat', r'\bChamRealDouble' ), ('int', 'float', 'double', 'complex32', 'complex64' ), ('Int', 'Float', 'Double', 'Complex32', 'Complex64' ), + ('Int', 'HMAT_SIMPLE_PRECISION','HMAT_DOUBLE_PRECISION','HMAT_SIMPLE_COMPLEX', 'HMAT_DOUBLE_COMPLEX'), # ----- Additional BLAS ('', 'sTile', 'dTile', 'cTile', 'zTile' ), @@ -102,5 +103,7 @@ subs = { # ('', 'stesting', 'dtesting', 'ctesting', 'ztesting' ), # ('', 'SAUXILIARY', 'DAUXILIARY', 'CAUXILIARY', 'ZAUXILIARY' ), # ('', 'sbuild', 'dbuild', 'cbuild', 'zbuild' ), + # Hmat-OSS kernels + ('hmat_p', 'hmat_s', 'hmat_d', 'hmat_c', 'hmat_z' ), ] } diff --git a/coreblas/compute/CMakeLists.txt b/coreblas/compute/CMakeLists.txt index 3e5cf7238a6b089f8c31c20d459b71cc1be162ed..26c025f619a9405b245b9ed12adb11b3c57e62b1 100644 --- a/coreblas/compute/CMakeLists.txt +++ b/coreblas/compute/CMakeLists.txt @@ -105,6 +105,10 @@ set(ZSRC core_zunmqr.c core_ztile.c ) +if( CHAMELEON_USE_HMAT ) + list( APPEND ZSRC + hmat_z.c ) +endif() precisions_rules_py(COREBLAS_SRCS_GENERATED "${ZSRC}" PRECISIONS "${CHAMELEON_PRECISION}") @@ -133,6 +137,10 @@ target_include_directories(coreblas PUBLIC $<INSTALL_INTERFACE:include>) set_property(TARGET coreblas PROPERTY INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") +if( CHAMELEON_USE_HMAT ) + target_link_libraries(coreblas PUBLIC HMAT::hmat-oss ) +endif() + target_link_libraries(coreblas PRIVATE MORSE::LAPACKE) target_link_libraries(coreblas PRIVATE MORSE::CBLAS) target_link_libraries(coreblas PUBLIC MORSE::M) diff --git a/coreblas/include/CMakeLists.txt b/coreblas/include/CMakeLists.txt index 56b43bcfedbe6cbf798388fd9251b9ba1a9de83a..30f7ad411e5212aff837151d20d072db44a08033 100644 --- a/coreblas/include/CMakeLists.txt +++ b/coreblas/include/CMakeLists.txt @@ -34,6 +34,11 @@ set(ZHDR coreblas/coreblas_zc.h coreblas/coreblas_ztile.h ) +if( CHAMELEON_USE_HMAT ) + list( APPEND ZHDR + coreblas/hmat_z.h ) +endif() + precisions_rules_py( COREBLAS_HDRS_GENERATED "${ZHDR}" TARGETDIR coreblas @@ -49,6 +54,10 @@ set(COREBLAS_HDRS coreblas/lapacke_mangling.h coreblas/random.h ) +if( CHAMELEON_USE_HMAT ) + list( APPEND COREBLAS_HDRS + coreblas/hmat.h ) +endif() # Add generated headers # --------------------- diff --git a/include/chameleon/config.h.in b/include/chameleon/config.h.in index 58b066488d52e36b333eae3c92fc159b8ba6bb1a..15073d1c4604947b704f0f3cf5ff55f15074012a 100644 --- a/include/chameleon/config.h.in +++ b/include/chameleon/config.h.in @@ -51,6 +51,9 @@ #cmakedefine CHAMELEON_USE_CUBLAS #cmakedefine CHAMELEON_USE_CUBLAS_V2 +/* Hmat-oss */ +#cmakedefine CHAMELEON_USE_HMAT + /* Simulation */ #cmakedefine CHAMELEON_SIMULATION #cmakedefine CHAMELEON_SIMULATION_EXTENDED