Changeset 32289cd for utilities.f
- Timestamp:
- 11/19/09 11:29:41 (14 years ago)
- Branches:
- master
- Children:
- 38d77eb
- Parents:
- 6650a56
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
utilities.f
r6650a56 r32289cd 8 8 9 9 !! Calculate the best way to distribute the work load across processors. 10 ! It calculates the average number of interactions and then tries to 10 ! It calculates the average number of interactions and then tries to 11 11 ! assign a number of interactions to each processor that is as close 12 12 ! as possible to the average. The routine should be called once for … … 21 21 include 'INCL.H' 22 22 23 integer i1ms, io, iv, i2ms, ms 24 23 25 integer num_ppr, nml 24 26 integer idxOfFirstVariable, idxOfLastVariable … … 26 28 integer totalct, irank, itarget 27 29 double precision ipps 28 30 29 31 if (nml.eq.0) then 30 32 idxOfFirstVariable = ivrml1(1) … … 36 38 end do 37 39 end do 38 else 40 else 39 41 idxOfFirstVariable = ivrml1(nml) 40 42 idxOfLastVariable = ivrml1(nml) + nvrml(nml) - 1 … … 44 46 end do 45 47 end if 46 48 47 49 isum = 0 48 50 do io = idxOfLastVariable, idxOfFirstVariable, - 1 … … 52 54 do ms = i1ms, i2ms 53 55 do at = latms1(ms), latms2(ms) 54 do ivw=ivwat1(at),ivwat2(at) 56 do ivw=ivwat1(at),ivwat2(at) 55 57 do j=lvwat1(ivw),lvwat2(ivw) 56 58 isum = isum + 1 57 59 end do 58 60 end do 59 do i14=i14at1(at),i14at2(at) 61 do i14=i14at1(at),i14at2(at) 60 62 isum = isum + 1 61 63 end do … … 66 68 write (*,*) "Total number of interactions:", isum 67 69 write (*,*) "Average # of interactions per processor", ipps 68 70 69 71 totalct = 0 70 72 irank = 1 … … 72 74 if (nml.eq.0) then 73 75 i1ms = imsml1(ntlml)+ nmsml(ntlml) 74 else 76 else 75 77 i1ms = imsml1(nml)+ nmsml(nml) 76 78 end if 77 79 do io = idxOfLastVariable, idxOfFirstVariable, - 1 78 isum = 0 80 isum = 0 79 81 iv = iorvr(io) 80 82 i2ms = i1ms - 1 … … 83 85 do at = latms1(ms), latms2(ms) 84 86 atct = atct + 1 85 do ivw=ivwat1(at),ivwat2(at) 87 do ivw=ivwat1(at),ivwat2(at) 86 88 do j=lvwat1(ivw),lvwat2(ivw) 87 89 isum = isum + 1 88 90 end do 89 91 end do 90 do i14=i14at1(at),i14at2(at) 92 do i14=i14at1(at),i14at2(at) 91 93 isum = isum + 1 92 94 end do … … 113 115 114 116 end subroutine distributeWorkLoad 115 117 116 118 !----------------------------------------------------------------------- 117 119 ! The function fileNameMP takes a template of a file name in the … … 128 130 ! \endcode 129 131 ! will output base_0011.dat. 130 ! 132 ! 131 133 ! @param base the base file name, e.g., base_0000.dat. 132 134 ! @param i1 index of the first character that may be replaced 133 135 ! @param i2 index of the last character that may be replaced 134 136 ! @param rank the number that should be inserted into the file name. 135 ! 137 ! 136 138 ! @return file name for rank 137 139 !----------------------------------------------------------------------- … … 165 167 write(fileNameMP(i2-5:i2), '(i6)') rank 166 168 endif 167 end function fileNameMP 169 end function fileNameMP 168 170 ! End fileNameMP 169 171 … … 172 174 ! Add messages to log. This routine takes the log (debugging) mes- 173 175 ! sages and writes them to the log file if the log level is less or 174 ! equal to the maximum log level given by the global variable 176 ! equal to the maximum log level given by the global variable 175 177 ! MAXLOGLEVEL. 176 178 ! 177 179 ! @author Jan H. Meinke 178 180 ! 179 ! @param loglevel level at which this message should be added to 181 ! @param loglevel level at which this message should be added to 180 182 ! the log. 181 183 ! @param message message to be written to the log. 182 ! @param rank global rank of this node if running an MPI job zero 184 ! @param rank global rank of this node if running an MPI job zero 183 185 ! otherwise. 184 186 !---------------------------------------------------------------------- 185 187 subroutine addLogMessage(loglevel, message, rank) 186 188 189 integer maxloglevel, logfileunit 190 187 191 integer :: loglevel, rank 188 192 character(LEN=*) :: message 189 193 190 194 if (loglevel <= MAXLOGLEVEL) then 191 195 write(LOGFILEUNIT, *) message 192 196 end if 193 197 194 198 end subroutine addLogMessage
Note:
See TracChangeset
for help on using the changeset viewer.