diff --git a/Makefile b/Makefile index 09fcfcc0b..1f5a9828b 100644 --- a/Makefile +++ b/Makefile @@ -259,5 +259,4 @@ clean: cd $(SWIFTEST_HOME)/include; rm -f *.mod *.smod cd $(COLLRESOLVE_HOME); rm -rf autom4te.cache aux Makefile stamp-h1 configure config.status config.h config.log aclocal.m4 lib* *.in *.o *.lo cambioni2019/*.o cambioni2019/*.lo - -force: \ No newline at end of file +force: diff --git a/Makefile.Defines b/Makefile.Defines index 7511981dd..760e05e25 100644 --- a/Makefile.Defines +++ b/Makefile.Defines @@ -48,16 +48,15 @@ COLLRESOLVE_HOME = $(ROOT_DIR)/collresolve/ # DO NOT include in FFLAGS the "-c" option to compile object only # this is done explicitly as needed in the Makefile +ADVIXE_FLAGS = -g -O2 -qopt-report=5 -vecabi=cmdtarget -simd -shared-intel -debug inline-debug-info -DTBB_DEBUG -DTBB_USE_THREADING_TOOLS -xhost -traceback -I$(ADVISOR_2019_DIR)/include/intel64 -parallel-source-info=2 +#Be sure to set the environment variable KMP_FORKJOIN_FRAMES=1 for OpenMP debuging in vtune IDEBUG = -O0 -init=snan,arrays -nogen-interfaces -no-pie -no-ftz -fpe-all=0 -g -traceback -mp1 -qopt-matmul -fp-model strict -fpe0 -debug all -align all -pad -ip -prec-div -prec-sqrt -assume protect-parens -CB -no-wrap-margin STRICTREAL = -fp-model=precise -prec-div -prec-sqrt -assume protect-parens -SIMDVEC = -simd -xhost -align all -pad -assume contiguous_assumed_shape -vecabi=cmdtarget -fp-model no-except -fma -PAR = -qopenmp -parallel +SIMDVEC = -simd -xhost -align all -assume contiguous_assumed_shape -vecabi=cmdtarget -fp-model no-except -fma +PAR = -qopenmp -parallel HEAPARR = -heap-arrays 4194304 OPTREPORT = -qopt-report=5 -ADVIXE_FLAGS = -g -O2 -qopt-report=5 -shared-intel -traceback $(SIMDVEC) $(PAR) -#Be sure to set the environment variable KMP_FORKJOIN_FRAMES=1 for OpenMP debuging in vtune/advisor - IPRODUCTION = -no-wrap-margin -O3 -qopt-prefetch=0 -qopt-matmul -sox $(PAR) $(SIMDVEC) #$(HEAPARR) #gfortran flags @@ -67,12 +66,8 @@ GMEM = -fsanitize-address-use-after-scope -fstack-check -fsanitize=bounds-stri GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries GPRODUCTION = -O3 -ffree-line-length-none $(GPAR) -INCLUDES = -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include -I$(MKLROOT)/include -I$(ADVISOR_2019_DIR)/include/intel64 -LINKS = -L$(MKLROOT)/lib/intel64 -L$(NETCDF_FORTRAN_HOME)/lib -L$(ADVISOR_2019_DIR)/lib64 -lswiftest -lnetcdf -lnetcdff -ladvisor - -# FSTRICTFLAGS = $(IDEBUG) $(SIMDVEC) $(PAR) -# FFLAGS = $(IDEBUG) $(SIMDVEC) $(PAR) - +INCLUDES = -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include -I$(MKLROOT)/include +LINKS = -L$(MKLROOT)/lib/intel64 -L$(NETCDF_FORTRAN_HOME)/lib -L$(ADVISOR_2019_DIR)/lib64 -lswiftest -lnetcdf -lnetcdff -qopt-matmul $(PAR) FSTRICTFLAGS = $(ADVIXE_FLAGS) $(STRICTREAL) FFLAGS = $(ADVIXE_FLAGS) -fp-model=fast FORTRAN = ifort @@ -91,4 +86,3 @@ CC = icc CFLAGS = -O3 -w -m64 -std=c99 64_BIT_REALS = -r8 - diff --git a/python/swiftest/swiftest/simulation_class.py b/python/swiftest/swiftest/simulation_class.py index 8c9ecbc7b..465ef9c30 100644 --- a/python/swiftest/swiftest/simulation_class.py +++ b/python/swiftest/swiftest/simulation_class.py @@ -55,15 +55,16 @@ def __init__(self, codename="Swiftest", param_file="", readbin=True): } self.codename = codename if param_file != "" : + dir_path = os.path.dirname(os.path.realpath(param_file)) self.read_param(param_file, codename) if readbin: - if os.path.exists(self.param['BIN_OUT']): + if os.path.exists(dir_path + '/' + self.param['BIN_OUT']): + self.param['BIN_OUT'] = dir_path + '/' + self.param['BIN_OUT'] self.bin2xr() else: print(f"BIN_OUT file {self.param['BIN_OUT']} not found.") return - def add(self, plname, date=date.today().isoformat(), idval=None): """ Adds a solar system body to an existing simulation DataSet. diff --git a/src/kick/kick.f90 b/src/kick/kick.f90 index d739427c4..891936f20 100644 --- a/src/kick/kick.f90 +++ b/src/kick/kick.f90 @@ -106,7 +106,7 @@ module subroutine kick_getacch_int_all_flat_pl(npl, nplpl, k_plpl, x, Gmass, rad if (present(radius)) then !$omp parallel do default(private) schedule(static)& !$omp shared(nplpl, k_plpl, x, Gmass, radius) & - !$omp lastprivate(rji2, rlim2, xr, yr, zr) & + !$omp lastprivate(i, j, rji2, rlim2, xr, yr, zr) & !$omp reduction(+:ahi) & !$omp reduction(-:ahj) do k = 1_I8B, nplpl @@ -124,7 +124,7 @@ module subroutine kick_getacch_int_all_flat_pl(npl, nplpl, k_plpl, x, Gmass, rad else !$omp parallel do default(private) schedule(static)& !$omp shared(nplpl, k_plpl, x, Gmass, radius) & - !$omp lastprivate(rji2, xr, yr, zr) & + !$omp lastprivate(i, j, rji2, xr, yr, zr) & !$omp reduction(+:ahi) & !$omp reduction(-:ahj) do k = 1_I8B, nplpl @@ -137,12 +137,10 @@ module subroutine kick_getacch_int_all_flat_pl(npl, nplpl, k_plpl, x, Gmass, rad call kick_getacch_int_one_pl(rji2, xr, yr, zr, Gmass(i), Gmass(j), & ahi(1,i), ahi(2,i), ahi(3,i), ahj(1,j), ahj(2,j), ahj(3,j)) end do - !$omp end parallel do + !$omp end parallel do end if - do concurrent(i = 1:npl) - acc(:,i) = acc(:,i) + ahi(:,i) + ahj(:,i) - end do + acc(:,:) = acc(:,:) + ahi(:,:) + ahj(:,:) return end subroutine kick_getacch_int_all_flat_pl diff --git a/src/symba/symba_util.f90 b/src/symba/symba_util.f90 index d38106705..5a985faea 100644 --- a/src/symba/symba_util.f90 +++ b/src/symba/symba_util.f90 @@ -400,8 +400,8 @@ module subroutine symba_util_flatten_eucl_plpl(self, param) class(symba_pl), intent(inout) :: self !! SyMBA massive body object class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters ! Internals - integer(I8B) :: k - integer(I4B) :: i, j, npl, nplm, err + integer(I8B) :: k, npl, nplm + integer(I4B) :: i, j, err associate(pl => self, nplpl => self%nplpl, nplplm => self%nplplm) npl = int(self%nbody, kind=I8B) @@ -411,8 +411,8 @@ module subroutine symba_util_flatten_eucl_plpl(self, param) end select nplm = count(.not. pl%lmtiny(1:npl)) pl%nplm = int(nplm, kind=I4B) - nplpl = (npl * (npl - 1) / 2) ! number of entries in a strict lower triangle, npl x npl, minus first column - nplplm = nplm * npl - nplm * (nplm + 1) / 2 ! number of entries in a strict lower triangle, npl x npl, minus first column including only mutually interacting bodies + nplpl = (npl * (npl - 1_I8B)) / 2_I8B ! number of entries in a strict lower triangle, npl x npl, minus first column + nplplm = nplm * npl - nplm * (nplm + 1_I8B) / 2_I8B ! number of entries in a strict lower triangle, npl x npl, minus first column including only mutually interacting bodies if (param%lflatten_interactions) then if (allocated(self%k_plpl)) deallocate(self%k_plpl) ! Reset the index array if it's been set previously allocate(self%k_plpl(2, nplpl), stat=err) @@ -420,7 +420,7 @@ module subroutine symba_util_flatten_eucl_plpl(self, param) param%lflatten_interactions = .false. else do concurrent (i=1:npl, j=1:npl, j>i) - call util_flatten_eucl_ij_to_k(npl, i, j, k) + call util_flatten_eucl_ij_to_k(self%nbody, i, j, k) self%k_plpl(1, k) = i self%k_plpl(2, k) = j end do diff --git a/src/util/util_flatten.f90 b/src/util/util_flatten.f90 index b124d031d..1f6f60fe6 100644 --- a/src/util/util_flatten.f90 +++ b/src/util/util_flatten.f90 @@ -75,12 +75,12 @@ module subroutine util_flatten_eucl_plpl(self, param) class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters ! Internals - integer(I4B) :: i, j, npl, err - integer(I8B) :: k + integer(I4B) :: i, j, err + integer(I8B) :: k, npl npl = int(self%nbody, kind=I8B) associate(nplpl => self%nplpl) - nplpl = (npl * (npl - 1) / 2) ! number of entries in a strict lower triangle, npl x npl + nplpl = npl * (npl - 1_I8B) / 2_I8B ! number of entries in a strict lower triangle, npl x npl if (param%lflatten_interactions) then if (allocated(self%k_plpl)) deallocate(self%k_plpl) ! Reset the index array if it's been set previously allocate(self%k_plpl(2, nplpl), stat=err) @@ -88,7 +88,7 @@ module subroutine util_flatten_eucl_plpl(self, param) param%lflatten_interactions = .false. else do concurrent (i=1:npl, j=1:npl, j>i) - call util_flatten_eucl_ij_to_k(npl, i, j, k) + call util_flatten_eucl_ij_to_k(self%nbody, i, j, k) self%k_plpl(1, k) = i self%k_plpl(2, k) = j end do