/[MITgcm]/MITgcm_contrib/ecco_utils/lbfgs_jpl_version/lsopt.2/distwork.F
ViewVC logotype

Contents of /MITgcm_contrib/ecco_utils/lbfgs_jpl_version/lsopt.2/distwork.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Apr 3 23:36:06 2013 UTC (12 years, 4 months ago) by heimbach
Branch: MAIN
CVS Tags: HEAD
Add L-BFGS code adapted to ECCO Production by JPL

1 subroutine distwork(myid,numprocs,nmax,mystart,myend,my_veclen)
2 ! There are numprocs of MPI processes calling this routine
3 ! Distribute different sections to the processes
4 implicit none
5
6 ! Input variables
7 integer :: myid,nmax,numprocs
8 ! Output variables
9 integer :: mystart,myend
10 ! Local variables
11 integer :: rest, my_veclen
12
13 rest = mod(nmax,numprocs)
14 ! if(rest.gt.numprocs/2) then
15 if(rest .ne. 0) then
16 ! If each process takes my_veclen, total will be bigger than nmax
17 my_veclen = (nmax+(numprocs-rest))/numprocs
18 mystart = 1 + myid*my_veclen
19 myend = mystart + my_veclen - 1
20 if(myid.eq.numprocs-1) myend = nmax
21 else
22 ! If each process takes my_veclen, total will be less than nmax
23 my_veclen = nmax/numprocs
24 mystart = 1 + myid*my_veclen
25 myend = mystart + my_veclen - 1
26 if(myid.eq.numprocs-1) myend = nmax
27 endif
28 end subroutine distwork
29

  ViewVC Help
Powered by ViewVC 1.1.22