Skip to content

Commit

Permalink
Merge pull request #151 from ExaScience/fix/conda_blas
Browse files Browse the repository at this point in the history
Correct + print BLA_VENDOR
  • Loading branch information
tvandera authored Jul 5, 2024
2 parents b67dd41 + f482d52 commit c5c5d50
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/conda.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Conda Build

on:
pull_request:
Expand Down
20 changes: 13 additions & 7 deletions cmake/DependenciesConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}" )
Expand All @@ -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<float> -Dlapack_complex_double=std::complex<double>)
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}" )
Expand All @@ -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...")
Expand Down
4 changes: 2 additions & 2 deletions conda-recipes/smurff/bld.bat
Original file line number Diff line number Diff line change
@@ -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%
Expand Down
4 changes: 2 additions & 2 deletions conda-recipes/smurff/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions conda-recipes/smurff/run_test.bat
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions conda-recipes/smurff/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
$PREFIX/bin/smurff --verbose=1 --version
$PREFIX/bin/smurff --bist
$PYTHON -m pytest -n auto -v python/test
8 changes: 6 additions & 2 deletions cpp/SmurffCpp/Sessions/CmdSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "CmdSession.h"
#include <SmurffCpp/Predict/PredictSession.h>

#include <SmurffCpp/Version.h>
#include <SmurffCpp/Configs/Config.h>
#include <SmurffCpp/Utils/Error.h>

Expand Down Expand Up @@ -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<int>()->default_value(Config::NUM_THREADS_DEFAULT_VALUE), "number of threads (0 = default by OpenMP)")
(VERBOSE_NAME.c_str(), po::value<int>()->default_value(Config::VERBOSE_DEFAULT_VALUE), "verbosity of output (0, 1, 2 or 3)")
Expand Down Expand Up @@ -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<int>() > 0)
std::cout << "SMURFF " << smurff::full_version() << std::endl;
else
std::cout << "SMURFF " << SMURFF_VERSION << std::endl;
return Config();
}
}
Expand Down
3 changes: 3 additions & 0 deletions cpp/SmurffCpp/Utils/Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
49 changes: 49 additions & 0 deletions cpp/SmurffCpp/Version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#pragma once

#include <SmurffCpp/Utils/Error.h>

#ifdef ENABLE_BOOST
#include <boost/version.hpp>
#endif

#include <Eigen/Core>
#include <highfive/H5Version.hpp>

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 <SmurffCpp/Utils/Tensor.h>

0 comments on commit c5c5d50

Please sign in to comment.