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

Commit

Permalink
Maintenence on SyMBA to try to track down an auto-paralellization bug
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Aug 19, 2021
1 parent b63c173 commit d709d55
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 35 deletions.
12 changes: 6 additions & 6 deletions Makefile.Defines
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@ VTUNE_FLAGS = -g -O2 -vec -simd -shared-intel -qopenmp -debug inline-debug-info
IDEBUG = -O0 -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 -init=snan,arrays
STRICTREAL = -fp-model strict -fp-model no-except -prec-div -prec-sqrt -assume protect-parens
SIMDVEC = -simd -xhost -align all -assume contiguous_assumed_shape -vecabi=cmdtarget -prec-div -prec-sqrt -assume protect-parens
PAR = -parallel -qopenmp
PAR = -qopenmp #-parallel Something goes wrong in SyMBA at the moment with auto-paralellization enabled
HEAPARR = -heap-arrays 1048576
OPTIMIZE = -qopt-report=5
OPTREPORT = -qopt-report=5

#gfortran flags
GDEBUG = -g -O0 -fbacktrace -fbounds-check
GDEBUG = -g -Og -fbacktrace -fbounds-check
GPRODUCTION = -O3
GPAR = -fopenmp -ftree-parallelize-loops=4
GMEM = -fsanitize=undefined -fsanitize=address -fsanitize=leak
GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries

#FFLAGS = $(IDEBUG) $(HEAPARR)
FFLAGS = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(SIMDVEC) $(PAR) $(HEAPARR)
#FFLAGS = $(IDEBUG) $(HEAPARR) $(SIMDVEC) $(PAR)
FFLAGS = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(PAR) $(SIMDVEC) $(HEAPARR)
FORTRAN = ifort
#AR = xiar

#FORTRAN = gfortran
#FFLAGS = -ffree-line-length-none $(GDEBUG) #$(GMEM)
#FFLAGS = -ffree-line-length-none $(GPRODUCTION) $(GPAR) #$(GDEBUG) $(GMEM)
AR = ar

# DO NOT include in CFLAGS the "-c" option to compile object only
Expand Down
4 changes: 2 additions & 2 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci)
implicit none
class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), value :: t
integer(I4B), value :: ireci !! input recursion level
real(DP), intent(in) :: t
integer(I4B), intent(in) :: ireci !! input recursion level
end subroutine symba_step_recur_system

module subroutine symba_step_reset_system(self, param)
Expand Down
60 changes: 33 additions & 27 deletions src/symba/symba_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci)
! Arguments
class(symba_nbody_system), intent(inout) :: self !! SyMBA nbody system object
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), value :: t
integer(I4B), value :: ireci !! input recursion level
real(DP), intent(in) :: t
integer(I4B), intent(in) :: ireci !! input recursion level
! Internals
integer(I4B) :: i, j, irecp, nloops
real(DP) :: dtl, dth
Expand Down Expand Up @@ -235,32 +235,38 @@ module subroutine symba_step_reset_system(self, param)
class is (symba_pl)
select type(tp => system%tp)
class is (symba_tp)
if (pl%nbody > 0) then
pl%lcollision(:) = .false.
pl%kin(:)%parent = [(i, i=1, pl%nbody)]
pl%kin(:)%nchild = 0
do i = 1, pl%nbody
if (allocated(pl%kin(i)%child)) deallocate(pl%kin(i)%child)
end do
pl%nplenc(:) = 0
pl%ntpenc(:) = 0
pl%levelg(:) = -1
pl%levelm(:) = -1
pl%lencounter = .false.
pl%lcollision = .false.
system%plplenc_list%nenc = 0
system%plplcollision_list%nenc = 0
end if

if (tp%nbody > 0) then
tp%nplenc(:) = 0
tp%levelg(:) = -1
tp%levelm(:) = -1
system%pltpenc_list%nenc = 0
end if
associate(npl => pl%nbody, ntp => tp%nbody)
if (npl > 0) then
pl%lcollision(1:npl) = .false.
pl%kin(1:npl)%parent = [(i, i=1, npl)]
pl%kin(1:npl)%nchild = 0
do i = 1, npl
if (allocated(pl%kin(i)%child)) deallocate(pl%kin(i)%child)
end do
pl%nplenc(1:npl) = 0
pl%ntpenc(1:npl) = 0
pl%levelg(1:npl) = -1
pl%levelm(1:npl) = -1
pl%lencounter(1:npl) = .false.
pl%lcollision(1:npl) = .false.
pl%ldiscard(1:npl) = .false.
pl%lmask(1:npl) = .true.
system%plplenc_list%nenc = 0
system%plplcollision_list%nenc = 0
end if

if (ntp > 0) then
tp%nplenc(1:ntp) = 0
tp%levelg(1:ntp) = -1
tp%levelm(1:ntp) = -1
tp%lmask(1:ntp) = .true.
pl%ldiscard(1:npl) = .false.
system%pltpenc_list%nenc = 0
end if

call system%pl_adds%setup(0, param)
call system%pl_discards%setup(0, param)
call system%pl_adds%setup(0, param)
call system%pl_discards%setup(0, param)
end associate
end select
end select
end associate
Expand Down

0 comments on commit d709d55

Please sign in to comment.