libxmp/libxmpf in Omni Compiler  1.3.4
xmp_post_wait_mpi.c File Reference
#include <stdlib.h>
#include <pthread.h>
#include "xmp_internal.h"
#include <time.h>
#include <sys/time.h>
Include dependency graph for xmp_post_wait_mpi.c:

Data Structures

struct  _XMP_postreq_info
 
struct  _XMP_postreq
 

Typedefs

typedef struct _XMP_postreq_info _XMP_postreq_info_t
 
typedef struct _XMP_postreq _XMP_postreq_t
 

Functions

void _xmp_mpi_post_wait_initialize ()
 Initialize environment for post/wait directives. More...
 
void receive_request (int *node, int *tag)
 
void _xmp_mpi_post (const int node, int tag)
 Post operation. More...
 
void _xmp_mpi_wait_noargs ()
 Wait operation without node-ref and tag. More...
 
void _xmp_mpi_wait_node (const int node)
 Wait operation with node-ref. More...
 
void _xmp_mpi_wait (const int node, const int tag)
 Wait operation with node-ref and tag. More...
 

Typedef Documentation

◆ _XMP_postreq_info_t

◆ _XMP_postreq_t

typedef struct _XMP_postreq _XMP_postreq_t

Function Documentation

◆ _xmp_mpi_post()

void _xmp_mpi_post ( const int  node,
int  tag 
)

Post operation.

Parameters
[in]nodenode number
[in]tagtag
114 {
115  if(node == _XMP_world_rank){
116  do_post(_XMP_world_rank, tag);
117  } else{
118  //XACC_DEBUG("post (node=%d, tag=%d)", node, tag);
119  MPI_Send(&tag, 1, MPI_INT, node, _XMP_N_MPI_TAG_POSTREQ, MPI_COMM_WORLD);
120  }
121 }
Here is the caller graph for this function:

◆ _xmp_mpi_post_wait_initialize()

void _xmp_mpi_post_wait_initialize ( )

Initialize environment for post/wait directives.

25 {
26  _postreq.num = 0;
27  _postreq.max_size = _XMP_POSTREQ_TABLE_INITIAL_SIZE;
28  _postreq.table = malloc(sizeof(_XMP_postreq_info_t) * _postreq.max_size);
29 
30  _postreq.table[0].node = 0;
31  _postreq.table[_postreq.max_size-1].node=0;
32 }
Here is the caller graph for this function:

◆ _xmp_mpi_wait()

void _xmp_mpi_wait ( const int  node,
const int  tag 
)

Wait operation with node-ref and tag.

Parameters
[in]nodenode number
[in]tagtag
166 {
167  XACC_DEBUG("wait (%d,%d)", node,tag);
168  if(remove_request(node, tag)){
169  XACC_DEBUG("wait end (already recved)");
170  return;
171  }
172 
173  while(1){
174  int recv_tag;
175  int recv_node;
176  receive_request(&recv_node, &recv_tag);
177  if(recv_node == node && recv_tag == tag){
178  XACC_DEBUG("wait end (recved)");
179  return;
180  }
181  do_post(recv_node, recv_tag);
182  }
183 }
Here is the caller graph for this function:

◆ _xmp_mpi_wait_noargs()

void _xmp_mpi_wait_noargs ( )

Wait operation without node-ref and tag.

127 {
128  if(remove_request_noargs()){
129  return;
130  }
131 
132  int tag;
133  int node;
134  receive_request(&tag, &node);
135 }
Here is the caller graph for this function:

◆ _xmp_mpi_wait_node()

void _xmp_mpi_wait_node ( const int  node)

Wait operation with node-ref.

Parameters
[in]nodenode number
143 {
144  if(remove_request_node(node)){
145  return;
146  }
147 
148  while(1){
149  int recv_tag;
150  int recv_node;
151  receive_request(&recv_node, &recv_tag);
152  if(recv_node == node){
153  return;
154  }
155  do_post(recv_node, recv_tag);
156  }
157 }
Here is the caller graph for this function:

◆ receive_request()

void receive_request ( int *  node,
int *  tag 
)
99 {
100  MPI_Status status;
101  XACC_DEBUG("receive_request");
102  MPI_Recv(tag, 1, MPI_INT, MPI_ANY_SOURCE, _XMP_N_MPI_TAG_POSTREQ, MPI_COMM_WORLD, &status);
103  *node = status.MPI_SOURCE;
104  XACC_DEBUG("receivee_request, node=%d, tag=%d", *node, *tag);
105 }
_XMP_postreq::num
int num
How many post requests are in table.
Definition: xmp_post_wait_fjrdma.c:19
_XMP_postreq::max_size
int max_size
Max size of table.
Definition: xmp_post_wait_fjrdma.c:20
_XMP_postreq_info
Definition: xmp_post_wait_fjrdma.c:12
receive_request
void receive_request(int *node, int *tag)
Definition: xmp_post_wait_mpi.c:98
_XMP_world_rank
int _XMP_world_rank
Definition: xmp_world.c:9
_XMP_postreq::table
_XMP_postreq_info_t * table
Table for post requests.
Definition: xmp_post_wait_fjrdma.c:18
_XMP_N_MPI_TAG_POSTREQ
#define _XMP_N_MPI_TAG_POSTREQ
Definition: xmp_constant.h:13
_XMP_postreq_info::node
int node
Definition: xmp_post_wait_fjrdma.c:13
XACC_DEBUG
#define XACC_DEBUG(...)
Definition: xmp_internal.h:768