-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.in
149 lines (119 loc) · 3.51 KB
/
Makefile.in
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#=====================================================================#
# User Options
#=====================================================================#
COMPILER = gnu
DEBUG = yes
PROFILE = no
OPTIMIZE = no
MPI = no
HDF5 = no
PETSC = no
F2008 = yes
LAPACK = yes
COMPLEX = no
#=====================================================================#
# External Library Paths
#=====================================================================#
MPI_DIR = $(HOME)/install/mpich-3.2/builild
HDF5_DIR = /opt/hdf5/1.8.9-$(COMPILER)
PETSC_DIR = $(HOME)/install/petsc/3.7.4
LAPACK_DIR = /usr
#=====================================================================#
# Add git SHA-1 hash
#=====================================================================#
# GIT_SHA1 = $(shell git log -1 | head -n 1 | awk '{print $$2}')
#=====================================================================#
# GNU Fortran compiler options
#=====================================================================#
ifeq ($(COMPILER),gnu)
F90 = gfortran-7
F90FLAGS := -cpp
# COMPLEX mode
ifeq ($(COMPLEX),yes)
F90FLAGS += -DUSE_COMPLEX
endif
# Disable F2008 STD
ifeq ($(F2008),no)
F90FLAGS += -DNO_F2008
endif
# Debugging
ifeq ($(DEBUG),yes)
F90FLAGS += -g -Wall -pedantic -fbounds-check -fbacktrace\
-ffpe-trap=invalid,overflow,underflow
LDFLAGS += -g
endif
# Profiling
ifeq ($(PROFILE),yes)
F90FLAGS += -pg
LDFLAGS += -pg
endif
# Optimization
ifeq ($(OPTIMIZE),yes)
F90FLAGS += -O3
endif
endif
#=====================================================================#
# Intel Fortran compiler options
#=====================================================================#
ifeq ($(COMPILER),intel)
F90 = ifort
F90FLAGS := -cpp -warn -assume byterecl -traceback
LDFLAGS =
# Debugging
ifeq ($(DEBUG),yes)
F90FLAGS += -g -ftrapuv -fp-stack-check -check all -fpe0
LDFLAGS += -g
endif
# Profiling
ifeq ($(PROFILE),yes)
F90FLAGS += -pg
LDFLAGS += -pg
endif
# Optimization
ifeq ($(OPTIMIZE),yes)
F90FLAGS += -O3
endif
endif
#=====================================================================#
# Setup External Libraries
#=====================================================================#
# LAPACK for linear algebra
ifeq ($(LAPACK),yes)
F90FLAGS += -I$(LAPACK_DIR)/include
LDFLAGS += -L$(LAPACK_DIR)/lib -llapack
endif
# MPI for distributed-memory parallelism
ifeq ($(MPI),yes)
F90 = mpif90
F90FLAGS += -DMPI
endif
# HDF5 for I/O
ifeq ($(HDF5),yes)
F90FLAGS += -DHDF5 -I$(HDF5_DIR)/include
LDFLAGS += -L$(HDF5_DIR)/lib $(HDF5_DIR)/lib/libhdf5hl_fortran.a \
$(HDF5_DIR)/lib/libhdf5_hl.a $(HDF5_DIR)/lib/libhdf5_fortran.a \
$(HDF5_DIR)/lib/libhdf5.a -lz -lrt -lm -Wl,-rpath -Wl,$(HDF5_DIR)/lib
endif
# PETSC
ifeq ($(PETSC),yes)
# Check to make sure MPI is set
ifneq ($(MPI),yes)
$(error MPI must be enabled to compile with PETSC!)
endif
# Set up PETSc environment
F90FLAGS += -I${PETSC_DIR}/linux-gnu-c-opt/include -DPETSC
LDFLAGS += -lpetsc
endif
#=====================================================================#
# Machine-specific setup
#=====================================================================#
# IBM Blue Gene/P ANL supercomputer
ifeq ($(MACHINE),bluegene)
F90 = /bgsys/drivers/ppcfloor/comm/xl/bin/mpixlf2003
F90FLAGS = -WF,-DNO_F2008,-DMPI -O3
endif
# Cray XK6 ORNL Titan supercomputer
ifeq ($(MACHINE),crayxk6)
F90 = ftn
F90FLAGS += -DMPI
endif