forked from landreman/regcoil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
85 lines (65 loc) · 3 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# makefile for NERSC Edison and Cori
# You must first load the cray-netcdf module:
# module load cray-netcdf
# It is convenient to run
# module unload cray-libsci
# to avoid warning messages about libsci during compiling.
ifdef NERSC_HOST
HOSTNAME = $(NERSC_HOST)
else
HOSTNAME="laptop"
endif
ifeq ($(HOSTNAME),edison)
FC = ftn
## NERSC documentation recommends against specifying -O3
## -mkl MUST APPEAR AT THE END!!
EXTRA_COMPILE_FLAGS = -openmp -mkl
EXTRA_LINK_FLAGS = -openmp -mkl -Wl,-ydgemm_
# Above, the link flag "-Wl,-ydgemm_" causes the linker to report which version of DGEMM (the BLAS3 matrix-matrix-multiplication subroutine) is used.
# For batch systems, set the following variable to the command used to run jobs. This variable is used by 'make test'.
REGCOIL_COMMAND_TO_SUBMIT_JOB = srun -n 1 -c 24
else ifeq ($(HOSTNAME),cori)
FC = ftn
## NERSC documentation recommends against specifying -O3
## -mkl MUST APPEAR AT THE END!!
EXTRA_COMPILE_FLAGS = -qopenmp -mkl
EXTRA_LINK_FLAGS = -qopenmp -mkl -Wl,-ydgemm_
# Above, the link flag "-Wl,-ydgemm_" causes the linker to report which version of DGEMM (the BLAS3 matrix-matrix-multiplication subroutine) is used.
# For batch systems, set the following variable to the command used to run jobs. This variable is used by 'make test'.
REGCOIL_COMMAND_TO_SUBMIT_JOB = srun -n 1 -c 32
else
FC = mpif90
#EXTRA_COMPILE_FLAGS = -fopenmp -I/opt/local/include -ffree-line-length-none -cpp
EXTRA_COMPILE_FLAGS = -fopenmp -I/opt/local/include -ffree-line-length-none
EXTRA_LINK_FLAGS = -fopenmp -L/opt/local/lib -lnetcdff -lnetcdf -framework Accelerate
# For batch systems, set the following variable to the command used to run jobs. This variable is used by 'make test'.
REGCOIL_COMMAND_TO_SUBMIT_JOB =
endif
# End of system-dependent variable assignments
LIBSTELL_DIR = mini_libstell
TARGET = regcoil
export
.PHONY: all clean
all: $(TARGET)
include makefile.depend
%.o: %.f90 $(LIBSTELL_DIR)/mini_libstell.a
$(FC) $(EXTRA_COMPILE_FLAGS) -I $(LIBSTELL_DIR) -c $<
%.o: %.f $(LIBSTELL_DIR)/mini_libstell.a
$(FC) $(EXTRA_COMPILE_FLAGS) -I $(LIBSTELL_DIR) -c $<
$(TARGET): $(OBJ_FILES) $(LIBSTELL_DIR)/mini_libstell.a
$(FC) -o $(TARGET) $(OBJ_FILES) $(LIBSTELL_DIR)/mini_libstell.a $(EXTRA_LINK_FLAGS)
# $(FC) -o $(TARGET) $(OBJ_FILES) $(LIBSTELL_DIR)/libstell.a $(EXTRA_LINK_FLAGS)
$(LIBSTELL_DIR)/mini_libstell.a:
$(MAKE) -C mini_libstell
clean:
rm -f *.o *.mod *.MOD *~ $(TARGET)
cd $(LIBSTELL_DIR); rm -f *.o *.mod *.MOD *.a
test: $(TARGET)
@echo "Beginning functional tests." && cd examples && export REGCOIL_RETEST=no && ./runExamples.py
retest: $(TARGET)
@echo "Testing existing output files for examples without re-running then." && cd examples && export REGCOIL_RETEST=yes && ./runExamples.py
test_make:
@echo HOSTNAME is $(HOSTNAME)
@echo FC is $(FC)
@echo EXTRA_COMPILE_FLAGS is $(EXTRA_COMPILE_FLAGS)
@echo EXTRA_LINK_FLAGS is $(EXTRA_LINK_FLAGS)