Forked from
Méso-NH / Méso-NH code
2287 commits behind, 1261 commits ahead of the upstream repository.
-
WAUTELET Philippe authored
Philippe 12/09/2023: remove key MNH_PGI (not useful anymore, was to workaround an bug in very old version of PGI compiler)
WAUTELET Philippe authoredPhilippe 12/09/2023: remove key MNH_PGI (not useful anymore, was to workaround an bug in very old version of PGI compiler)
Rules.LXpgi.mk 6.86 KiB
#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
#MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
#MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
#MNH_LIC for details. version 1.
##########################################################
# #
# Compiler Options #
# #
##########################################################
#OBJDIR_PATH=${WORKDIR}
#
#Version of CUDA
#(8.0 at least if compute capability >= 6.0)
CUDALEVEL=cuda8.0
#
#Compute capability of GPU
#
OPT_CPTCAP=
#Aeropc45: cc50
#Nuwa: cc35
#Ouessant Firestone K80: cc35
#Ouessant Minsky P100: cc60
#
#Compiler info level
#OPT_INFO = -Minfo=ftn,accel,inline,ipa,loop,lre,mp,opt,par,unified,vect,ccff
OPT_INFO = -Minfo=accel,ccff
#
#Compiler profiling options
OPT_PROF = -Mprof=ccff
#
#PW: if -Ktrap=fp: nvprof/pgprof do not work OPT_BASE = -Ktrap=fp ...
#PW: -g: big impact on performance
OPT_BASE = -Mbackslash -Mextend -Kieee -nofma
#
OPT_PERF0 = -O0
OPT_PERF1 = -O1
OPT_PERF2 = -O2
#
OPT_MANAGED = -ta=tesla,nofma,$(OPT_CPTCAP),$(CUDALEVEL),managed $(OPT_INFO) $(OPT_PROF)
OPT_MULTICORE = -ta=multicore $(OPT_INFO) $(OPT_PROF)
OPT_NOOPENACC = -ta=host $(OPT_INFO) $(OPT_PROF)
OPT_OPENACC = -ta=host,tesla,nofma,$(OPT_CPTCAP),$(CUDALEVEL) $(OPT_INFO) $(OPT_PROF)
#
OPT_CHECK = -C #-Mchkfpstk -Mchkptr
OPT_I8 = -i8
OPT_R8 = -r8
#
IGNORE_OBJS += pgprof.o
#
# Real/integer 4/8 option
#
MNH_REAL ?=8
MNH_INT ?=4
#
ifneq "$(MNH_REAL)" "4"
OPT_BASE += $(OPT_R8)
endif
#
OPT_BASE_I4 := $(OPT_BASE)
ifeq "$(MNH_INT)" "8"
OPT_BASE += $(OPT_I8)
LFI_INT ?=8
else
LFI_INT ?=4
endif
#
#
OPT = $(OPT_BASE) $(OPT_PERF2)
OPT0 = $(OPT_BASE) $(OPT_PERF0)
OPT_NOCB = $(OPT_BASE) $(OPT_PERF2)
#
ifeq "$(OPTLEVEL)" "DEBUG"
OPT = $(OPT_BASE) $(OPT_PERF0) $(OPT_CHECK)
OPT0 = $(OPT_BASE) $(OPT_PERF0) $(OPT_CHECK)
OPT_NOCB = $(OPT_BASE) $(OPT_PERF0)
endif
#
ifeq "$(OPTLEVEL)" "MANAGED"
CPPFLAGS += -DMNH_OPENACC
OPT = $(OPT_BASE) $(OPT_MANAGED) $(OPT_PERF2)
OPT0 = $(OPT_BASE) $(OPT_MANAGED) $(OPT_PERF0)
OPT_NOCB = $(OPT_BASE) $(OPT_MANAGED) $(OPT_PERF2)
CXXFLAGS = -acc -Kieee -Mnofma $(OPT_MANAGED)
endif
#
ifeq "$(OPTLEVEL)" "MULTICORE"
CPPFLAGS += -DMNH_OPENACC
OPT = $(OPT_BASE) $(OPT_MULTICORE)
OPT0 = $(OPT_BASE) $(OPT_MULTICORE) $(OPT_PERF0)
OPT_NOCB = $(OPT_BASE) $(OPT_MULTICORE)
CXXFLAGS = -acc -Kieee -Mnofma $(OPT_MULTICORE)
endif
#
ifeq "$(OPTLEVEL)" "OPENACC"
CPPFLAGS += -DMNH_OPENACC
OPT = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF2)
OPT0 = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF0)
OPT_NOCB = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF2)
CXXFLAGS = -acc -Kieee -Mnofma $(OPT_OPENACC)
OBJS_REPROD= spll_mode_sum_ll.o
$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF2) -Mvect=nosimd -Minfo=all -g
endif
#
ifeq "$(OPTLEVEL)" "OPENACCDEFONLY"
CPPFLAGS += -DMNH_OPENACC -D_FAKEOPENACC
OPT = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF2)
OPT0 = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF0)
OPT_NOCB = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF2)
CXXFLAGS = -Kieee -Mnofma $(OPT_NOOPENACC)
OBJS_REPROD= spll_mode_sum_ll.o
$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF2) -Mvect=nosimd -Minfo=all -g
endif
#
ifeq "$(OPTLEVEL)" "NOOPENACC"
#CPPFLAGS += -D_OPT_LINEARIZED_LOOPS
OPT = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF2)
OPT0 = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF0)
OPT_NOCB = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF2)
CXXFLAGS = -Kieee -Mnofma $(OPT_NOOPENACC)
OBJS_REPROD= spll_mode_sum_ll.o
$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF2) -Mvect=nosimd -Minfo=all -g
endif
#
CC = pgcc
FC = pgf90
ifeq "$(VER_MPI)" "MPIAUTO"
F90 = mpif90
CC = mpicc
CXX = mpicxx
else
F90 = pgf90
CC = pgcc
CXX = pgcxx
endif
#
F77FLAGS = $(OPT)
F77 = $(F90)
F90FLAGS = $(OPT)
FX90 = $(F90)
FX90FLAGS = $(OPT)
#
LDFLAGS = -Wl,-warn-once $(OPT)
#
# preprocessing flags
#
CPP = cpp -P -traditional -Wcomment -D_OPENACC=201711
#
CPPFLAGS_SURFEX =
CPPFLAGS_SURCOUCHE +=
CPPFLAGS_RAD =
CPPFLAGS_NEWLFI = -DSWAPIO -DLINUX -DLFI_INT=${LFI_INT}
CPPFLAGS_MNH = -DMNH -DSFX_MNH
CPPFLAGS_MNH += -Uvector -Upixel
#
# BITREP flags
#
#if MNH_BITREP exists => compile with the BITREP library
MNH_BITREP = YES
ifeq "$(MNH_BITREP)" "YES"
CPPFLAGS_MNH += -DMNH_BITREP
endif
#
# LIBTOOLS flags
#
#if MNH_TOOLS exists => compile the tools
MNH_TOOLS = yes
#
## IOLFI flag
#
#if MNH_IOLFI exists => compile the NEWLFI library (for LFI files)
MNH_IOLFI=yes
#
## COMPRESS flag
#
#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
MNH_COMPRESS=yes
#
## S4PY flag
#
#if MNH_S4PY exists => compile the libs4py library (for epygram)
#MNH_S4PY=no
#
## MGSOLVER flag (multigrid solver)
#
#if MNH_MGSOLVER exists => compile the multigrid solver
MNH_MGSOLVER ?= YES
#
## ecCodes or grib_api selection
#MNH_GRIBAPI: if set to no: use ecCodes
# if set to yes: use grib_api (deprecated library)
#
MNH_GRIBAPI=no
#
##########################################################
# #
# Source of MESONH PACKAGE Distribution #
# #
##########################################################
#DIR_SURFEX += ARCH_SRC/surfex.MNH-462
OBJS_NOCB += spll_isba.o
#
include Makefile.MESONH.mk
#
##########################################################
# #
# extra VPATH, Compilation flag modification #
# systeme module , etc ... #
# external precompiled module librairie #
# etc ... #
# #
##########################################################
OBJS_O1= spll_modd_isba_n.o spll_mode_construct_ll.o \
spll_init_surf_atm_n.o spll_mode_scatter_ll.o spll_convert_patch_teb.o \
spll_define_mask_n.o spll_del1dfield_ll.o spll_mode_fm.o spll_mode_gather_ll.o \
spll_convect_updraft.o spll_convect_updraft_shal.o \
spll_mode_dustopt.o spll_mode_saltopt.o
#spll_pack_isba_patch_n.o
#spll_phys_param_n.o
$(OBJS_O1) : OPT = $(OPT_BASE) $(OPT_PERF1)
OBJS_O0= spll_mode_mppdb.o \
spll_mode_repro_sum.o
# spll_fft55.o spll_fft.o spll_flat_invz.o \
# spll_fast_terms.o
# spll_mode_sum_ll.o
$(OBJS_O0) : OPT = $(OPT_BASE) $(OPT_PERF0)
OBJS_O2= spll_mode_device.o
$(OBJS_O2) : OPT = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF2)
ifneq "$(findstring 8,$(LFI_INT))" ""
OBJS_I8=spll_NEWLFI_ALL.o
$(OBJS_I8) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_I8)
endif
ifeq "$(MNH_INT)" "8"
OBJS_I4=spll_modd_netcdf.o
$(OBJS_I4) : OPT = $(OPT_BASE_I4)
endif