UPP  V11.0.0
 All Data Structures Files Functions Pages
PARA_RANGE.f
Go to the documentation of this file.
1 
19  SUBROUTINE para_range (N1,N2,NPROCS,IRANK,ISTA,IEND)
20 
21  implicit none
22  integer,intent(in) :: n1,n2,nprocs,irank
23  integer,intent(out) :: ista,iend
24  integer iwork1, iwork2
25 
26  iwork1 = ( n2 - n1 + 1 ) / nprocs
27  iwork2 = mod( n2 - n1 + 1, nprocs )
28  ista = irank * iwork1 + n1 + min( irank, iwork2 )
29  iend = ista + iwork1 - 1
30  if ( iwork2 > irank ) iend = iend + 1
31  return
32  end
33 !!
34 !! USAGE: CALL PARA_RANGE2(N1,N2,NX,NY,NRANK,ISTA,IEND,JSTA,JEND)(A)
35 !! INPUT ARGUMENT LIST:
36 !! N1 - LAAT INTERATE VALUE I dimension
37 !! N2 - LAST INTERATE VALUE J dimension
38 !! NX NUMBER OF subdomains in Z dimension
39 !! NY NUMBER OF subdomains in Y dimension
40 !! NX * NY should be the total number of MPI procs
41 !! NRANK - MY TAKS ID
42 !!
43 !! OUTPUT ARGUMENT LIST:
44 !! ISTA - FIRST LOOP VALUE I
45 !! IEND - LAST LOOP VALUE I
46 !! JSTA - FIRST LOOP VALUE J
47 !! JEND - LAST LOOP VALUE J
48 !!
49 !! OUTPUT FILES:
50 !! STDOUT - RUN TIME STANDARD OUT.
51 !!
52 !! SUBPROGRAMS CALLED:
53 !! UTILITIES:
54 !! NONE
55 !! LIBRARY:
56 !!
57 !! ATTRIBUTES:
58 !! LANGUAGE: FORTRAN
59 !! MACHINE : IBM RS/6000 SP
60 !!
61  subroutine para_range2(im,jm,nx,ny,nrank,ista,iend,jsta,jend)
62 
63  implicit none
64  integer,intent(in) :: im,jm,nx,ny,nrank
65  integer,intent(out) :: ista,iend,jsta,jend
66  integer :: ix,jx
67 
68  jx=nrank/nx
69  ix=nrank-(jx*nx)
70  call para_range(1,im,nx,ix,ista,iend)
71  call para_range(1,jm,ny,jx,jsta,jend)
72 ! print 101,n,ix,jx,ista,iend,jsta,jend
73 ! 101 format(16i8)
74  return
75  end
76 
77