File: regsyncackinit.c

package info (click to toggle)
lam 7.1.2-1.4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 54,608 kB
  • ctags: 17,034
  • sloc: ansic: 156,264; sh: 9,976; cpp: 7,699; makefile: 5,589; perl: 476; fortran: 260; asm: 83
file content (78 lines) | stat: -rw-r--r-- 2,210 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Copyright (c) 2001-2002 The Trustees of Indiana University.  
 *                         All rights reserved.
 * Copyright (c) 1998-2001 University of Notre Dame. 
 *                         All rights reserved.
 * Copyright (c) 1994-1998 The Ohio State University.  
 *                         All rights reserved.
 * 
 * This file is part of the LAM/MPI software package.  For license
 * information, see the LICENSE file in the top level directory of the
 * LAM/MPI source distribution.
 * 
 * $HEADER$
 *
 *	$Id: regsyncackinit.c,v 1.2 2002/10/09 20:57:18 brbarret Exp $
 *
 *	Function:	- post a receive for a ping from the impid
 */

#include <lam_config.h>
#if LAM_WANT_IMPI

#include <impi-defs.h> 
#include <impi.h>
#include <mpi.h>
#include <mpisys.h>
#include <rpisys.h>


/*
 *	IMPI_Register_syncack_init
 *
 *	Function:	- register to receive a syncack ping from the impid
 *                      - impid will send a ping to ack the receipt of
 *                        a DATASYNC on the remote site
 *                      - hence, this function is only invoked for sends
 *      Accepts:        - rank in comm where the real message is from
 *                      - tag of real message
 *                      - comm of real message
 */
int
IMPI_Register_syncack_init(int rank, int tag, MPI_Comm comm, MPI_Request *req)
{
  IMPI_Uint8 *drqid;

  *req = MPI_REQUEST_NULL;

  if (LAM_IS_IMPI(comm) &&
      lam_impid_proc != 0 &&
      (LAM_GPSCMP(&(comm->c_group->g_procs[rank]->p_gps),
		  &(lam_impid_proc->p_gps)) == 0 ||
       rank == MPI_ANY_SOURCE)) {
    int cid;
    int err;

    /* Change the CID of the request so that we won't interfere with
       the user's real message */

    cid = comm->c_contextid;
    comm->c_contextid = lam_pt2impisyncack(cid);

    drqid = (IMPI_Uint8 *) malloc(sizeof(IMPI_Uint8));
    err = _mpi_req_build(drqid, 1, IMPI_TYPE_UINT8, rank, tag, comm,
			 LAM_RQIRECV, req);
    if (err != MPI_SUCCESS) {
      *req = MPI_REQUEST_NULL;
      return(LAMERROR);
    }

    (*req)->rq_marks |= (LAM_RQFPERSIST | LAM_RQFDYNBUF | LAM_RQFMAND);
    (*req)->rq_hdlr = 0;
    comm->c_contextid = cid;
  }

  return MPI_SUCCESS;
}

#endif /* LAM_WANT_IMPI */