-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
executable file
·203 lines (160 loc) · 8.05 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
## This file is heavily modified from the Makefile distributed by with
## ccx.
## pkg-config is used to pull all flags from local enviroment. You
## must set this up. Typically this would be defining
## PKG_CONFIG_PATH=$PKG_CONFIG_PATH:~/local/lib64/pkgconfig or
## similar. You will also have to add .pc file for each library you
## use. I did this because I have several machines with different
## library enviroments. You could alternatively use compiler flags
## such as -L/path/to/lib -I/path/to/include -llib. Examples of this
## on my distribution are in the comments below
################################################################################
################################################################################
## ##
## Flags related to CPU, optimizations, etc ##
## GPU based optimization later in the make file ##
## ##
################################################################################
################################################################################
CC=/usr/x86_64-pc-linux-gnu/gcc-bin/13/gcc
FC=/usr/x86_64-pc-linux-gnu/gcc-bin/13/gfortran
ALLFLAGS = -march=native -g -O0 ## debugging -pg
ALLFLAGS = -march=native -O2 ## conservative
ALLFLAGS = -march=native -O3 -Wall -flto # -fcommon -fprofile-generate -fprofile-use
#ALLFLAGS = -march=native -O3 -Wall -flto -fprofile-generate -fprofile-dir=/dev/shm
#ALLFLAGS = -march=native -O3 -Wall -flto -fprofile-use -fprofile-dir=/dev/shm
CFLAGS=$(ALLFLAGS)
FFLAGS=$(ALLFLAGS) -fno-stack-protector -fallow-argument-mismatch
## Integer8. Note at least Arpack and Pardiso need to be compiled for
## Integer8 as well. Spooles does not appear to be int8 according to Guido
# LONGLONG = -DLONGLONG
# CFLAGS += $(LONGLONG)
# FFLAGS += -fdefault-integer-8
# INTEXT = 64
## Other CCX Options
CFLAGS += -DARCH="Linux" -DMATRIXSTORAGE
LDFLAGS +=
## Multi Threaded and MPI
CFLAGS += -DUSE_MT
#CFLAGS += -DCALCULIX_MPI
FFLAGS += -fopenmp
## This is now default for calculix and relates to CFD
CFLAGS += -DNETWORKOUT
################################################################################
################################################################################
## ##
## Flags related to CPU based solvers ##
## ##
################################################################################
################################################################################
## SPOOLES
## CFLAGS += -I/usr/include/spooles -I/usr/include/spooles/MT -DSPOOLES
## LDFLAGS += -lspooles -lpthread
CFLAGS += `pkg-config --cflags spooles` -DSPOOLES
LDFLAGS += `pkg-config --libs spooles`
## ARPACK
## CFLAGS += -DARPACK
## LDFLAGS += -larpack
CFLAGS += `pkg-config --cflags arpack$(INTEXT)` -DARPACK
LDFLAGS += `pkg-config --libs arpack$(INTEXT)`
## TAUCS
## CFLAGS += -DTAUCS
## LDFLAGS += -ltaucs -lmetis
## LAPACK
## CFLAGS += -I/usr/include/openblas
## LDFLAGS += -lreflapack -lopenblas
CFLAGS += `pkg-config --cflags lapack$(INTEXT)`
LDFLAGS += `pkg-config --libs lapack$(INTEXT)`
## BLAS
## CFLAGS += -I/usr/include/openblas
## LDFLAGS += -lopenblas
CFLAGS += `pkg-config --cflags blas$(INTEXT)`
LDFLAGS += `pkg-config --libs blas$(INTEXT)`
## Assuming MKL pardiso since pardiso not generally distributed anymore
## https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html
## PARDISO
## CFLAGS += `pkg-config --cflags pardiso` -DPARDISO
## LDFLAGS += `pkg-config --libs pardiso`
CFLAGS += -I${MKLROOT}/include/intel64/ilp64 -I${MKLROOT}/include -DPARDISO ## -fdefault-integer-8 -m64
FFLAGS += -I${MKLROOT}/include/intel64/ilp64 -I${MKLROOT}/include ## -fdefault-integer-8 -m64
## 64bit ints gfortran openmp libgomp on gentoo
## LDFLAGS += -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_gf_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
## 32bit ints gfortran openmp libgomp
LDFLAGS += -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
################################################################################
################################################################################
## ##
## Flags related to GPU based solvers ##
## ##
################################################################################
################################################################################
## Flags for the gpu compiler
## NVCCCFLAGS = -arch=sm_35
## NVCCLDFLAGS = -lstdc++
##
## NVCC=nvcc -O3 $(LONGLONG) `pkg-config --cflags cusp` `pkg-config --libs cusp` $(NVCCCFLAGS) # -Xcompiler -fopenmp
## CUDACUSP
## This is unique because it a template library rather than binary library
## CFLAGS += -I/home/pete/local/include -L/opt/cuda/lib64 -lcuda -lcudart -DCUDACUSP
## LDFLAGS += -L/opt/cuda/lib64 -lcuda -lcudart
## CFLAGS += `pkg-config --cflags cusp` `pkg-config --libs cusp` -DCUDACUSP
## LDFLAGS += `pkg-config --libs cusp`
## CHOLDMOD
## This is unique because it can be CPU or GPU based, depending on how
## SuiteSparse was compiled. Here it is assumed that SuiteSparse also
## uses CUDA
## CFLAGS += -DSUITESPARSE
## LDFLAGS += `pkg-config --libs cublas$(INTEXT)`
## LDFLAGS += `pkg-config --libs cholmod$(INTEXT)`
## LDFLAGS += `pkg-config --libs metis$(INTEXT)`
## LDFLAGS += `pkg-config --libs colamd$(INTEXT)`
## LDFLAGS += `pkg-config --libs ccolamd$(INTEXT)`
## LDFLAGS += `pkg-config --libs amd$(INTEXT)`
## LDFLAGS += `pkg-config --libs camd$(INTEXT)`
## LDFLAGS += `pkg-config --libs rbio$(INTEXT)`
## LDFLAGS += `pkg-config --libs ldl$(INTEXT)`
## LDFLAGS += `pkg-config --libs cxsparse$(INTEXT)`
## LDFLAGS += `pkg-config --libs btf$(INTEXT)`
################################################################################
################################################################################
## ##
## Flags related to ExodusII output ##
## ##
################################################################################
################################################################################
## EXODUSII
## CFLAGS += -DEXODUSII
## LDFLAGS += -lexoIIv2c -lnetcdf
CFLAGS += `pkg-config --cflags exodusii` -DEXODUSII
LDFLAGS += `pkg-config --libs exodusii`
################################################################################
################################################################################
## ##
## Recipes ##
## ##
################################################################################
################################################################################
## .cu file so not have a default implicit rule. Define all implicit rules used.
.SUFFIXES: .o .c .cu
.c.o :
$(CC) $(CFLAGS) -c $<
.f.o :
$(FC) $(FFLAGS) -c $<
.cu.o:
$(NVCC) -DCUDACUSP -c $<
include Makefile.inc
SCCXMAIN = ccx_2.22.c
## Define all the object file rules to identify dependencies
OCCXCU = $(SCCXCU:.cu=.o)
OCCXF = $(SCCXF:.f=.o)
OCCXC = $(SCCXC:.c=.o)
OCCXMAIN = $(SCCXMAIN:.c=.o)
## Link to math and standard c
CFLAGS += -lm -lc
ccx_2.22: $(OCCXMAIN) ccx_2.22.a
#./date.pl;
$(CC) $(CFLAGS) -c ccx_2.22.c $(LDFLAGS); $(FC) -Wall $(FFLAGS) -o $@ $(OCCXMAIN) ccx_2.22.a $(LDFLAGS)
ccx_2.22.a: $(OCCXF) $(OCCXC)
ar vr $@ $?
clean:
rm *.a *.o