/[MITgcm]/MITgcm/pkg/compon_communic/mitcplr_init2a.F
ViewVC logotype

Contents of /MITgcm/pkg/compon_communic/mitcplr_init2a.F

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


Revision 1.3 - (show annotations) (download)
Wed Nov 27 21:48:30 2013 UTC (10 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.2: +8 -5 lines
- move declaration of local array "ibuf" out of header file "CPLR_SIG.h"
  to each S/R that needs it; remove un-used variables.

1 C $Header: /u/gcmpack/MITgcm/pkg/compon_communic/mitcplr_init2a.F,v 1.2 2007/10/08 23:58:21 jmc Exp $
2 C $Name: $
3
4 !=======================================================================
5 subroutine mitcplr_init2a( myTypeStr )
6
7 implicit none
8 ! Predefined constants/arrays
9 #include "CPLR_SIG.h"
10 ! MPI variables
11 #include "mpif.h"
12
13 ! Arguments
14 character*(*) myTypeStr
15 ! Local
16 integer myid, numprocs, ierr
17 integer n,j,lenbuf
18 integer ibuf(MAX_IBUF)
19 ! ------------------------------------------------------------------
20
21 ! Find-out my position (rank) in the "global" communicator
22 call MPI_COMM_RANK( MPI_COMM_myglobal, myid, ierr )
23 if (ierr.ne.0) write(LogUnit,*) 'MITCPLR_init2a: ',
24 & ' Rank = ',myid,' MPI_COMM_RANK ierr=',ierr
25 ! How big is the "global" comminicator?
26 call MPI_COMM_SIZE( MPI_COMM_myglobal, numprocs, ierr )
27 if (ierr.ne.0) write(LogUnit,*) 'MITCPLR_init2a: ',
28 & ' Size = ',numprocs,' MPI_COMM_RANK ierr=',ierr
29 if (VERB) write(LogUnit,*) 'MITCPLR_init2a: ',
30 & ' Rank/Size = ',myid,' /',numprocs
31
32 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33
34 ! Assume nothing again
35 num_coupler_procs=0
36
37 ! Receive a message from each of the other processes in "myglobal"
38 do n=0,numprocs-1
39 ibuf( 1)=myid
40 ibuf( 2)=0
41 ibuf( 3)=0
42 ibuf( 4)=0
43 ibuf( 5)=0
44 ibuf( 6)=0
45 ibuf( 7)=0
46 ibuf( 8)=0
47 ibuf( 9)=0
48 ibuf(10)=0
49 ibuf(11)=0
50 ibuf(12)=0
51 lenbuf=12
52 call MPI_Bcast(
53 & ibuf, lenbuf, MPI_INTEGER,
54 & n,
55 & MPI_COMM_myglobal, ierr )
56 if (ierr.ne.0) write(LogUnit,*) 'MITCPLR_init2a: ',
57 & ' MPI_Bcast from ',ibuf(1),ibuf(2),' ierr=',ierr
58
59 if ( ibuf(2).eq.MITCPLR_COUPLER ) then
60 ! If the broadcaster is the "coupler"
61 num_coupler_procs=num_coupler_procs + 1
62 num_procs_in_global=num_procs_in_global+1
63 rank_coupler_procs(num_coupler_procs) = ibuf(1)
64 else
65 ! If the broadcaster is a "component"
66 num_procs_in_local=num_procs_in_local+1
67 num_procs_in_global=num_procs_in_global+1
68 endif
69
70 enddo
71
72 if (num_coupler_procs .ne. 1) then
73 STOP 'MITCPLR_init2a: I can only handle one coupling process'
74 endif
75
76 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
77
78 ! Find-out my position (rank) in the "world" communicator
79 call MPI_COMM_RANK( MPI_COMM_World, n, ierr )
80 if (ierr.ne.0) write(LogUnit,*) 'MITCPLR_init2a: ',
81 & ' Rank = ',myid,' MPI_COMM_RANK ierr=',ierr
82 ! Find-out my position (rank) in the "local" communicator
83 call MPI_COMM_RANK( MPI_COMM_myglobal, j, ierr )
84 if (ierr.ne.0) write(LogUnit,*) 'MITCPLR_init2a: ',
85 & ' Rank = ',myid,' MPI_COMM_RANK ierr=',ierr
86
87 ! Store the information
88 my_coupler_rank=rank_coupler_procs(1)
89 my_rank_in_world=n
90 my_rank_in_global=myid
91 my_rank_in_local=j
92
93 if (VERB) write(LogUnit,*) 'MITCPLR_init2a: ',
94 & ' rank (W,G,L) =',
95 & my_rank_in_world,my_rank_in_global,my_rank_in_local,
96 & ' my_coupler_rank =',my_coupler_rank,' /',numprocs
97
98 ! ------------------------------------------------------------------
99 call flush(LogUnit)
100 return
101 end
102 !=======================================================================

  ViewVC Help
Powered by ViewVC 1.1.22