Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Nov 5, 2021
2 parents e99c418 + cdea402 commit 243e921
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ MODULES = $(SWIFTEST_MODULES) $(USER_MODULES)
.PHONY : all mod fast strict drivers bin clean force

% : %.f90 force
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) $< -o $@ \
-L$(SWIFTEST_HOME)/lib -lswiftest -L$(NETCDF_FORTRAN_HOME)/lib -lnetcdf -lnetcdff $(LMKL)
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) $(IADVIXE) $< -o $@ \
-L$(SWIFTEST_HOME)/lib -lswiftest -L$(NETCDF_FORTRAN_HOME)/lib -lnetcdf -lnetcdff $(LMKL) $(LADVIXE)
$(INSTALL_PROGRAM) $@ $(SWIFTEST_HOME)/bin
rm -f $@

Expand All @@ -79,7 +79,7 @@ all:

mod:
cd $(SWIFTEST_HOME)/src/modules/; \
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) -c $(MODULES); \
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) $(IADVIXE) -c $(MODULES); \
$(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o; \
$(INSTALL_DATA) *.mod *.smod $(SWIFTEST_HOME)/include; \
rm -f *.o *.mod *.smod
Expand Down Expand Up @@ -188,34 +188,34 @@ strict:
ln -s $(SWIFTEST_HOME)/Makefile .; \
make strictdir
cd $(SWIFTEST_HOME)/src/helio; \
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) -c helio_kick.f90; \
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) $(IADVIXE) -c helio_kick.f90; \
$(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \
$(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \
rm -f *.o *.smod
cd $(SWIFTEST_HOME)/src/symba; \
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) -c symba_kick.f90; \
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) $(IADVIXE) -c symba_kick.f90; \
$(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \
$(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \
rm -f *.o *.smod
cd $(SWIFTEST_HOME)/src/rmvs; \
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) -c rmvs_kick.f90; \
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) $(IADVIXE) -c rmvs_kick.f90; \
$(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \
$(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \
rm -f *.o *.smod
cd $(SWIFTEST_HOME)/src/whm; \
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) -c whm_kick.f90; \
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) $(IADVIXE) -c whm_kick.f90; \
$(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \
$(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \
rm -f *.o *.smod

fastdir:
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) -c *.f90; \
$(FORTRAN) $(FFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) $(IADVIXE) -c *.f90; \
$(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \
$(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \
rm -f *.o *.smod

strictdir:
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) -c *.f90; \
$(FORTRAN) $(FSTRICTFLAGS) -I$(SWIFTEST_HOME)/include -I$(NETCDF_FORTRAN_HOME)/include $(IMKL) $(IADVIXE) -c *.f90; \
$(AR) rv $(SWIFTEST_HOME)/lib/libswiftest.a *.o *.smod; \
$(INSTALL_DATA) *.smod $(SWIFTEST_HOME)/include; \
rm -f *.o *.smo
Expand Down
16 changes: 2 additions & 14 deletions Makefile.Defines
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,9 @@ 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_DIR = /apps/cent7/intel/advisor_2019
ADVIXE_FLAGS = -g -O2 -qopt-report=5 -vecabi=cmdtarget -simd -shared-intel -debug inline-debug-info -DTBB_DEBUG -DTBB_USE_THREADING_TOOLS -xhost -traceback

VTUNE_FLAGS = -g -O2 -qopt-report=5 -simd -shared-intel -qopenmp -debug inline-debug-info -parallel-source-info=2 -parallel -DTBB_DEBUG -DTBB_USE_THREADING_TOOLS -qopenmp -fp-model no-except -mp1 -xhost -traceback
ADVIXE_FLAGS = -g -O2 -qopt-report=5 -vec -shared-intel -ldl -debug inline-debug-info -DTBB_DEBUG -DTBB_USE_THREADING_TOOLS -traceback
#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 -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 -assume contiguous_assumed_shape -vecabi=cmdtarget -fp-model no-except -fma
PAR = -qopenmp -parallel
Expand All @@ -76,15 +72,7 @@ FORTRAN = ifort
AR = xiar
CC = icc

#FORTRAN = gfortran
#FFLAGS = $(GDEBUG) $(GMEM) #$(GPAR)
#FSTRICTFLAGS = $(GDEBUG) $(GMEM) #$(GPAR)
#AR = ar
#CC = cc

# DO NOT include in CFLAGS the "-c" option to compile object only
# this is done explicitly as needed in the Makefile

CC = icc
CFLAGS = -O3 -w -m64 -std=c99

64_BIT_REALS = -r8
Expand Down
2 changes: 2 additions & 0 deletions src/main/swiftest_driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ program swiftest_driver
end do
end associate

call nbody_system%dealloc()

call util_exit(SUCCESS)

stop
Expand Down
4 changes: 0 additions & 4 deletions src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,6 @@ module subroutine netcdf_read_hdr_system(self, iu, param)

tslot = int(param%ioutput, kind=I4B) + 1

call check( nf90_open(param%outfile, NF90_NOWRITE, iu%ncid) )

call check( nf90_get_var(iu%ncid, iu%time_varid, param%t, start=[tslot]) )
call check( nf90_get_var(iu%ncid, iu%npl_varid, self%pl%nbody, start=[tslot]) )
call check( nf90_get_var(iu%ncid, iu%ntp_varid, self%tp%nbody, start=[tslot]) )
Expand Down Expand Up @@ -1087,8 +1085,6 @@ module subroutine netcdf_write_hdr_system(self, iu, param)

tslot = int(param%ioutput, kind=I4B) + 1

call check( nf90_open(param%outfile, nf90_write, iu%ncid) )

call check( nf90_put_var(iu%ncid, iu%time_varid, param%t, start=[tslot]) )
call check( nf90_put_var(iu%ncid, iu%npl_varid, self%pl%nbody, start=[tslot]) )
call check( nf90_put_var(iu%ncid, iu%ntp_varid, self%tp%nbody, start=[tslot]) )
Expand Down
9 changes: 8 additions & 1 deletion src/symba/symba_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ module subroutine symba_util_dealloc_pl(self)
implicit none
! Arguments
class(symba_pl), intent(inout) :: self !! SyMBA massive body object
! Internals
integer(I4B) :: i

if (allocated(self%lcollision)) deallocate(self%lcollision)
if (allocated(self%lencounter)) deallocate(self%lencounter)
Expand All @@ -262,6 +264,11 @@ module subroutine symba_util_dealloc_pl(self)
if (allocated(self%isperi)) deallocate(self%isperi)
if (allocated(self%peri)) deallocate(self%peri)
if (allocated(self%atp)) deallocate(self%atp)

do i = 1, self%nbody
call self%kin(i)%dealloc()
end do

if (allocated(self%kin)) deallocate(self%kin)

call util_dealloc_pl(self)
Expand Down Expand Up @@ -408,7 +415,7 @@ module subroutine symba_util_flatten_eucl_plpl(self, param)
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)
if (err /=0) then ! An error occurred trying to allocate this big array. This probably means it's too big to fit in memory, and so we will force the run back into triangular mode
if (err /= 0) then ! An error occurred trying to allocate this big array. This probably means it's too big to fit in memory, and so we will force the run back into triangular mode
param%lflatten_interactions = .false.
else
do concurrent (i=1:npl, j=1:npl, j>i)
Expand Down

0 comments on commit 243e921

Please sign in to comment.