Skip to content

Commit

Permalink
Core: use OpenBlas instead of GSL's CBLAS whenever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
forthommel committed Aug 22, 2022
1 parent 08358d3 commit 9f6f868
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ set(ROOT_CXX_STANDARD 17)
#----- include external paths

include(GNUInstallDirs)
include(UseEnvironment)

set(CEPGEN_CORE_EXT ${GSL_LIB} dl)
set(CEPGEN_LIBRARIES)
set(CEPGEN_LIB_DIR ${PROJECT_SOURCE_DIR}/CepGen)
set(CEPGEN_CORE_EXT ${GSL_LIB} ${GSL_CBLAS_LIB} dl)
set(CEPGEN_HAS_FUNCTIONAL OFF)
set(CEPGEN_ADDONS_FILE "${CMAKE_CURRENT_BINARY_DIR}/CepGenAddOns.txt")

include(UseEnvironment)
include(BuildUtils)

#----- enable fortran for external libraries linking
Expand Down
1 change: 0 additions & 1 deletion CepGenAddOns/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ add_subdirectory(GnuplotWrapper)
add_subdirectory(HepMC2Wrapper)
add_subdirectory(HepMC3Wrapper)
add_subdirectory(LHAPDFWrapper)
add_subdirectory(MadGraphWrapper)
add_subdirectory(MatplotlibWrapper)
add_subdirectory(PhotosTauolaWrapper)
add_subdirectory(ProMCWrapper)
Expand Down
18 changes: 12 additions & 6 deletions cmake/UseEnvironment.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ if(IS_LXPLUS)
list(APPEND CMAKE_PREFIX_PATH "$ENV{JSONMCPP_DIR}/lib64/cmake")
endif()
#--- searching for GSL
find_library(GSL_LIB gsl HINTS $ENV{GSL_DIR} PATH_SUFFIXES lib)
find_library(GSL_CBLAS_LIB gslcblas HINTS $ENV{GSL_DIR} PATH_SUFFIXES lib)
find_path(GSL_INCLUDE gsl HINTS $ENV{GSL_DIR} PATH_SUFFIXES include)
if(NOT GSL_LIB OR NOT GSL_CBLAS_LIB)
message(FATAL_ERROR "GSL with CBLAS bindings was not found!")
find_library(GSL_LIB gsl HINTS $ENV{GSL_DIR} PATH_SUFFIXES lib REQUIRED)
find_path(GSL_INCLUDE gsl HINTS $ENV{GSL_DIR} PATH_SUFFIXES include REQUIRED)
#--- either use GSL's CBLAS or OpenBLAS implementation
find_library(OPENBLAS_LIB openblas HINTS $ENV{OPENBLAS_DIR} PATH_SUFFIXES lib)
if(OPENBLAS_LIB)
message(STATUS "OpenBLAS found in ${OPENBLAS_LIB}")
list(APPEND CEPGEN_CORE_EXT ${OPENBLAS_LIB})
else()
message(STATUS "GSL found in ${GSL_LIB}")
find_library(GSL_CBLAS_LIB gslcblas HINTS $ENV{GSL_DIR} $ENV{GSL_CBLAS_DIR} PATH_SUFFIXES lib)
if(NOT GSL_CBLAS_LIB)
message(FATAL_ERROR "Neither OpenBLAS nor GSL's CBLAS library found.")
endif()
message(STATUS "GSL CBLAS found in ${GSL_CBLAS_LIB}")
list(APPEND CEPGEN_CORE_EXT ${GSL_CBLAS_LIB})
endif()
include_directories(${GSL_INCLUDE})
#--- searching for ROOT
Expand Down
40 changes: 22 additions & 18 deletions source-lxplus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,38 @@
#source /afs/atlas.umich.edu/home/rkwang/public/sw/setup_TopDrawer.sh
#--- proper gcc/gfortran/cmake version
source /cvmfs/sft.cern.ch/lcg/contrib/gcc/9.3.0/x86_64-centos7-gcc9-opt/setup.sh

export LCG_DIR=/cvmfs/sft.cern.ch/lcg/releases/LCG_101
export CMAKE_DIR=${LCG_DIR}/CMake/3.20.0/x86_64-centos7-gcc8-opt
export ARCH=x86_64-centos7-gcc8-opt

export CMAKE_DIR=${LCG_DIR}/CMake/3.20.0/${ARCH}
export PATH=${CMAKE_DIR}/bin:${PATH}
export Boost_DIR=${LCG_DIR}/Boost/1.77.0/x86_64-centos7-gcc8-opt
export GSL_DIR=${LCG_DIR}/GSL/2.7/x86_64-centos7-gcc8-opt
export Boost_DIR=${LCG_DIR}/Boost/1.77.0/${ARCH}
export GSL_DIR=${LCG_DIR}/GSL/2.7/${ARCH}
export OPENBLAS_DIR=${LCG_DIR}/blas/0.3.17.openblas/${ARCH}
#--- Delphes linking
source ${LCG_DIR}/ROOT/6.24.06/x86_64-centos7-gcc8-opt/bin/thisroot.sh
export DELPHES_DIR=${LCG_DIR}/delphes/3.5.0/x86_64-centos7-gcc8-opt
source ${LCG_DIR}/ROOT/6.24.06/${ARCH}/bin/thisroot.sh
export DELPHES_DIR=${LCG_DIR}/delphes/3.5.0/${ARCH}
export ROOT_INCLUDE_PATH=$ROOT_INCLUDE_PATH:${DELPHES_DIR}/include
#--- Pythia linking
export PYTHIA6_DIR=${LCG_DIR}/MCGenerators/pythia6/429.2/x86_64-centos7-gcc8-opt
export PYTHIA8_DIR=${LCG_DIR}/MCGenerators/pythia8/245/x86_64-centos7-gcc8-opt
export PYTHIA6_DIR=${LCG_DIR}/MCGenerators/pythia6/429.2/${ARCH}
export PYTHIA8_DIR=${LCG_DIR}/MCGenerators/pythia8/245/${ARCH}
export PYTHIA8DATA=${PYTHIA8_DIR}/share/Pythia8/xmldoc
#--- Python environment
export PYTHONHOME=${LCG_DIR}/Python/3.9.6/x86_64-centos7-gcc8-opt
export PYTHONHOME=${LCG_DIR}/Python/3.9.6/${ARCH}
export PATH=${PYTHONHOME}/bin:${PATH}
#--- extra utilities
export APFEL_DIR=${LCG_DIR}/MCGenerators/apfel/3.0.4/x86_64-centos7-gcc8-opt
export HEPMC_DIR=${LCG_DIR}/HepMC/2.06.11/x86_64-centos7-gcc8-opt
export HEPMC3_DIR=${LCG_DIR}/hepmc3/3.2.4/x86_64-centos7-gcc8-opt
export LHAPDF_PATH=${LCG_DIR}/MCGenerators/lhapdf/6.3.0/x86_64-centos7-gcc8-opt
export PHOTOSPP_DIR=${LCG_DIR}/MCGenerators/photos++/3.64/x86_64-centos7-gcc8-opt
export TAUOLAPP_DIR=${LCG_DIR}/MCGenerators/tauola++/1.1.8/x86_64-centos7-gcc8-opt
export TBB_DIR=${LCG_DIR}/tbb/2020_U2/x86_64-centos7-gcc8-opt
export VDT_DIR=${LCG_DIR}/vdt/0.4.3/x86_64-centos7-gcc8-opt
export APFEL_DIR=${LCG_DIR}/MCGenerators/apfel/3.0.4/${ARCH}
export HEPMC_DIR=${LCG_DIR}/HepMC/2.06.11/${ARCH}
export HEPMC3_DIR=${LCG_DIR}/hepmc3/3.2.4/${ARCH}
export LHAPDF_PATH=${LCG_DIR}/MCGenerators/lhapdf/6.3.0/${ARCH}
export PHOTOSPP_DIR=${LCG_DIR}/MCGenerators/photos++/3.64/${ARCH}
export TAUOLAPP_DIR=${LCG_DIR}/MCGenerators/tauola++/1.1.8/${ARCH}
export TBB_DIR=${LCG_DIR}/tbb/2020_U2/${ARCH}
export VDT_DIR=${LCG_DIR}/vdt/0.4.3/${ARCH}
export LD_LIBRARY_PATH=${TBB_DIR}/lib:${VDT_DIR}/lib:${LD_LIBRARY_PATH}
export nlohmann_json_DIR=${LCG_DIR}/jsonmcpp/3.9.1/x86_64-centos7-gcc8-opt
export YODA_DIR=${LCG_DIR}/MCGenerators/yoda/1.9.0/x86_64-centos7-gcc8-opt
export nlohmann_json_DIR=${LCG_DIR}/jsonmcpp/3.9.1/${ARCH}
export YODA_DIR=${LCG_DIR}/MCGenerators/yoda/1.9.0/${ARCH}

echo "Environment prepared for LXPLUS"
export CEPGEN_LXPLUS_ENV=1

0 comments on commit 9f6f868

Please sign in to comment.