-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
134 lines (109 loc) · 3.1 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
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
#CAMB Makefile
#Set FISHER=Y to compile bispectrum fisher matrix code
FISHER=
#native optimization does not work on Mac gfortran or heterogeneous clusters
CLUSTER_SAFE ?= 0
ifneq ($(CLUSTER_SAFE), 0)
NONNATIVE = 1
endif
#Will detect ifort/gfortran or edit for your compiler
ifneq ($(COMPILER),gfortran)
ifortErr = $(shell which ifort >/dev/null; echo $$?)
else
ifortErr = 1
endif
ifeq "$(ifortErr)" "0"
#Intel compiler
F90C = ifort
FFLAGS = -W0 -WB -fpp
DEBUGFLAGS = -g -check all -check noarg_temp_created -traceback -fpp -fpe0
ifeq ($(shell uname -s),Darwin)
SFFLAGS = -dynamiclib -fpic
else
SFFLAGS = -shared -fpic
endif
ifdef NONNATIVE
FFLAGS+=-O3 -ipo -axCORE-AVX2
else
FFLAGS+=-fast
endif
ifortVer_major = $(shell ifort -v 2>&1 | cut -d " " -f 3 | cut -d. -f 1)
ifeq ($(shell test $(ifortVer_major) -gt 15; echo $$?),0)
FFLAGS+= -qopenmp
DEBUGFLAGS+= -qopenmp
else
FFLAGS+= -openmp -vec_report0
DEBUGFLAGS+= -openmp
endif
## This is flag is passed to the Fortran compiler allowing it to link C++ if required (not usually):
F90CRLINK = -cxxlib
MODOUT = -module $(OUTPUT_DIR)
SMODOUT = -module $(DLL_DIR)
ifneq ($(FISHER),)
FFLAGS += -mkl
endif
else
gfortErr = $(shell which gfortran >/dev/null; echo $$?)
ifeq "$(gfortErr)" "0"
COMPILER = gfortran
#Gfortran compiler:
#The options here work in v4.6+. Python wrapper needs v4.9+.
F90C = gfortran
SFFLAGS = -shared -fPIC
FFLAGS = -O3 -fopenmp -ffast-math -fmax-errors=4
DEBUGFLAGS = -cpp -g -fbounds-check -fbacktrace -ffree-line-length-none -fmax-errors=4 -ffpe-trap=invalid,overflow,zero
MODOUT = -J$(OUTPUT_DIR)
SMODOUT = -J$(DLL_DIR)
ifeq ($(shell uname -s),Darwin)
NONNATIVE = 1
endif
ifndef NONNATIVE
#Note this seems to make code slightly slower in some cases, use CLUSTER_SAFE=1 to test without
FFLAGS+=-march=native
endif
endif
endif
IFLAG = -I
#G95 compiler
#F90C = g95
#FFLAGS = -O2
#SGI, -mp toggles multi-processor. Use -O2 if -Ofast gives problems.
#F90C = f90
#FFLAGS = -Ofast -mp
#Digital/Compaq fortran, -omp toggles multi-processor
#F90C = f90
#FFLAGS = -omp -O4 -arch host -math_library fast -tune host -fpe1
#Absoft ProFortran, single processor:
#F90C = f95
#FFLAGS = -O2 -cpu:athlon -s -lU77 -w -YEXT_NAMES="LCS" -YEXT_SFX="_"
#NAGF95, single processor:
#F90C = f95
#FFLAGS = -DNAGF95 -O3
#PGF90
#F90C = pgf90
#FFLAGS = -O2 -DESCAPEBACKSLASH -Mpreprocess
#Sun V880
#F90C = mpf90
#FFLAGS = -O4 -openmp -ftrap=%none -dalign
#Sun parallel enterprise:
#F90C = f95
#FFLAGS = -O2 -xarch=native64 -openmp -ftrap=%none
#try removing -openmp if get bus errors. -03, -04 etc are dodgy.
#IBM XL Fortran, multi-processor (run gmake)
#F90C = xlf90_r
#FFLAGS = -DESCAPEBACKSLASH -DIBMXL -qsmp=omp -qsuffix=f=f90:cpp=F90 -O3 -qstrict -qarch=pwr3 -qtune=pwr3
#Settings for building camb_fits
#Location of FITSIO and name of library
FITSDIR ?= /usr/local/lib
FITSLIB = cfitsio
#Location of HEALPIX for building camb_fits
HEALPIXDIR ?= /usr/local/healpix
ifneq ($(FISHER),)
FFLAGS += -DFISHER
EXTCAMBFILES = $(OUTPUT_DIR)/Matrix_utils.o
else
EXTCAMBFILES =
endif
DEBUGFLAGS ?= FFLAGS
Debug: FFLAGS=$(DEBUGFLAGS)
include ./Makefile_main