/[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.2 - (show annotations) (download)
Mon Oct 8 23:58:21 2007 UTC (16 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64q, checkpoint64p, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59k, checkpoint59j, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.1: +6 -3 lines
add missing cvs $Header:$ or $Name:$

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

  ViewVC Help
Powered by ViewVC 1.1.22