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

Contents of /MITgcm/pkg/compon_communic/mitcplr_init2b.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, 7 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_init2b.F,v 1.2 2007/10/08 23:58:21 jmc Exp $
2 C $Name: $
3
4 !=======================================================================
5 subroutine mitcplr_init2b( 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 MPI_COMM_temp
18 integer n,j,lenbuf,compind
19 integer ibuf(MAX_IBUF)
20 ! ------------------------------------------------------------------
21
22 ! Foreach component type
23 do compind = 1,num_components
24
25 MPI_COMM_temp=MPI_COMM_compcplr(compind)
26
27 ! Find-out my position (rank) in the "global" communicator
28 call MPI_COMM_RANK( MPI_COMM_temp, myid, ierr )
29 if (ierr.ne.0) write(LogUnit,*) 'MITCPLR_init2b: ',
30 & ' Rank = ',myid,' MPI_COMM_RANK ierr=',ierr
31 ! How big is the "global" comminicator?
32 call MPI_COMM_SIZE( MPI_COMM_temp, numprocs, ierr )
33 if (ierr.ne.0) write(LogUnit,*) 'MITCPLR_init2b: ',
34 & ' Size = ',numprocs,' MPI_COMM_RANK ierr=',ierr
35 if (DEBUG) write(LogUnit,*) 'MITCPLR_init2b: ',
36 & ' Rank/Size = ',myid,' /',numprocs
37
38 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39
40 ! Assume nothing again
41 num_coupler_procs=0
42 num_component_procs(compind)=0
43 num_compcplr_procs(compind)=0
44
45 ! Receive a message from each of the other processes in "myglobal"
46 do n=0,numprocs-1
47 ibuf( 1)=myid
48 ibuf( 2)=MITCPLR_COUPLER
49 ibuf( 3)=0
50 ibuf( 4)=0
51 ibuf( 5)=0
52 ibuf( 6)=0
53 ibuf( 7)=0
54 ibuf( 8)=0
55 ibuf( 9)=0
56 ibuf(10)=0
57 ibuf(11)=0
58 ibuf(12)=0
59 lenbuf=12
60 call MPI_Bcast(
61 & ibuf, lenbuf, MPI_INTEGER,
62 & n,
63 & MPI_COMM_temp, ierr )
64 if (ierr.ne.0) write(LogUnit,*) 'MITCPLR_init2b: ',
65 & ' MPI_Bcast from ',ibuf(1),ibuf(2),' ierr=',ierr
66
67 if ( ibuf(2).eq.MITCPLR_COUPLER ) then
68 ! If the broadcaster is the "coupler"
69 num_coupler_procs=num_coupler_procs + 1
70 rank_coupler_procs(num_coupler_procs) = ibuf(1)
71 num_compcplr_procs(compind)=num_compcplr_procs(compind) + 1
72 j=num_compcplr_procs(compind)
73 rank_compcplr_procs(j,compind)=ibuf(1)
74 else
75 ! If the broadcaster is a "component"
76 num_component_procs(compind)=num_component_procs(compind) + 1
77 j=num_component_procs(compind)
78 rank_component_procs(j,compind)=ibuf(1)
79 num_compcplr_procs(compind)=num_compcplr_procs(compind) + 1
80 j=num_compcplr_procs(compind)
81 rank_compcplr_procs(j,compind)=ibuf(1)
82 endif
83
84 enddo
85
86 if (num_coupler_procs .ne. 1) then
87 STOP 'MITCPLR_init2b: I can only handle one coupling process'
88 endif
89
90 enddo
91
92 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
93
94 do compind = 1,num_components
95 write(LogUnit,*) 'MITCPLR_init2b: ',
96 & MPI_COMM_compcplr(compind),
97 & ' comp. ranks = ',(rank_component_procs(j,compind),
98 & j=1,num_component_procs(compind) )
99 write(LogUnit,*) 'MITCPLR_init2b: ',
100 & MPI_COMM_compcplr(compind),
101 & ' c+c ranks = ',(rank_compcplr_procs(j,compind),
102 & j=1,num_compcplr_procs(compind) )
103 enddo
104
105 ! ------------------------------------------------------------------
106 call flush(LogUnit)
107 return
108 end
109 !=======================================================================

  ViewVC Help
Powered by ViewVC 1.1.22