Ticket #14: makefile.mom

File makefile.mom, 6.7 KB (added by wintermute, 9 years ago)
Line 
1SHELL = /bin/bash
2## name of the executable
3EXECNAME = flexwrf30
4#
5############## NETCDF library path #################
6#NETCDF = /wrk/d0/jbrioude/netcdf-3.6.2/lib
7NETCDF = /home/modelstation/pgnetcdf
8
9# NetCDF library version 3 or 4. Version 4 is much better for compression
10NETCDFVERSION=3
11
12############### Specify the compiler you want
13# COMPILER options --- gnu, pgi, intel
14COMPILER = pgi
15
16########  Unless you want to change compiler options, you shouldn't have
17########  to change anything in this section
18################################################################
19GNU_FFLAGS  =  -m64 -mcmodel=medium -fconvert=little-endian -finit-local-zero -fno-range-check
20GNU_LDFLAGS = -m64 -mcmodel=medium -fconvert=little-endian -finit-local-zero -lnetcdf -fno-range-check
21
22#PGI_FFLAGS  = -fastsse -mcmodel=medium -traceback -Mbounds -Mchkfpstk -Mchkptr -Mchkstk 
23#PGI_FFLAGS  = -fastsse -mcmodel=medium -tp=nehalem-64
24 PGI_FFLAGS  = -fastsse -mcmodel=medium
25#PGI_LDFLAGS = -fastsse -mcmodel=medium -traceback -Mbounds -Mchkfpstk -Mchkptr -Mchkstk -lnetcdff -Kieee
26#PGI_LDFLAGS = -fastsse -mcmodel=medium -traceback -Mbounds -Mchkfpstk -Mchkptr -Mchkstk -lnetcdff
27 PGI_LDFLAGS = -fastsse -mcmodel=medium -lnetcdf
28
29INTEL_FFLAGS  = -mcmodel=medium -shared-intel  -debug all
30INTEL_LDFLAGS = -mcmodel=medium -shared-intel -lnetcdff  -debug all
31################################################################
32
33
34##############  You shouldn't need to change anything below here
35#+++++++++++++++++++++++++++++++++++++++++++++++++++++
36
37
38
39
40BASENAME=$(EXECNAME)_$(COMPILER)
41
42ifeq ($(COMPILER), pgi)
43        FCSER      = pgf90
44        FCOMP      = pgf90 -mp
45        FCMPI      = pgf90 -mp
46#        NETCDF = /wrk/d0/jbrioude/netcdf-3.6.2/lib/
47
48        FFLAGS= -I${NETCDF}/include $(PGI_FFLAGS)
49        LDFLAGS= -L${NETCDF}/lib $(PGI_LDFLAGS)
50        ISNAN_OBJ = isnan_other.o
51endif
52
53
54ifeq ($(COMPILER), gnu)
55        FCSER      = gfortran
56        FCOMP      = gfortran -fopenmp
57        FCMPI      = gfortran -fopenmp
58#        NETCDF = /apps/netcdf/4.1.3-pgi
59
60        FFLAGS= -I${NETCDF}/include $(GNU_FFLAGS)
61        LDFLAGS= -L${NETCDF}/lib $(GNU_LDFLAGS)
62        ISNAN_OBJ = isnan_gfortran.o
63endif
64
65
66ifeq ($(COMPILER), intel)
67        FCSER      = ifort
68        FCOMP      = ifort -openmp
69        FCMPI      = ifort -openmp
70#        NETCDF = /apps/netcdf/4.1.3-intel
71
72        FFLAGS= -I${NETCDF}/include $(INTEL_FFLAGS)
73        LDFLAGS= -L${NETCDF}/lib $(INTEL_LDFLAGS)
74        ISNAN_OBJ = isnan_other.o
75endif
76
77
78NETCDF_OBJ = write_ncheader.o   write_ncinfo.o \
79
80ifeq ($(NETCDFVERSION), 3)
81
82        NETCDF_OBJ = write_ncheader_v3.o        write_ncinfo_v3.o \
83
84endif
85
86ifeq ($(MAKECMDGOALS),serial)
87        FC=$(FCSER)
88        MAIN=$(BASENAME)_serial
89        FFLAGS2=$(FFLAGS)
90        LDFLAGS2=$(LDFLAGS)
91endif
92ifeq ($(MAKECMDGOALS),omp)
93        FC=$(FCOMP)
94        MAIN=$(BASENAME)_omp
95        FFLAGS2=$(FFLAGS)
96        LDFLAGS2=$(LDFLAGS) -lpthread
97endif
98ifeq ($(MAKECMDGOALS),mpi)
99        FC=$(FCMPI)
100        MAIN=$(BASENAME)_mpi
101        FFLAGS2=$(FFLAGS) -I${MPI_ROOT}/include
102        LDFLAGS2=$(LDFLAGS) -lpthread -L${MPI_ROOT}/lib -lmpi
103endif
104
105
106
107#.SUFFIXES: .o .f90
108#
109#.f90.o:
110#       $(FC) -c $(FCFLAGS) $*.f90
111
112MODOBJS = \
113par_mod.o               com_mod.o \
114conv_mod.o              hanna_mod.o \
115interpol_mod.o          cmapf_mod.o \
116unc_mod.o               oh_mod.o \
117xmass_mod.o             flux_mod.o \
118point_mod.o             outg_mod.o \
119kftable_mod.o           wrf_map_utils_mod.o \
120ran_mod.o               mpi_mod.o \
121mt_kind_defs.o          mt_stream.o
122#
123OBJECTS = assignland.o  writeheader.o \
124calcpar.o               part0.o \
125caldate.o               partdep.o \
126coordtrafo.o            psih.o \
127                        raerod.o \
128dynamic_viscosity.o     random.o \
129initial_cond_output.o   initial_cond_calc.o\
130outgrid_init_irreg.o    outgrid_init_reg.o\
131releaseparticles_irreg.o        releaseparticles_reg.o\
132conccalc_irreg.o        conccalc_reg.o\
133erf.o                   \
134ew.o                    \
135advance.o               readdepo.o \
136psim.o     \
137readlanduse.o \
138getfields.o             init_domainfill.o\
139interpol_wind.o         \
140interpol_all.o          ohreaction.o \
141getrb.o                 get_settling.o \
142getrc.o                 readohfield.o \
143getvdep.o               getvdep_nests.o \
144interpol_misslev.o      readwind.o \
145richardson.o \
146scalev.o \
147pbl_profile.o           \
148juldate.o               \
149interpol_vdep.o         interpol_rain.o \
150verttransform.o         partoutput.o \
151hanna.o                 wetdepokernel.o \
152mean.o                  wetdepo.o \
153hanna_short.o           windalign.o \
154obukhov.o               gridcheck.o \
155hanna1.o                initialize.o \
156cmapf1.0.o              \
157                        calcpar_nests.o \
158verttransform_nests.o   interpol_all_nests.o \
159interpol_wind_nests.o   interpol_misslev_nests.o \
160interpol_vdep_nests.o   interpol_rain_nests.o \
161readpartpositions.o \
162calcfluxes.o            fluxoutput.o \
163qvsat.o                 skplin.o \
164convmix.o               calcmatrix.o \
165convect43c.o               redist.o \
166sort2.o                 distance.o \
167centerofmass.o          plumetraj.o \
168openouttraj.o           calcpv.o \
169calcpv_nests.o          distance2.o \
170clustering.o            interpol_wind_short.o \
171interpol_wind_short_nests.o shift_field_0.o \
172shift_field.o           \
173openreceptors.o         boundcond_domainfill.o\
174gridcheck_nests.o \
175readwind_nests.o        \
176outgrid_init_nest_reg.o outgrid_init_nest_irreg.o \
177outgrid_init_nest.o     writeheader_nest.o \
178wetdepokernel_nest.o \
179drydepokernel_nest.o    drydepokernel.o \
180concoutput_irreg.o      concoutput_reg.o\
181concoutput_nest_irreg.o concoutput_nest_reg.o\
182read_ncwrfout.o         map_proj_wrf.o \
183map_proj_wrf_subaa.o    readinput.o \
184tke_partition_hanna.o  tke_partition_my.o \
185redist_kf.o pre_redist_kf.o\
186convection_kfeta.o convmix_kfeta.o \
187readwind_timeav.o \
188readwind_nests_timeav.o  \
189gf2xe.o                 f_get_coeff.o \
190ranlux.o \
191initialize_cbl_vel.o \
192gasdevlux.o \
193cbl.o                   re_initialize_particle.o \
194write_ncconc.o \
195check_ncerror.o         
196
197MPI_ONLY_OBJS = sendreal_mpi.o          senddouble_mpi.o \
198                sendint_mpi.o           sendint2_mpi.o \
199                sendreal2d_mpi.o        flexwrf_mpi.o  \
200                timemanager_mpi.o       senddrydep_mpi.o \
201                senddrydep_nest_mpi.o \
202
203SERIAL_ONLY_OBJS = flexwrf.o          timemanager_serial.o \
204
205OMP_ONLY_OBJS = flexwrf.o          timemanager.o \
206
207
208serial: $(MODOBJS) $(OBJECTS) $(SERIAL_ONLY_OBJS) $(ISNAN_OBJ) $(NETCDF_OBJ)
209#       echo 'Pure serial not supported - use omp'
210#       exit
211        $(FC) *.o -o $(MAIN) $(LDFLAGS2)
212
213omp: $(MODOBJS) $(OBJECTS) $(OMP_ONLY_OBJS) $(ISNAN_OBJ) $(NETCDF_OBJ)
214        $(FC) *.o -o $(MAIN) $(LDFLAGS2)
215
216mpi: $(MODOBJS) $(OBJECTS) $(MPI_ONLY_OBJS) $(ISNAN_OBJ) $(NETCDF_OBJ)
217        echo 'Compiling MPI'
218        $(FC) *.o -o $(MAIN) $(LDFLAGS2)
219
220$(OBJECTS): $(MODOBJS)
221$(MPI_ONLY_OBJECTS): $(MODOBJS)
222$(SERIAL_ONLY_OBJECTS): $(MODOBJS)
223
224%.o: %.f90
225        $(FC) -c $(FFLAGS2) $<
226
227# This is here because of a single source file, erf.f
228%.o: %.f
229        $(FC) -c $(FFLAGS2) $<
230
231clean:
232        rm *.o *.mod
233
hosted by ZAMG