Skip to content

Commit

Permalink
Add BML_PREFIX_PATH build variable
Browse files Browse the repository at this point in the history
Clean up the build system a little bit
  • Loading branch information
jeanlucf22 authored and nicolasbock committed Mar 28, 2023
1 parent b88c4fb commit 7292f66
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 42 deletions.
27 changes: 6 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ else()
message(STATUS "Will not build with OpenMP")
endif()

include(FindPkgConfig)
set(BML_PREFIX_PATH "" CACHE STRING "Path to BML installation")
message(STATUS "BML_PREFIX_PATH: ${BML_PREFIX_PATH}")
list(APPEND CMAKE_PREFIX_PATH ${BML_PREFIX_PATH})
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
if(NOT TARGET BML::bml)
find_package(BML CONFIG QUIET)
endif()
Expand All @@ -118,8 +121,9 @@ if(TARGET BML::bml)
list(APPEND LINK_LIBRARIES BML::bml)
list(APPEND LINK_LIBRARIES BML::bml)
else()
include(FindPkgConfig)
pkg_check_modules(BML REQUIRED bml)
message(STATUS "Found bml: ${BML_LDFLAGS}")
message(STATUS "Found bml with pkg_check_modules: ${BML_LDFLAGS}")
list(APPEND LINK_LIBRARIES ${BML_LDFLAGS})
list(APPEND LINK_LIBRARIES ${BML_LDFLAGS})
endif()
Expand Down Expand Up @@ -177,25 +181,6 @@ if(PROGRESS_MPI)
# add_definitions(-DDO_MPI_BLOCK)
endif()

set(BLAS_VENDOR ""
CACHE STRING "If set, the preferred BLAS/LAPACK vendor. Possible choices: {OpenBLAS,Intel,ACML,IBMESSL,...}")

if(BLAS_VENDOR STREQUAL "None")
set(NOBLAS TRUE)
add_definitions(-DNOBLAS)
elseif(NOT BLAS_LIBRARIES)
set(BLA_VENDOR ${BLAS_VENDOR})
message(STATUS "BLA_VENDOR=${BLA_VENDOR}")
include(FindBLAS)
if(NOT BLAS_FOUND)
message(FATAL_ERROR "Can not find suitable BLAS library")
endif()
endif()
message(STATUS "BLAS_LIBRARIES=${BLAS_LIBRARIES}")
if(BLAS_LIBRARIES)
set(BLAS_FOUND TRUE)
endif()

find_package(Threads REQUIRED)

set(SANITY_CHECK FALSE CACHE BOOL "Additional sanity checks")
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ step and the build:
EOF
set_defaults
echo "CMAKE_BUILD_TYPE {Release,Debug} (default is ${CMAKE_BUILD_TYPE})"
echo "CMAKE_PREFIX_PATH Path to include (default is '${CMAKE_PREFIX_PATH}')"
echo "BML_PREFIX_PATH Path to include (default is ${BML_PREFIX_PATH})"
echo "CC Path to C compiler (default is ${CC})"
echo "CXX Path to C++ compiler (default is ${CXX})"
echo "FC Path to Fortran compiler (default is ${FC})"
echo "PROGRESS_OPENMP {yes,no} (default is ${PROGRESS_OPENMP})"
echo "BLAS_VENDOR {Default} (default is ${BLAS_VENDOR})"
echo "PROGRESS_MPI {yes,no} (default is ${PROGRESS_MPI})"
echo "PROGRESS_TESTING {yes,no} (default is ${PROGRESS_TESTING})"
echo "PROGRESS_EXAMPLES {yes,no} (default is ${PROGRESS_EXAMPLES})"
Expand All @@ -55,6 +54,7 @@ EOF
set_defaults() {
: ${CMAKE_BUILD_TYPE:=Release}
: ${CMAKE_PREFIX_PATH:=""}
: ${BML_PREFIX_PATH:=""}
: ${CC:=gcc}
: ${CXX:=g++}
: ${FC:=gfortran}
Expand Down Expand Up @@ -112,6 +112,7 @@ configure() {
${CMAKE:=cmake} .. \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
${CMAKE_PREFIX_PATH:+-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}"} \
-DBML_PREFIX_PATH="${BML_PREFIX_PATH}" \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_Fortran_COMPILER="${FC}" \
Expand All @@ -123,7 +124,6 @@ configure() {
-DPROGRESS_MPI="${PROGRESS_MPI}" \
-DBUILD_SHARED_LIBS="${BUILD_SHARED_LIBS:=no}" \
-DPROGRESS_TESTING="${PROGRESS_TESTING}" \
-DBLAS_VENDOR="${BLAS_VENDOR}" \
-DPROGRESS_EXAMPLES="${PROGRESS_EXAMPLES}" \
-DPROGRESS_BENCHMARKS="${PROGRESS_BENCHMARKS}" \
-DPROGRESS_GRAPHLIB="${PROGRESS_GRAPHLIB}" \
Expand Down
11 changes: 4 additions & 7 deletions scripts/build_crusher_magma_gcc.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#!/bin/bash

rm -r build
rm -r install

# Set BML Library location
MY_PATH=`pwd`
export BML_DIR=${MY_PATH}/../bml/install
# Configuring PROGRESS with OpenMP
export MAGMA_PATH=${MAGMA_PATH:=${OLCF_MAGMA_ROOT}}
export BML_DIR=/autofs/nccs-svm1_proj/csc304/bml/crusher/install

export CC=${CC:=gcc}
export FC=${FC:=gfortran}
export CXX=${CXX:=g++}
Expand All @@ -18,8 +16,7 @@ export PROGRESS_TESTING=${PROGRESS_TESTING:=yes}
export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=RelWithDebInfo}
export PROGRESS_EXAMPLES=${PROGRESS_EXAMPLES:=yes}
export PROGRESS_BENCHMARKS=${PROGRESS_BENCHMARKS:=yes}
export PKG_CONFIG_PATH=${BML_LIB}/lib64/pkgconfig
export EXTRA_FCFLAGS=""
export EXTRA_LINK_FLAGS=""
export BML_PREFIX_PATH=${BML_PREFIX_PATH:=$BML_DIR}

./build.sh configure

19 changes: 11 additions & 8 deletions scripts/build_olcf_summit_gnu_mgma_openblas.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
#!/bin/bash
module load cmake
module load cuda
module load gcc/8.1.1
module load netlib-lapack
module load openblas
module load magma
module load gcc/9.1.0

rm -r build
rm -r install

# Set BML Library location
BML_LIB=/gpfs/alpine/csc304/proj-shared/bml
BML_LIB=/autofs/nccs-svm1_proj/csc304/bml/summit_gcc_magma

MY_PATH=`pwd`

#get jsrun with full path
JSRUN=$(which jsrun)
echo ${JSRUN}

# Configuring PROGRESS with OpenMP
export MAGMA_PATH=${MAGMA_PATH:=${OLCF_MAGMA_ROOT}}
export CC=${CC:=gcc}
export FC=${FC:=gfortran}
export CXX=${CXX:=g++}
Expand All @@ -25,6 +24,10 @@ export PROGRESS_GRAPHLIB=${PROGRESS_GRAPHLIB:=no}
export PROGRESS_TESTING=${PROGRESS_TESTING:=yes}
export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=RelWithDebInfo}
export PROGRESS_EXAMPLES=${PROGRESS_EXAMPLES:=yes}
export PKG_CONFIG_PATH=${BML_LIB}/lib64/pkgconfig
export PROGRESS_BENCHMARKS=${PROGRESS_BENCHMARKS:=yes}
export BML_PREFIX_PATH=${BML_PREFIX_PATH:=$BML_LIB}

export PROGRESS_NONMPI_PRECOMMAND=${PROGRESS_NONMPI_PRECOMMAND:=${JSRUN}}
export PROGRESS_NONMPI_PRECOMMAND_ARGS=${PROGRESS_NONMPI_PRECOMMAND_ARGS:="-n1;-a1;-g1;-c7;--smpiargs=off"}

./build.sh install
4 changes: 1 addition & 3 deletions scripts/setenv_crusher_magma_gcc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash

module load PrgEnv-gnu
module load magma
module load cmake
module load openblas
module load rocm

0 comments on commit 7292f66

Please sign in to comment.