mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2024-11-03 20:54:08 +01:00
Made the build environment a bit more intelligent. Easily switchable by using 'source smvars.sh {intel|llvm|gnu}'.
This commit is contained in:
parent
545fe71547
commit
0014513b1a
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,7 +1,8 @@
|
||||
*.o
|
||||
*.mod
|
||||
*.dbg
|
||||
.vscode
|
||||
Slater*
|
||||
Updates*
|
||||
datasets/datasets.*
|
||||
datasets/dataset.*
|
||||
bin/
|
||||
|
48
Makefile
48
Makefile
@ -1,19 +1,37 @@
|
||||
## Compilers
|
||||
## Compilers, compiler flags & external libs
|
||||
ifeq ($(ENV),INTEL)
|
||||
CXX = icpc
|
||||
FC = ifort
|
||||
ARCH = -xCORE-AVX2
|
||||
OPT = -O0
|
||||
DEBUG = -debug full
|
||||
else ifeq ($(ENV),LLVM)
|
||||
CXX = clang++
|
||||
FC = flang
|
||||
ARCH =
|
||||
CXX = clang++-7
|
||||
FC = flang-7
|
||||
H5CXX = h5c++
|
||||
|
||||
## Compiler flags
|
||||
CXXFLAGS = -O0
|
||||
OPT = -O0
|
||||
DEBUG = -g
|
||||
else ifeq ($(ENV),GNU)
|
||||
CXX = g++
|
||||
FC = gfortran
|
||||
ARCH = -mavx
|
||||
OPT = -O0
|
||||
DEBUG = -g
|
||||
else
|
||||
$(error No valid compiler environment set in $$ENV. First run: $$ source smvars.sh {intel | llvm | gnu})
|
||||
endif
|
||||
CXXFLAGS = $(OPT) $(ARCH) $(DEBUG)
|
||||
FFLAGS = $(CXXFLAGS)
|
||||
H5CXX = h5c++
|
||||
H5CXXFLAGS = $(CXXFLAGS) -fPIC
|
||||
FLIBS = -lstdc++
|
||||
|
||||
## Includes and dependencies
|
||||
INCLUDE = -I $(INC_DIR)/
|
||||
DEPS_CXX = $(OBJ_DIR)/SM_MaponiA3.o $(OBJ_DIR)/SM_Standard.o
|
||||
DEPS_F = $(DEPS_CXX) $(OBJ_DIR)/SM_MaponiA3_mod.o $(OBJ_DIR)/Helpers_mod.o
|
||||
|
||||
## Directory structure
|
||||
SRC_DIR := src
|
||||
TST_DIR := tests
|
||||
INC_DIR := include
|
||||
@ -32,7 +50,7 @@ EXEC := $(BIN_DIR)/cMaponiA3_test_3x3_3 \
|
||||
all: $(EXEC)
|
||||
|
||||
clean:
|
||||
@rm -vrf $(OBJ_DIR)
|
||||
@rm -vrf $(OBJ_DIR) *.dbg
|
||||
|
||||
distclean: clean
|
||||
@rm -vrf $(BIN_DIR) \
|
||||
@ -46,7 +64,7 @@ $(BIN_DIR) $(OBJ_DIR):
|
||||
### IMPLICIT BUILD RULES
|
||||
## C++ objects
|
||||
$(OBJ_DIR)/%.o: $(TST_DIR)/%.cpp $(INC_DIR)/* | $(OBJ_DIR)
|
||||
$(CXX) $(CXXFLAGS) $(ARCH) $(INCLUDE) -c -o $@ $<
|
||||
$(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $<
|
||||
|
||||
## HDF5/C++ objects
|
||||
$(OBJ_DIR)/%_h5.o: $(TST_DIR)/%_h5.cpp $(INC_DIR)/* | $(OBJ_DIR)
|
||||
@ -54,19 +72,23 @@ $(OBJ_DIR)/%_h5.o: $(TST_DIR)/%_h5.cpp $(INC_DIR)/* | $(OBJ_DIR)
|
||||
|
||||
## Fortran modules
|
||||
$(OBJ_DIR)/%_mod.o: $(SRC_DIR)/%_mod.f90 | $(OBJ_DIR)
|
||||
$(FC) $(FFLAGS) $(ARCH) -J$(OBJ_DIR)/ -c -o $@ $<
|
||||
ifeq ($(ENV),$(filter $(ENV),LLVM GNU))
|
||||
$(FC) $(FFLAGS) -J $(OBJ_DIR)/ -c -o $@ $<
|
||||
else
|
||||
$(FC) $(FFLAGS) -module $(OBJ_DIR)/ -c -o $@ $<
|
||||
endif
|
||||
|
||||
## Fortran objects
|
||||
$(OBJ_DIR)/%.o: $(TST_DIR)/%.f90 | $(OBJ_DIR)
|
||||
$(FC) $(FFLAGS) $(ARCH) -I $(OBJ_DIR)/ -c -o $@ $<
|
||||
$(FC) $(FFLAGS) -I $(OBJ_DIR)/ -c -o $@ $<
|
||||
|
||||
### EXPLICIT BUILD RULES
|
||||
## special compiler flag -fPIC otherwise h5c++ builds fail
|
||||
$(OBJ_DIR)/SM_MaponiA3.o: $(SRC_DIR)/SM_MaponiA3.cpp $(INC_DIR)/* | $(OBJ_DIR)
|
||||
$(CXX) $(CXXFLAGS) -fPIC $(ARCH) $(INCLUDE) -c -o $@ $<
|
||||
$(CXX) $(CXXFLAGS) -fPIC $(INCLUDE) -c -o $@ $<
|
||||
|
||||
$(OBJ_DIR)/SM_Standard.o: $(SRC_DIR)/SM_Standard.cpp $(INC_DIR)/* | $(OBJ_DIR)
|
||||
$(CXX) $(CXXFLAGS) -fPIC $(ARCH) $(INCLUDE) -c -o $@ $<
|
||||
$(CXX) $(CXXFLAGS) -fPIC $(INCLUDE) -c -o $@ $<
|
||||
|
||||
|
||||
#### LINKING
|
||||
|
22
runtests.sh
22
runtests.sh
@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
start_cycle=$1
|
||||
stop_cycle=$2
|
||||
|
||||
if [ "$#" -ne 2 ]
|
||||
then
|
||||
echo "usage: ./run-tests.sh <start cycle> <stop cycle>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "bin/test_external_h5" ]
|
||||
then
|
||||
make bin/test_external_h5
|
||||
fi
|
||||
|
||||
cd datasets/
|
||||
|
||||
for ((cycle = start_cycle; cycle < stop_cycle+1; cycle++))
|
||||
do
|
||||
../bin/test_external_h5 $cycle
|
||||
done
|
40
smvars.sh
Normal file
40
smvars.sh
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ENV=$1
|
||||
|
||||
PWD=$(pwd)
|
||||
SRCDIR=$(dirname $BASH_SOURCE)
|
||||
case $SRCDIR in
|
||||
/*) SMROOT=$SRCDIR ;; ## sourced from absolute path
|
||||
*) SMROOT=$PWD/$SRCDIR ;; ## sourced from relative path
|
||||
esac
|
||||
export SMROOT
|
||||
|
||||
case $ENV in
|
||||
intel)
|
||||
export HDF5_CXX=icpc
|
||||
export HDF5_CXXLINKER=icpc
|
||||
export ENV=INTEL
|
||||
;;
|
||||
llvm)
|
||||
export HDF5_CXX=clang++
|
||||
export HDF5_CXXLINKER=clang++
|
||||
export ENV=LLVM
|
||||
;;
|
||||
gnu)
|
||||
export HDF5_CXX=g++
|
||||
export HDF5_CXXLINKER=g++
|
||||
export ENV=GNU
|
||||
;;
|
||||
*)
|
||||
echo "Unknown environment descriptor given."
|
||||
echo "Usage: source smvars.sh {intel | llvm | gnu}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$SMVARS" ]
|
||||
then
|
||||
export PATH=$SMROOT/bin:$PATH
|
||||
export SMVARS=true
|
||||
fi
|
Loading…
Reference in New Issue
Block a user