From f2588d33398ebdb098b27f0a6a57d7c5a249c075 Mon Sep 17 00:00:00 2001
From: Juan ESCOBAR <juan.escobar@aero.obs-mip.fr>
Date: Mon, 20 Nov 2023 17:42:50 +0100
Subject: [PATCH] Juan 20/11/2023: Rules.LXcray.mk/configure , For
 CraY+OpenACC+AMD GPU , add OPTLEVEL=OPENACCO2 , like NVIDIA , without debug
 symbol for performance

---
 src/Rules.LXcray.mk | 64 ++++++++++++++++-----------------------------
 src/configure       |  2 +-
 2 files changed, 23 insertions(+), 43 deletions(-)

diff --git a/src/Rules.LXcray.mk b/src/Rules.LXcray.mk
index 673d668ef..dd2699027 100644
--- a/src/Rules.LXcray.mk
+++ b/src/Rules.LXcray.mk
@@ -14,9 +14,9 @@ CFV=$(shell crayftn --version | grep -E -m1 -o ' [[:digit:]\.]{2,}( |$$)'  | sed
 #OBJDIR_PATH=/home/escj/azertyuiopqsdfghjklm/wxcvbn/azertyuiopqsdfghjklmwxcvbn
 #
 OPT_BASE   =  -hpic -emf -h acc_model=auto_async_none:no_fast_addr:no_deep_copy -halias=none
-OPT_PERF0  =  -G0 -O0 
-OPT_PERF1  =  -G2 -O1 -hflex_mp=intolerant -Ofp0 -hnofma -hnoomp -K trap=fp -hipa0 
-OPT_PERF2  =  -G2 -O2 -hflex_mp=intolerant -Ofp0 -hnofma -hnoomp -hipa0 
+OPT_PERF0  =  -O0 
+OPT_PERF1  =  -O1 -hflex_mp=intolerant -Ofp0 -hnofma -hnoomp -K trap=fp -hipa0 
+OPT_PERF2  =  -O2 -hflex_mp=intolerant -Ofp0 -hnofma -hnoomp -hipa0 
 #
 OPT_NOOPENACC     = -hnoacc
 OPT_OPENACC       = -hacc
@@ -61,74 +61,54 @@ endif
 ifeq "$(OPTLEVEL)" "OPENACC"
 MNH_BITREP_OMP=YES
 CPPFLAGS    += -DMNH_OPENACC -DMNH_GPUDIRECT
+OPT       = -G2 $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC)
+OPT0      = -G0 $(OPT_BASE) $(OPT_PERF0) $(OPT_OPENACC)
+OPT_NOCB  = -G2 $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC)
+
+OBJS_CONCURRENT=spll_multigrid.o spll_turb_ver_thermo_flux.o
+$(OBJS_CONCURRENT) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC) -h concurrent -rimo
+
+OBJS0 += spll_ini_model_n.o
+endif
+#
+ifeq "$(OPTLEVEL)" "OPENACCO2"
+MNH_BITREP_OMP=YES
+CPPFLAGS    += -DMNH_OPENACC -DMNH_GPUDIRECT
 OPT       = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC)
 OPT0      = $(OPT_BASE) $(OPT_PERF0) $(OPT_OPENACC)
 OPT_NOCB  = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC)
-#CXXFLAGS = -fopenmp
-#OBJS_REPROD= spll_mode_sum_ll.o
-#$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC) -Mvect=nosimd -Minfo=all -g
-#OBJS_O1_OPENACC= spll_ice4_tendencies.o spll_turb_ver_thermo_flux.o
-#OBJS_O1_OPENACC= spll_rain_ice_red.o
-#$(OBJS_O1_OPENACC) : OPT = $(OPT_BASE) $(OPT_PERF0) $(OPT_OPENACC)
-
-#OBJS_ASYNAll=spll_turb_ver_thermo_flux.o spll_turb_ver_thermo_corr.o spll_turb_ver_dyn_flux.o \
-#             spll_turb_hor_uv.o spll_turb_hor_uw.o spll_turb_hor_vw.o spll_mode_turb.o\
-#             spll_turb_hor_dyn_corr.o spll_turb_hor_thermo_flux.o spll_turb_hor_sv_corr.o  
-# spll_mode_turb.o spll_p_abs.o spll_advection_metsv.o \
-#             spll_advection_uvw.o spll_resolved_cloud.o
-#$(OBJS_ASYNAll) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC) -h acc_model=auto_async_all
 
 OBJS_CONCURRENT=spll_multigrid.o spll_turb_ver_thermo_flux.o
-#spll_resolved_cloud.o 
 $(OBJS_CONCURRENT) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC) -h concurrent -rimo
-OBJS0 += spll_ini_model_n.o
 
+OBJS0 += spll_ini_model_n.o
 endif
-ifeq "$(OPTLEVEL)" "OPENACCNOBITREP"
+#
+ifeq "$(OPTLEVEL)" "OPENACCO2NOBITREP"
 #MNH_BITREP_OMP=YES
 CPPFLAGS    += -DMNH_OPENACC -DMNH_GPUDIRECT
 OPT       = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC)
 OPT0      = $(OPT_BASE) $(OPT_PERF0) $(OPT_OPENACC)
 OPT_NOCB  = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC)
-#CXXFLAGS = -fopenmp
-#OBJS_REPROD= spll_mode_sum_ll.o
-#$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC) -Mvect=nosimd -Minfo=all -g
-#OBJS_O1_OPENACC= spll_ice4_tendencies.o spll_turb_ver_thermo_flux.o
-#OBJS_O1_OPENACC= spll_rain_ice_red.o
-#$(OBJS_O1_OPENACC) : OPT = $(OPT_BASE) $(OPT_PERF0) $(OPT_OPENACC)
 
-#OBJS_ASYNAll=spll_turb_ver_thermo_flux.o spll_turb_ver_thermo_corr.o spll_turb_ver_dyn_flux.o \
-#             spll_turb_hor_uv.o spll_turb_hor_uw.o spll_turb_hor_vw.o spll_mode_turb.o\
-#             spll_turb_hor_dyn_corr.o spll_turb_hor_thermo_flux.o spll_turb_hor_sv_corr.o  
-# spll_mode_turb.o spll_p_abs.o spll_advection_metsv.o \
-#             spll_advection_uvw.o spll_resolved_cloud.o
-#$(OBJS_ASYNAll) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC) -h acc_model=auto_async_all
-
-OBJS_CONCURRENT=spll_multigrid.o spll_turb_ver_thermo_flux.o
-# spll_resolved_cloud.o 
+OBJS_CONCURRENT=spll_multigrid.o spll_turb_ver_thermo_flux.o 
 $(OBJS_CONCURRENT) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_OPENACC) -h concurrent -rdimo
 
+OBJS0 += spll_ini_model_n.o
 endif
 #
-
-ifeq "$(OPTLEVEL)" "OPENACCDEFONLY"
+ifeq "$(OPTLEVEL)" "OPENACCO2DEFONLY"
 MNH_BITREP_OMP=YES
 CPPFLAGS    += -DMNH_OPENACC -D_FAKEOPENACC
 OPT       = $(OPT_BASE) $(OPT_PERF2) $(OPT_NOOPENACC)  
 OPT0      = $(OPT_BASE) $(OPT_PERF0) $(OPT_NOOPENACC) 
 OPT_NOCB  = $(OPT_BASE) $(OPT_PERF2) $(OPT_NOOPENACC)
-#CXXFLAGS = -Kieee -Mnofma $(OPT_NOOPENACC)
-#OBJS_REPROD= spll_mode_sum_ll.o
-#$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_NOOPENACC) -Mvect=nosimd -Minfo=all -g
 endif
 #
 ifeq "$(OPTLEVEL)" "NOOPENACC"
 OPT       = $(OPT_BASE) $(OPT_PERF2) $(OPT_NOOPENACC)
 OPT0      = $(OPT_BASE) $(OPT_PERF0) $(OPT_NOOPENACC)
 OPT_NOCB  = $(OPT_BASE) $(OPT_PERF2) $(OPT_NOOPENACC)
-#CXXFLAGS = -Kieee -Mnofma $(OPT_NOOPENACC)
-#OBJS_REPROD= spll_mode_sum_ll.o
-#$(OBJS_REPROD) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_NOOPENACC) -Mvect=nosimd -Minfo=all -g
 endif
 #
 ifeq "$(OPTLEVEL)" "O2NOVEC"
diff --git a/src/configure b/src/configure
index 4d89e5f5b..727f01228 100755
--- a/src/configure
+++ b/src/configure
@@ -77,7 +77,7 @@ module list
 'Linux login'*)  # Adastra MI250
                 export ARCH=${ARCH:-LXcray}
                 export VER_MPI=${VER_MPI:-MPICRAY}
-                export OPTLEVEL=${OPTLEVEL:-OPENACC}
+                export OPTLEVEL=${OPTLEVEL:-OPENACCO2}
                 export MVWORK=${MVWORK:-NO}
                 export VER_CDF=${VER_CDF:-CDFAUTO}
 	
-- 
GitLab