From 67bf4d5e526915e8490a0c2d9369a3e600d81d6c Mon Sep 17 00:00:00 2001 From: Tom Vander Aa Date: Fri, 28 Jun 2024 09:13:50 +0200 Subject: [PATCH 1/5] conda: fix BLA_VENDOR --- conda-recipes/smurff/bld.bat | 4 ++-- conda-recipes/smurff/build.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conda-recipes/smurff/bld.bat b/conda-recipes/smurff/bld.bat index 45979a3b..f5c92484 100644 --- a/conda-recipes/smurff/bld.bat +++ b/conda-recipes/smurff/bld.bat @@ -1,7 +1,7 @@ if "%blas_impl%"=="mkl" ( - set "SKBUILD_CMAKE_ARGS=-DENABLE_MKL=ON -DENABLE_OPENBLAS=OFF" + set "SKBUILD_CMAKE_ARGS=-DBLA_VENDOR=Intel10_64_dyn" ) else ( - set "SKBUILD_CMAKE_ARGS=-DENABLE_OPENBLAS=ON -DENABLE_MKL=OFF" + set "SKBUILD_CMAKE_ARGS=-DBLA_VENDOR=OpenBLAS" ) echo extra CMAKE_ARGS: %SKBUILD_CMAKE_ARGS% diff --git a/conda-recipes/smurff/build.sh b/conda-recipes/smurff/build.sh index f6ce2242..46799aa9 100644 --- a/conda-recipes/smurff/build.sh +++ b/conda-recipes/smurff/build.sh @@ -4,9 +4,9 @@ export CMAKE_GENERATOR="Ninja" if [ "$blas_impl" == "mkl" ] then - SKBUILD_CMAKE_ARGS="-DENABLE_MKL=ON -DENABLE_OPENBLAS=OFF" + SKBUILD_CMAKE_ARGS="-DBLA_VENDOR=Intel10_64_dyn" else - SKBUILD_CMAKE_ARGS="-DENABLE_OPENBLAS=ON -DENABLE_MKL=OFF" + SKBUILD_CMAKE_ARGS="-DBLA_VENDOR=OpenBLAS" fi echo "extra CMAKE_ARGS: $SKBUILD_CMAKE_ARGS" From bf887d036b1ba8d10de3ca145866718da40a84e9 Mon Sep 17 00:00:00 2001 From: Tom Vander Aa Date: Mon, 1 Jul 2024 10:30:51 +0200 Subject: [PATCH 2/5] blas: stop when MKL is found --- cmake/DependenciesConfig.cmake | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cmake/DependenciesConfig.cmake b/cmake/DependenciesConfig.cmake index b465cb53..1e773231 100644 --- a/cmake/DependenciesConfig.cmake +++ b/cmake/DependenciesConfig.cmake @@ -48,18 +48,24 @@ macro(configure_blas) message(STATUS "BLAS libraries: ${BLAS_LIBRARIES}" ) message(STATUS "BLAS include: ${BLAS_INCLUDE_DIR}" ) add_definitions(-DEIGEN_USE_BLAS) + add_definitions(-DBLA_VENDOR=${BLA_VENDOR}) + list(APPEND ALGEBRA_LIBS ${BLAS_LIBRARIES}) if (BLA_VENDOR MATCHES "Intel10") add_definitions(-DEIGEN_USE_MKL_ALL) message(STATUS "MKL Found" ) + else() + configure_lapack() endif() - list(APPEND ALGEBRA_LIBS ${BLAS_LIBRARIES}) - else() message(STATUS "BLAS NOT found" ) endif (BLAS_FOUND) + message(STATUS "all algebra libraries: ${ALGEBRA_LIBS}" ) +endmacro(configure_blas) + +macro(configure_lapack) find_package(LAPACK) if (LAPACK_FOUND) message(STATUS "LAPACK libraries: ${LAPACK_LIBRARIES}" ) @@ -69,10 +75,14 @@ macro(configure_blas) # needed because MSVC does not have support for c-type _Complex add_definitions(-Dlapack_complex_float=std::complex -Dlapack_complex_double=std::complex) list(APPEND ALGEBRA_LIBS ${LAPACK_LIBRARIES}) + + configure_lapacke() else() message(STATUS "LAPACK NOT found" ) endif (LAPACK_FOUND) +endmacro(configure_lapack) +macro(configure_lapacke) find_package(LAPACKE) if (LAPACKE_FOUND) message(STATUS "LAPACKE libraries: ${LAPACKE_LIBRARIES}" ) @@ -82,11 +92,7 @@ macro(configure_blas) else() message(STATUS "LAPACKE NOT found" ) endif(LAPACKE_FOUND) - - message(STATUS "all algebra libraries: ${ALGEBRA_LIBS}" ) - - -endmacro(configure_blas) +endmacro(configure_lapacke) macro(configure_eigen) message ("Dependency check for eigen...") From f5265b151fb165d6e3c5d6ae6d71ce322f781ba1 Mon Sep 17 00:00:00 2001 From: Tom Vander Aa Date: Fri, 28 Jun 2024 10:28:07 +0200 Subject: [PATCH 3/5] version: smurff --version --verbose=1 gives you details on compiled-in features version: use HIGHFIVE_VERSION macro --- cpp/SmurffCpp/Sessions/CmdSession.cpp | 8 +++-- cpp/SmurffCpp/Utils/Error.h | 3 ++ cpp/SmurffCpp/Version.h | 49 +++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 cpp/SmurffCpp/Version.h diff --git a/cpp/SmurffCpp/Sessions/CmdSession.cpp b/cpp/SmurffCpp/Sessions/CmdSession.cpp index 897e8110..fce6e1b4 100644 --- a/cpp/SmurffCpp/Sessions/CmdSession.cpp +++ b/cpp/SmurffCpp/Sessions/CmdSession.cpp @@ -13,6 +13,7 @@ #include "CmdSession.h" #include +#include #include #include @@ -54,7 +55,7 @@ po::options_description get_desc() { po::options_description general_desc("General parameters"); general_desc.add_options() - (VERSION_NAME.c_str(), "print version info (and exit)") + (VERSION_NAME.c_str(), "print version info and exit (add --verbose=1 for more info)") (HELP_NAME.c_str(), "show this help information (and exit)") (NUM_THREADS_NAME.c_str(), po::value()->default_value(Config::NUM_THREADS_DEFAULT_VALUE), "number of threads (0 = default by OpenMP)") (VERBOSE_NAME.c_str(), po::value()->default_value(Config::VERBOSE_DEFAULT_VALUE), "verbosity of output (0, 1, 2 or 3)") @@ -217,7 +218,10 @@ Config parse_options(int argc, char *argv[]) if (vm.count(VERSION_NAME)) { - std::cout << "SMURFF " << SMURFF_VERSION << std::endl; + if (vm.count(VERBOSE_NAME) && vm[VERBOSE_NAME].as() > 0) + std::cout << "SMURFF " << smurff::full_version() << std::endl; + else + std::cout << "SMURFF " << SMURFF_VERSION << std::endl; return Config(); } } diff --git a/cpp/SmurffCpp/Utils/Error.h b/cpp/SmurffCpp/Utils/Error.h index bca77f27..4ccbeec8 100644 --- a/cpp/SmurffCpp/Utils/Error.h +++ b/cpp/SmurffCpp/Utils/Error.h @@ -32,6 +32,9 @@ inline void show_internal(const char *name, const int& variable) std::cout << name << " =\n" << variable << std::endl << std::endl; } +#define STRINGIFY(s) STRINGIFY_NAME(s) + +#define STRINGIFY_NAME(s) #s #define SHOW(M) show_internal(#M, M); diff --git a/cpp/SmurffCpp/Version.h b/cpp/SmurffCpp/Version.h new file mode 100644 index 00000000..446f6825 --- /dev/null +++ b/cpp/SmurffCpp/Version.h @@ -0,0 +1,49 @@ +#pragma once + +#include + +#ifdef ENABLE_BOOST +#include +#endif + +#include +#include + +namespace smurff { + inline std::string full_version() { + std::string v(SMURFF_VERSION); + +#ifdef HAVE_BOOST + v += " (Boost version: " BOOST_LIB_VERSION ")"; +#else + v += " (no Boost)"; +#endif + + v += " (Eigen " STRINGIFY(EIGEN_WORLD_VERSION) + "." STRINGIFY(EIGEN_MAJOR_VERSION) + "." STRINGIFY(EIGEN_MINOR_VERSION) + ")"; + +#ifdef BLA_VENDOR + v += " (BLAS/LAPACK vendor: " STRINGIFY(BLA_VENDOR) ")"; +#elif defined(EIGEN_USE_BLAS) + v += " (generic BLAS)"; +#else + v += " (no BLAS)"; +#endif + + v += " (HighFive " STRINGIFY(HIGHFIVE_VERSION) ")"; + + +#if defined(_OPENMP) + v += " (OpenMP)"; +#else + v += " (single threaded)"; +#endif + + return v; + } + +}; + +#include \ No newline at end of file From 8f0a535aca2bbbc56c43bf5333c3b1427acae49e Mon Sep 17 00:00:00 2001 From: Tom Vander Aa Date: Fri, 28 Jun 2024 10:28:30 +0200 Subject: [PATCH 4/5] conda: display verbose version info as first test --- conda-recipes/smurff/run_test.bat | 2 ++ conda-recipes/smurff/run_test.sh | 1 + 2 files changed, 3 insertions(+) diff --git a/conda-recipes/smurff/run_test.bat b/conda-recipes/smurff/run_test.bat index e090fb38..bafae7f0 100644 --- a/conda-recipes/smurff/run_test.bat +++ b/conda-recipes/smurff/run_test.bat @@ -1,3 +1,5 @@ +%CONDA_PREFIX%\Scripts\smurff --version --verbose=1 +if errorlevel 1 exit 1 %CONDA_PREFIX%\Scripts\smurff --bist ~[random] if errorlevel 1 exit 1 %PYTHON% -m pytest -n auto -v diff --git a/conda-recipes/smurff/run_test.sh b/conda-recipes/smurff/run_test.sh index ad44672b..9a194bfa 100644 --- a/conda-recipes/smurff/run_test.sh +++ b/conda-recipes/smurff/run_test.sh @@ -1,2 +1,3 @@ +$PREFIX/bin/smurff --verbose=1 --version $PREFIX/bin/smurff --bist $PYTHON -m pytest -n auto -v python/test \ No newline at end of file From f482d52e9fd8b959d957e07a67234aca28afb255 Mon Sep 17 00:00:00 2001 From: Tom Vander Aa Date: Mon, 1 Jul 2024 14:29:39 +0200 Subject: [PATCH 5/5] ci: rename Build -> Conda Build --- .github/workflows/conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index e29b6387..e9156f64 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -1,4 +1,4 @@ -name: Build +name: Conda Build on: pull_request: