diff --git a/src/Rules.LXpgi2004.mk b/src/Rules.LXpgi2004.mk
index c160330859b516f67101d3cac9851d6f0e74c0ac..c8f6b3297e9635e26f67fd99eb466dc00e456714 100644
--- a/src/Rules.LXpgi2004.mk
+++ b/src/Rules.LXpgi2004.mk
@@ -9,13 +9,18 @@
 ##########################################################
 #OBJDIR_PATH=${WORKDIR}
 #
+# Processor type
+#TP= -tp=sandybridge
+#TP= -tp=px
+TP= -tp=p7-64
+#
 #Version of CUDA
 #(8.0 at least if compute capability >= 6.0)
-CUDALEVEL=cuda10.2
+CUDALEVEL=cuda10.1
 #
 #Compute capability of GPU
 #
-OPT_CPTCAP=cc35,cc50
+OPT_CPTCAP=cc35,cc50,cc70
 #Aeropc45: cc50
 #Nuwa: cc35
 #Ouessant Firestone K80: cc35
@@ -23,28 +28,33 @@ OPT_CPTCAP=cc35,cc50
 #
 #Compiler info level
 #OPT_INFO = -Minfo=ftn,accel,inline,ipa,loop,lre,mp,opt,par,unified,vect,ccff
-OPT_INFO = -Minfo=accel,ccff
+OPT_INFO = -Minfo=accel
 #
 #Compiler profiling options
-OPT_PROF = -Mprof=ccff
+#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_BASE   =  $(TP) -Mbackslash -Mextend -Kieee -nofma  -Mallocatable=95
 #
 OPT_PERF0  =  -O0
 OPT_PERF1  =  -O1
 OPT_PERF2  =  -O2
 #
-OPT_MANAGED   = -g -ta=host,tesla:nofma,$(OPT_CPTCAP),$(CUDALEVEL),managed $(OPT_INFO) $(OPT_PROF)
+OPT_MANAGED   = -Mframe -Mnostack_arrays -Mallocatable=95 -ta=host,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    = -g -ta=host,tesla:nofma,$(OPT_CPTCAP),$(CUDALEVEL) $(OPT_INFO) $(OPT_PROF)
+OPT_OPENACC    = -Mnostack_arrays -Mnostack_arrays -Mallocatable=95 -ta=host,tesla:nofma,$(OPT_CPTCAP),$(CUDALEVEL) $(OPT_INFO) $(OPT_PROF)
 #
 OPT_CHECK  =  -C #-Mchkfpstk -Mchkptr
 OPT_I8     =  -i8
 OPT_R8     =  -r8
 #
+ifeq "$(VER_USER)" "ZSOLVER"
+CPPFLAGS  += -DCARTESIANGEOMETRY -DOVERLAPCOMMS -DPIECEWISELINEAR
+PROG_LIST += MG_MAIN MG_MAIN_MNH_ALL
+endif
+#
 IGNORE_OBJS += pgprof.o
 #
 # Real/integer 4/8 option
@@ -70,17 +80,29 @@ 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)
+OPT       = -g $(OPT_BASE) $(OPT_PERF0) $(OPT_CHECK)
+OPT0      = -g $(OPT_BASE) $(OPT_PERF0) $(OPT_CHECK)
+OPT_NOCB  = -g $(OPT_BASE) $(OPT_PERF0)
 endif
 #
 ifeq "$(OPTLEVEL)" "MANAGED"
 CPPFLAGS    += -DMNH_OPENACC
+OPT       = -g $(OPT_BASE) $(OPT_MANAGED) $(OPT_PERF2)
+OPT0      = -g $(OPT_BASE) $(OPT_MANAGED) $(OPT_PERF0)
+OPT_NOCB  = -g $(OPT_BASE) $(OPT_MANAGED) $(OPT_PERF2) 
+CXXFLAGS = -g -acc -Kieee -Mnofma $(OPT_MANAGED)
+OBJS_REPROD= spll_mode_sum_ll.o
+$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_MANAGED) $(OPT_PERF2) -Mvect=nosimd -Minfo=all -g
+endif
+#
+ifeq "$(OPTLEVEL)" "MANAGEDO2"
+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)
+OBJS_REPROD= spll_mode_sum_ll.o
+$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_MANAGED) $(OPT_PERF2) -Mvect=nosimd -Minfo=all 
 endif
 #
 ifeq "$(OPTLEVEL)" "MULTICORE"
@@ -93,12 +115,22 @@ endif
 #
 ifeq "$(OPTLEVEL)" "OPENACC"
 CPPFLAGS    += -DMNH_OPENACC
-OPT       = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF0)
+# -imacros MNH_OPENACC_SHUMAN_MACRO.CPP
+OPT       = -g $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF0)
+OPT0      = -g $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF0)
+OPT_NOCB  = -g $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF0) 
+CXXFLAGS =  -g -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)" "OPENACCO2"
+CPPFLAGS    += -DMNH_OPENACC
+OPT       = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF2)
 OPT0      = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF0)
-OPT_NOCB  = $(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
+$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF2) -Mvect=nosimd -Minfo=all 
 endif
 #
 ifeq "$(OPTLEVEL)" "OPENACCDEFONLY"
@@ -106,9 +138,9 @@ 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)
+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
+$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF2) -Mvect=nosimd -Minfo=all 
 endif
 #
 ifeq "$(OPTLEVEL)" "NOOPENACC"
@@ -122,6 +154,8 @@ $(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_NOOPENACC) $(OPT_PERF2) -Mvect=nosimd -
 endif
 #
 CC = pgcc
+CXXFLAGS += $(TP)
+CFLAGS   += $(TP)
 FC = pgf90
 ifeq "$(VER_MPI)" "MPIAUTO"
 F90 = mpif90
@@ -159,6 +193,11 @@ CNAME_GRIBEX=_pgf77
 GRIBAPI_CONF="CPP=cpp"
 CDF_CONF="CPP=cpp"
 #
+# Netcdf/HDF5 flags
+#
+HDF_OPT ?= $(TP)
+NETCDF_OPT ?= $(TP)
+#
 # BITREP flags
 #
 #if MNH_BITREP exists => compile with the BITREP library
@@ -201,11 +240,14 @@ include Makefile.MESONH.mk
 #         etc ...                                        #
 #                                                        #
 ##########################################################
-OBJS_O1= spll_modd_isba_n.o spll_mode_construct_ll.o \
+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_mode_dustopt.o spll_mode_saltopt.o \
+         spll_aeroopt_get.o spll_write_lfifm1_for_diag_supp.o spll_write_lfifm1_for_diag.o spll_write_lfifm_n.o \
+
+#spll_unpack_1d_2d_from2d.o
 #spll_pack_isba_patch_n.o 
 #spll_phys_param_n.o
 $(OBJS_O1) : OPT = $(OPT_BASE) $(OPT_PERF1)
@@ -213,9 +255,13 @@ $(OBJS_O1) : OPT = $(OPT_BASE) $(OPT_PERF1)
 OBJS_O0= spll_mode_mppdb.o \
          spll_fft55.o spll_fft.o spll_flat_invz.o \
          spll_mode_repro_sum.o \
-# spll_fast_terms.o 
+         spll_modd_les_n.o
+
+#         spll_fast_terms.o 
+#         spll_modd_ch_solver_n.o \
+#         spll_modd_dummy_gr_field_n.o spll_modd_dyn_n.o 
 # spll_mode_sum_ll.o
-$(OBJS_O0) : OPT = $(OPT_BASE) $(OPT_PERF0)
+$(OBJS_O0) : OPT = -g $(OPT_BASE) $(OPT_PERF0)
 
 OBJS_O2= spll_mode_device.o
 $(OBJS_O2) : OPT = $(OPT_BASE) $(OPT_OPENACC) $(OPT_PERF2)