1 | # L. Fita, LMD. October 2016 |
---|
2 | # Compilation of all required Fortran modules in `camelot' with gcc compilers |
---|
3 | # A following python 'library' creation is required |
---|
4 | |
---|
5 | # FOLLOWING: http://stackoverflow.com/questions/17156125/f2py-exposing-parameters-from-used-modules |
---|
6 | # FOLLOWING: http://osdir.com/ml/python.f2py.user/2006-08/msg00019.html |
---|
7 | # module load gnu/4.4.7 |
---|
8 | # module load python/2.7-anaconda |
---|
9 | # export LD_LIBRARY_PATH=/opt/anaconda/lib/:$LD_LIBRARY_PATH |
---|
10 | # Diagnostics compilation _______ |
---|
11 | # f2py -m module_ForDiag -h module_ForDiag.pyf module_generic.f90 module_ForDiagnosticsVars.f90 module_ForDiagnostics.f90 >& run_f2py_ForDiag_wrapper.log |
---|
12 | # make |
---|
13 | # f2py -L/opt/anaconda/lib/ -m module_ForDiag -c --fcompiler=gnu95 module_ForDiag.pyf module_generic.f90 module_ForDiagnosticsVars.f90 module_ForDiagnostics.f90 >& run_f2py_ForDiag_compile.log |
---|
14 | # Interpolation compilation _______ |
---|
15 | # f2py -m module_ForInt -h module_ForInt.pyf module_generic.f90 module_ForInterpolate.f90 >& run_f2py_ForInt_wrapper.log |
---|
16 | # f2py -L/opt/anaconda/lib/ -m module_ForInt -c --fcompiler=gnu95 module_ForInt.pyf module_generic.f90 module_ForInterpolate.f90 >& run_f2py_ForInt_compile.log |
---|
17 | # |
---|
18 | # using netcdf4.3.3.1gfortran |
---|
19 | ## module load netcdf4/4.3.3.1-gfortran |
---|
20 | |
---|
21 | FC = /usr/bin/gfortran |
---|
22 | FCF = -c -fPIC |
---|
23 | LIB_INC = |
---|
24 | RM = rm -f |
---|
25 | F2PY = /opt/canopy-1.3.0/Canopy_64bit/User/bin/f2py -L/opt/anaconda/lib/ --fcompiler=gnu95 |
---|
26 | #DBGFLAGS = -g -Wall -Wextra -Warray-temporaries -Wconversion -fimplicit-none -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=zero,overflow,underflow -finit-real=nan |
---|
27 | NCLIBFOLD = /opt/netcdf43/gfortran/bin/ |
---|
28 | NCINCFOLD = /opt/netcdf43/gfortran/include/ |
---|
29 | LIB_NETCDF = -L$(NCLIBFOLD) -lnetcdff -lnetcdf -I$(NCINCFOLD) -static-libgfortran |
---|
30 | |
---|
31 | FCFLAGS = $(FCF) $(DBGFLAGS) |
---|
32 | |
---|
33 | # Sources for f2py |
---|
34 | srcs = module_definitions.f90 module_basic.f90 module_generic.f90 module_scientific.f90 |
---|
35 | distrisrcs = $(srcs) module_DistriCorrection.f90 |
---|
36 | diagsrcs = $(srcs) module_ForDiagnosticsVars.f90 module_ForDiagnostics.f90 |
---|
37 | intsrcs = $(srcs) module_ForInterpolate.f90 |
---|
38 | scisrcs = $(srcs) |
---|
39 | defsrcs = module_definitions.f90 |
---|
40 | |
---|
41 | ####### ###### ##### #### ### ## # |
---|
42 | |
---|
43 | MODULES = \ |
---|
44 | module_definitions.o \ |
---|
45 | module_basic.o \ |
---|
46 | module_generic.o \ |
---|
47 | module_NCgeneric.o \ |
---|
48 | module_scientific.o \ |
---|
49 | module_ForInterpolate.o \ |
---|
50 | module_ForDiagnosticsVars.o \ |
---|
51 | module_ForDiagnostics.o \ |
---|
52 | module_DistriCorrection.o |
---|
53 | |
---|
54 | FINTMODULES = \ |
---|
55 | module_definitions.o \ |
---|
56 | module_basic.o \ |
---|
57 | module_generic.o \ |
---|
58 | module_scientific.o \ |
---|
59 | module_ForInterpolate.o |
---|
60 | |
---|
61 | all : \ |
---|
62 | module_ForDiagnostics.o \ |
---|
63 | interpolate.o \ |
---|
64 | DistriCorrection.o \ |
---|
65 | pydistrimods.o \ |
---|
66 | pydiagmods.o \ |
---|
67 | pyintmods.o \ |
---|
68 | pyscimods.o \ |
---|
69 | pydefmods.o \ |
---|
70 | trajectories_overlap.o |
---|
71 | |
---|
72 | diags : \ |
---|
73 | module_ForDiagnostics.o |
---|
74 | |
---|
75 | clean : |
---|
76 | $(RM) *.mod *.o interpolate module_ForDiag.so module_ForInt.so module_ForDistriCorrect.so module_ForSci.so module_ForDef.so |
---|
77 | |
---|
78 | ######## ####### |
---|
79 | ## |
---|
80 | ######## |
---|
81 | |
---|
82 | module_definitions.o: |
---|
83 | $(FC) $(FCFLAGS) module_definitions.f90 |
---|
84 | |
---|
85 | module_basic.o: module_definitions.o |
---|
86 | $(FC) $(FCFLAGS) module_basic.f90 |
---|
87 | |
---|
88 | module_generic.o: module_definitions.o module_basic.o |
---|
89 | $(FC) $(FCFLAGS) $(LIB_INC) module_generic.f90 |
---|
90 | |
---|
91 | module_NCgeneric.o: module_definitions.o module_basic.o module_generic.o |
---|
92 | $(FC) $(FCFLAGS) $(LIB_NETCDF) $(LIB_INC) module_NCgeneric.f90 |
---|
93 | |
---|
94 | module_scientific.o: module_definitions.o module_basic.o module_generic.o |
---|
95 | $(FC) $(FCFLAGS) module_scientific.f90 |
---|
96 | |
---|
97 | module_ForInterpolate.o: module_definitions.o module_generic.o |
---|
98 | $(FC) $(FCFLAGS) $(LIB_INC) module_ForInterpolate.f90 |
---|
99 | |
---|
100 | module_ForDiagnosticsVars.o: module_definitions.o module_basic.o module_generic.o |
---|
101 | $(FC) $(FCFLAGS) $(LIB_INC) module_ForDiagnosticsVars.f90 |
---|
102 | |
---|
103 | module_ForDiagnostics.o: module_definitions.o module_basic.o module_generic.o module_ForDiagnosticsVars.o |
---|
104 | $(FC) $(FCFLAGS) $(LIB_INC) module_ForDiagnostics.f90 |
---|
105 | |
---|
106 | module_DistriCorrection.o: module_definitions.o module_basic.o module_generic.o module_scientific.o |
---|
107 | $(FC) $(FCFLAGS) module_DistriCorrection.f90 |
---|
108 | |
---|
109 | FCEXEFINTCFLAGS = $(FINTMODULES) $(LIB_NETCDF) $(LIB_INC) |
---|
110 | FCEXECFLAGS = $(MODULES) $(LIB_NETCDF) $(LIB_INC) |
---|
111 | |
---|
112 | interpolate.o: module_definitions.o module_basic.o module_generic.o module_scientific.o module_ForInterpolate.o |
---|
113 | $(FC) $(FCEXEFINTCFLAGS) interpolate.f90 -o interpolate |
---|
114 | |
---|
115 | DistriCorrection.o: module_definitions.o module_basic.o module_generic.o module_NCgeneric.o module_scientific.o module_DistriCorrection.o |
---|
116 | $(FC) $(FCEXECFLAGS) DistriCorrection.f90 -o DistriCorrection |
---|
117 | |
---|
118 | pydistrimods.o: |
---|
119 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForDistriCorrect $(distrisrcs) -L$(NCLIBFOLD) |
---|
120 | |
---|
121 | pydiagmods.o: |
---|
122 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForDiag $(diagsrcs) -L$(NCLIBFOLD) |
---|
123 | |
---|
124 | pyintmods.o: |
---|
125 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForInt $(intsrcs) -L$(NCLIBFOLD) |
---|
126 | |
---|
127 | pyscimods.o: |
---|
128 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForSci $(scisrcs) -L$(NCLIBFOLD) |
---|
129 | |
---|
130 | pydefmods.o: |
---|
131 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForDef $(defsrcs) -L$(NCLIBFOLD) |
---|
132 | |
---|
133 | trajectories_overlap.o: module_definitions.o module_basic.o module_generic.o module_NCgeneric.o module_scientific.o |
---|
134 | $(FC) $(FCEXECFLAGS) trajectories_overlap.f90 -o trajectories_overlap |
---|