From a8278abc382f15885468e75e3732da134fb3ecfd Mon Sep 17 00:00:00 2001 From: SM Yang Date: Fri, 13 Jun 2025 16:41:30 -0400 Subject: [PATCH 1/3] Add gcc-compatible version for flux environment --- dcon/sing.f | 20 ++++++++++++++++++-- gpec/gpout.f | 19 +++++++++++++++++-- install/DEFAULTS.inc | 14 ++++++++++++++ install/makefile | 14 ++++++++++++-- 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/dcon/sing.f b/dcon/sing.f index 70e4b2d8..f79bec68 100644 --- a/dcon/sing.f +++ b/dcon/sing.f @@ -252,6 +252,7 @@ END SUBROUTINE sing_lim c declarations. c----------------------------------------------------------------------- SUBROUTINE sing_vmat(ising) + USE, INTRINSIC :: ieee_arithmetic INTEGER, INTENT(IN) :: ising @@ -259,6 +260,8 @@ SUBROUTINE sing_vmat(ising) INTEGER :: ipert0,ipert,k REAL(r8) :: psifac,di,di0,q,q1,rho,dpsi REAL(r8), PARAMETER :: half=.5_r8 + REAL(r8) :: val + COMPLEX(r8) :: det TYPE(sing_type), POINTER :: singp c----------------------------------------------------------------------- @@ -309,8 +312,21 @@ SUBROUTINE sing_vmat(ising) singp%power=0 singp%power(ipert0)=-singp%alpha singp%power(ipert0+mpert)=singp%alpha - WRITE(out_unit,'(i3,1p,7e11.3)')ising,psifac,rho,q,q1,di0, - $ singp%di,singp%di/di0-1 + +! Temporary protection to prevent SIGFPE (division by zero or invalid +! WRITE(out_unit,'(i3,1p,7e11.3)')ising,psifac,rho,q,q1,di0, +! singp%di,singp%di/di0-1 +! di0) + IF (abs(di0) > 1.0e-12 .AND. ieee_is_finite(di0)) THEN + val = singp%di / di0 - 1 + ELSE + val = 0.0_r8 + PRINT *, 'WARNING: di0 is zero or invalid at ising = ', ising, + $ ' di0= ', di0 + ENDIF + + WRITE(out_unit,'(i3,1p,7e11.3)') ising, psifac, rho, q, q1, di0, + $ singp%di, val c----------------------------------------------------------------------- c zeroth-order non-resonant solutions. c----------------------------------------------------------------------- diff --git a/gpec/gpout.f b/gpec/gpout.f index b3d83049..ad5c6cf9 100644 --- a/gpec/gpout.f +++ b/gpec/gpout.f @@ -1975,7 +1975,8 @@ SUBROUTINE gpout_singfld(egnum,xspmn,spot,nspot, aq(ising) = singtype(ising)%q asingflx(ising) = ABS(singflx_mn(resnum(ising),ising)) ENDDO - ierr=set_harvest_payload_dbl_array(hlog,"q"//nul,aq,msing) + ierr=set_harvest_payload_dbl_array(hlog,"q"//nul, + $ aq,msing) ierr=set_harvest_payload_dbl_array(hlog,"singcur"//nul, $ ABS(singcur),msing) ierr=set_harvest_payload_dbl_array(hlog,"singflx"//nul, @@ -5610,6 +5611,7 @@ SUBROUTINE gpout_control_filter(mode,finmn,foutmn,ftypes,fmodes, c----------------------------------------------------------------------- c declaration. c----------------------------------------------------------------------- + USE, INTRINSIC :: ieee_arithmetic INTEGER, INTENT(IN) :: fmodes,rout,bpout,bout,rcout,tout,mode CHARACTER(len=*), INTENT(IN) :: ftypes COMPLEX(r8), DIMENSION(mpert), INTENT(INOUT) :: finmn,foutmn @@ -5765,7 +5767,20 @@ SUBROUTINE gpout_control_filter(mode,finmn,foutmn,ftypes,fmodes, DO i=1,mpert tempm = wvecs(:,i) avals(i) = 0.5*REAL(DOT_PRODUCT(tempm,MATMUL(mat,tempm))) - avals(i) = avals(i)/wvals(i) + + ! Temporary safeguard against division by zero or invalid + ! values (may cause SIGFPE) + !avals(i) = avals(i)/wvals(i) + IF (abs(wvals(i)) > 1.0e-12 .AND. ieee_is_finite(wvals(i))) + $ THEN + avals(i) = avals(i) / wvals(i) + ELSE + avals(i) = 0.0_r8 + ! NOTE: Temporary fix – wvals(i) is zero or NaN/Inf; + ! skipping division to prevent crash + PRINT *, 'WARNING: Skipping division by wvals(', i, ') = ', + $ wvals(i) + END IF ENDDO aindx = (/(i,i=1,mpert)/) CALL isbubble(avals,aindx,1,mpert) diff --git a/install/DEFAULTS.inc b/install/DEFAULTS.inc index 0c561400..df1ac1e2 100644 --- a/install/DEFAULTS.inc +++ b/install/DEFAULTS.inc @@ -331,6 +331,7 @@ #----------------------------------------------------------------- # general defaults #----------------------------------------------------------------- +HOST := $(shell hostname) # The new modules on portal at PPPL now use LAPACK_HOME instead of LAPACKHOME ifndef LAPACKHOME @@ -405,6 +406,10 @@ else endif ifneq ($(wildcard $(NETCDFHOME)/lib/.),) NETCDFDIR = $(NETCDFHOME)/lib + HOST := $(shell hostname) + ifneq (,$(findstring flux,$(HOST))) + NETCDFDIR = $(NETCDFHOME)/lib64 + endif else NETCDFDIR = $(NETCDFHOME) endif @@ -421,6 +426,12 @@ ifdef NETCDF_C_HOME NETCDFLIBS = -lnetcdff NETCDF_C_LIBS = -lnetcdf NETCDF_C_DIR = $(NETCDF_C_HOME)/lib + + HOST := $(shell hostname) + ifneq (,$(findstring flux,$(HOST))) + NETCDF_C_DIR = $(NETCDF_C_HOME)/lib64 + endif + NETCDF_EXTRA_LIBS = -L$(NETCDF_C_DIR) $(NETCDF_C_LIBS) else ifneq ($(shell ls $(NETCDFDIR) | grep netcdff),) @@ -473,3 +484,6 @@ else ifeq ($(findstring pgfortran,$(FC)),pgfortran) else OMPFLAG ?= -openmp endif + + + diff --git a/install/makefile b/install/makefile index 4d180f66..7f6a0bb6 100644 --- a/install/makefile +++ b/install/makefile @@ -1,5 +1,12 @@ +HOST := $(shell hostname) + +ifneq (,$(findstring flux,$(HOST))) +# include /p/transpusers/mgorelen/transp_main/environs/ppplflux/gnu/13.2.0/environ + include /p/transpusers/mgorelen/transp_main/environs/ppplflux/gnu/13.2.0/makefile.mk +else + include DEFAULTS.inc +endif -include DEFAULTS.inc # extend these variables to sub-makes (?= sets a default if user doesn't specify options) FFLAGS ?= -g @@ -9,7 +16,10 @@ export FFLAGS export CFLAGS export OMPFLAG export LDFLAGS - +ifneq (,$(findstring flux,$(HOST))) + FFLAGS := $(filter-out -c,$(FFLAGS)) +endif +FFLAGS := $(filter-out -c,$(FFLAGS)) # compile package .IGNORE: From 0d5f863c604e05fbd402a960997a62de04db2c84 Mon Sep 17 00:00:00 2001 From: Matthew Pharr Date: Wed, 18 Jun 2025 04:04:27 -0400 Subject: [PATCH 2/3] INSTALL - IMPROVEMENT - Brought up to date dependencies in makefiles and added flags to suppress warnings in new icx compiler for xdraw --- dcon/makefile | 2 +- equil/makefile | 4 +- install/DEFAULTS.inc | 7 +++ install/makefile | 110 +++++++++++++++++++++---------------------- pentrc/makefile | 2 +- xdraw/makefile | 3 +- 6 files changed, 69 insertions(+), 59 deletions(-) diff --git a/dcon/makefile b/dcon/makefile index e30706ef..9037aac3 100644 --- a/dcon/makefile +++ b/dcon/makefile @@ -89,7 +89,7 @@ sing.o: fourfit.o debug.o: ../equil/local_mod.mod ode_output.o: dcon_mod.o sing.o debug.o ode.o: ode_output.o free.o -dcon_netcdf.o: dcon_mod.o +dcon_netcdf.o: dcon_mod.o sing.o free.o: ../equil/global_mod.mod dcon_netcdf.o ode_output.o resist.o: dcon_mod.o dcon.o: ../equil/equil_mod.mod ../equil/equil_out_mod.mod \ diff --git a/equil/makefile b/equil/makefile index 859c4b53..df6ab203 100644 --- a/equil/makefile +++ b/equil/makefile @@ -56,9 +56,11 @@ local.o: io.o utils.o: local.o spline.o: local.o grid.o: local.o spline.o -bicube.o: spline.o +bicube.o: local.o spline.o cspline.o: local.o fft.o: local.o +jacobi.o: local.o +cspline.o: local.o spline.o fspline.o: local.o spline.o cspline.o utils.o fft.o global.o: bicube.o cspline.o inverse.o: global.o utils.o grid.o diff --git a/install/DEFAULTS.inc b/install/DEFAULTS.inc index df1ac1e2..3cc9dc3e 100644 --- a/install/DEFAULTS.inc +++ b/install/DEFAULTS.inc @@ -485,5 +485,12 @@ else OMPFLAG ?= -openmp endif +ifeq ($(findstring icx,$(CC)),icx) + CFLAGS ?= "-Wno-all -Wno-absolute-value -Wno-pointer-sign -Wno-deprecated-non-prototype" +else ifeq ($(findstring icc,$(CC)),icc) + CFLAGS ?= "-Wno-all -Wno-absolute-value -Wno-pointer-sign -Wno-deprecated-non-prototype" +endif + + diff --git a/install/makefile b/install/makefile index 7f6a0bb6..ac3909e2 100644 --- a/install/makefile +++ b/install/makefile @@ -8,7 +8,7 @@ else endif -# extend these variables to sub-makes (?= sets a default if user doesn't specify options) +# extend these variables to sub-$(MAKE)s (?= sets a default if user doesn't specify options) FFLAGS ?= -g CFLAGS ?= -g @@ -36,65 +36,65 @@ allf: v harvest equil lsode zlange zvode orbit vacuum pentrc dcon match rdcon r harvest: cd ../; git submodule init; git submodule update - cd ../harvest; make FC='$(FC)' CC='$(CC)' GACODE_ROOT= -f Makefile libharvest.a + cd ../harvest; $(MAKE) FC='$(FC)' CC='$(CC)' GACODE_ROOT= -f Makefile libharvest.a mkdir -p ../lib cp -f ../harvest/libharvest.a ../lib/ xdraw: - cd ../xdraw; make + cd ../xdraw; $(MAKE) -lsode: - cd ../lsode; make liblsode +lsode: equil + cd ../lsode; $(MAKE) liblsode -zlange: - cd ../zlange; make libzlange +zlange: equil + cd ../zlange; $(MAKE) libzlange zvode: - cd ../zvode; make libzvode + cd ../zvode; $(MAKE) libzvode equil: - cd ../equil; make libequil + cd ../equil; $(MAKE) libequil -vacuum: - cd ../vacuum; make libvac +vacuum: equil + cd ../vacuum; $(MAKE) libvac -orbit: - cd ../orbit; make orbit +orbit: equil lsode + cd ../orbit; $(MAKE) orbit -dcon: - cd ../dcon; make dcon +dcon: equil pentrc vacuum + cd ../dcon; $(MAKE) dcon -match: - cd ../match; make match +match: equil + cd ../match; $(MAKE) match -rdcon: - cd ../rdcon; make rdcon +rdcon: equil + cd ../rdcon; $(MAKE) rdcon -rmatch: - cd ../rmatch; make rmatch +rmatch: equil + cd ../rmatch; $(MAKE) rmatch -multi: - cd ../multi; make multi +multi: equil + cd ../multi; $(MAKE) multi -sum: - cd ../sum; make sum +sum: equil + cd ../sum; $(MAKE) sum -slayer: - cd ../slayer; make slayer +slayer: equil + cd ../slayer; $(MAKE) slayer -coil: - cd ../coil; make libcoil +coil: equil + cd ../coil; $(MAKE) libcoil -gpec: - cd ../gpec; make gpec +gpec: equil coil vacuum pentrc + cd ../gpec; $(MAKE) gpec -pentrc: - cd ../pentrc; make pentrc +pentrc: equil + cd ../pentrc; $(MAKE) pentrc -stride: - cd ../stride; make stride +stride: equil vacuum + cd ../stride; $(MAKE) stride -mkbin: +mkbin: orbit dcon match rdcon rmatch xdraw multi sum slayer gpec pentrc stride mkdir -p ../bin cp -f ../orbit/orbit ../bin cp -f ../dcon/dcon ../bin @@ -135,25 +135,25 @@ endif # cleaning clean: - cd ../harvest; make clean - cd ../zlange; make clean - cd ../zvode; make clean - cd ../xdraw; make clean - cd ../lsode; make clean - cd ../equil; make clean - cd ../orbit; make clean - cd ../vacuum; make clean - cd ../dcon; make clean - cd ../match; make clean - cd ../rdcon; make clean - cd ../rmatch; make clean - cd ../multi; make clean - cd ../sum; make clean - cd ../slayer; make clean - cd ../coil; make clean - cd ../gpec; make clean - cd ../pentrc; make clean - cd ../stride; make clean + cd ../harvest; $(MAKE) clean + cd ../zlange; $(MAKE) clean + cd ../zvode; $(MAKE) clean + cd ../xdraw; $(MAKE) clean + cd ../lsode; $(MAKE) clean + cd ../equil; $(MAKE) clean + cd ../orbit; $(MAKE) clean + cd ../vacuum; $(MAKE) clean + cd ../dcon; $(MAKE) clean + cd ../match; $(MAKE) clean + cd ../rdcon; $(MAKE) clean + cd ../rmatch; $(MAKE) clean + cd ../multi; $(MAKE) clean + cd ../sum; $(MAKE) clean + cd ../slayer; $(MAKE) clean + cd ../coil; $(MAKE) clean + cd ../gpec; $(MAKE) clean + cd ../pentrc; $(MAKE) clean + cd ../stride; $(MAKE) clean clear: cd ../docs/examples/run_ideal_example; rm -f *.out *.bin *.nc diff --git a/pentrc/makefile b/pentrc/makefile index 09450e01..735e9651 100644 --- a/pentrc/makefile +++ b/pentrc/makefile @@ -96,7 +96,7 @@ utilities.o: params.o special.o: params.o utilities.o dcon_interface.o: params.o utilities.o ../equil/spline_mod.mod ../equil/fspline_mod.mod ../equil/cspline_mod.mod ../equil/bicube_mod.mod inputs.o: params.o utilities.o special.o dcon_interface.o -energy.o: params.o utilities.o lsode2.o +energy.o: params.o utilities.o lsode2.o dcon_interface.o pitch.o: params.o utilities.o lsode1.o energy.o special.o torque.o: params.o utilities.o lsode1.o special.o dcon_interface.o inputs.o energy.o pitch.o diagnostics.o: params.o special.o energy.o pitch.o diff --git a/xdraw/makefile b/xdraw/makefile index 9eacb208..4ab37d8a 100644 --- a/xdraw/makefile +++ b/xdraw/makefile @@ -1,7 +1,8 @@ # This is the makefile for XDRAW on Linux computers. include ../install/DEFAULTS.inc -CFLAGS = -DUNIX -O2 $(X11_INC_DIR) +CFLAGS ?= +CFLAGS += -DUNIX -O2 $(X11_INC_DIR) CC += $(CFLAGS) .c.o: From 0eb98645a46999dff42d3de7029e0afeedc32141 Mon Sep 17 00:00:00 2001 From: SM Yang Date: Tue, 21 Oct 2025 15:55:32 -0400 Subject: [PATCH 3/3] remove TRANSP module dependency --- install/makefile | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/install/makefile b/install/makefile index e3a8b7f9..60919e28 100644 --- a/install/makefile +++ b/install/makefile @@ -1,11 +1,4 @@ -HOST := $(shell hostname) - -ifneq (,$(findstring flux,$(HOST))) -# include /p/transpusers/mgorelen/transp_main/environs/ppplflux/gnu/13.2.0/environ - include /p/transpusers/mgorelen/transp_main/environs/ppplflux/gnu/13.2.0/makefile.mk -else - include DEFAULTS.inc -endif +include DEFAULTS.inc # extend these variables to sub-$(MAKE)s (?= sets a default if user doesn't specify options) @@ -16,10 +9,7 @@ export FFLAGS export CFLAGS export OMPFLAG export LDFLAGS -ifneq (,$(findstring flux,$(HOST))) - FFLAGS := $(filter-out -c,$(FFLAGS)) -endif -FFLAGS := $(filter-out -c,$(FFLAGS)) + # compile package .IGNORE: