beatrixparis/connectivity-modeling-system

Relic comments/code in loop.f90

Closed this issue · 4 comments

There is a section of code in loop.f90 (lines 71-87) commented as "DH trying to correct error", with no information on the error or whether it was solved:

! ! DH trying to correct error
 IF ((((npes-1)*ppes)+1) .gt. sze) THEN
  ppes = ceiling(ppesReal)-1
 ENDIF 

 startR = (my_id*ppes)+1
 endR = (startR + ppes-1)

! ! DH trying to correct error
 IF (startR .eq. ((npes-1)*ppes+1)) THEN
  endR = sze
 ENDIF

 ! This statement may no longer be necessary?
 IF ((startR + ppes) .gt. sze) THEN
  endR = sze
 ENDIF

This section requires clearing up/re-commenting.

It was the error regarding the number of release lines not being a multiple of the processors. However, the way it stands, some lines might not run in any processor - this need further testing.

In that case this sounds like potentially a major bug? I've contacted DH who is going to look back at whether the issue was fixed.

Ladies, I wrote something so wrong on the last comment (my division, duh!), many apologies - that's why I'm on leave I guess...

Anyway, the issue is solved, but we can enhance the code by distributing the remaining lines among processors, and not assigning all of the them to the last processor, from a real life example, 31 release lines distributed on 16 processors - 15 with one line, 1 with 15! We can distribute the remaining lines among processors, I wrote this code but couldn't test it. any other ideas to this would be great.

! this code would divide the number of release lines (sze) by the 
! number of processors (npes) and calculate the reminder of the division
! if the my_id number (what processor I am) is smaller or equal to the
! reminder

! ppsReal = real(sze)/real(npes)
! n_pps = mod(real(sze),real(npes))
! IF (my_id .le. n_pps) THEN
!   ! the first processes will process an extra line to distribute the 
!   ! reminder
!   startR = (my_id*ppes) + (my_id-1)
!   endR = startR + ppes + 1
! ELSE 
!  startR = (my_id*ppes) + n_pps
!  endR = startR + ppes
! ENDIF

Thanks Ana. I don't have time to test this right now but in the meantime will clean up the comments in the master branch