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

Annotation of /MITgcm/pkg/compon_communic/coupsend_i4vec.F

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


Revision 1.1 - (hide annotations) (download)
Wed Nov 4 17:06:54 2015 UTC (8 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, HEAD
add 2nd set of coupling send/receive for non-tiled integer vector
(coupler send to comp and comp receive from coupler)

1 jmc 1.1 C $Header: $
2     C $Name: $
3    
4     !=======================================================================
5     subroutine coupsend_i4vec( component, dataname, length, vecFld )
6     implicit none
7     ! Predefined constants/arrays
8     #include "CPLR_SIG.h"
9     ! MPI variables
10     #include "mpif.h"
11     ! Arguments
12     character*(*) component
13     character*(*) dataname
14     integer length
15     integer vecFld(length)
16     ! Functions
17     integer mitcplr_match_comp
18     integer generate_tag
19     external mitcplr_match_comp
20     external generate_tag
21     ! Local
22     integer count,dtype,dest,tag,comm,ierr
23     integer compind, numprocs
24     integer i, n
25     integer ibuf(MAX_IBUF)
26     ! ------------------------------------------------------------------
27    
28     if ( 1+length .gt. MAX_IBUF )
29     & STOP 'coupsend_i4vec: length exceeds MAX_IBUF'
30    
31     ! Establish who I am communicating with
32     compind = mitcplr_match_comp( component )
33     if (compind.le.0) STOP 'coupsend_i4vec: Bad component id'
34     comm = MPI_COMM_compcplr( compind )
35     numprocs = num_component_procs(compind)
36     if (numprocs.lt.1) then
37     write(LogUnit,*) 'coupsend_i4vec: compind = ',compind
38     STOP 'coupsend_i4vec: numprocs < 1'
39     endif
40     if (VERB)
41     & write(LogUnit,*) 'coupsend_i4vec: ',component_Name(compind)
42     if (VERB)
43     & write(LogUnit,*) 'coupsend_i4vec: dataname=',dataname
44    
45     ! Copy vector to buffer
46     ibuf(1) = length
47     do i=1,length
48     ibuf(i+1) = vecFld(i)
49     enddo
50    
51     ! Foreach component process
52     do n=1,numprocs
53    
54     ! Send message
55     count = 1+length
56     dtype = MPI_INTEGER
57     tag = generate_tag( 125, n, dataname )
58     dest = rank_component_procs(n,compind)
59    
60     if (VERB) then
61     write(LogUnit,*)
62     & 'coupsend_i4vec: calling MPI_Send dest=',dest,
63     & ' proc=',n,'/',numprocs
64     call flush(LogUnit)
65     endif
66     call MPI_Send( ibuf, count, dtype, dest, tag, comm, ierr )
67     if (VERB) then
68     write(LogUnit,*) 'coupsend_i4vec: returned ierr=',ierr
69     call flush(LogUnit)
70     endif
71    
72     if (ierr.ne.0) then
73     write(LogUnit,*) 'coupsend_i4vec: rank(W,G)=',
74     & my_rank_in_world,my_rank_in_global,
75     & ' ierr=',ierr
76     STOP 'coupsend_i4vec: MPI_Send failed'
77     endif
78    
79     enddo ! n
80    
81     ! ------------------------------------------------------------------
82     return
83     end
84     !=======================================================================

  ViewVC Help
Powered by ViewVC 1.1.22