PULSAR  1.0.0
Parallel Ultra Light Systolic Array Runtime
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
prt_request.h File Reference

PRT communication request. More...

#include "prt.h"
Include dependency graph for prt_request.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  prt_request_s
 VSA proxy's communication request Contains basic information about the communication request. Contains the MPI request. More...
 

Typedefs

typedef struct prt_request_s prt_request_t
 VSA proxy's communication request Contains basic information about the communication request. Contains the MPI request. More...
 

Functions

prt_request_tprt_request_new (struct prt_packet_s *packet, int count, MPI_Datatype datatype, int peer, int tag)
 request constructor More...
 
void prt_request_destroy (prt_request_t *request)
 request destructor Request is only an envelope for a packet. Request destruction does not affect the packet. Need be, packet is destroyed separately (e.g. send completion). More...
 
void prt_request_send (prt_request_t *request)
 Post a send request. Detects a possible overflow of the request size. More...
 
void prt_request_recv (prt_request_t *request)
 Post a receive request. Detects a possible overflow of the request size. More...
 
int prt_request_test (prt_request_t *request)
 Test a request. Trace only completed requests. More...
 
void prt_request_cancel (prt_request_t *request)
 Cancel a request. Cancel the request, release the packet, free the request object. More...
 

Detailed Description

PRT communication request.

Author
Jakub Kurzak

PULSAR Runtime http://icl.eecs.utk.edu/pulsar/ Copyright (C) 2012-2013 University of Tennessee.

Definition in file prt_request.h.

Typedef Documentation

typedef struct prt_request_s prt_request_t

VSA proxy's communication request Contains basic information about the communication request. Contains the MPI request.

Function Documentation

void prt_request_cancel ( prt_request_t request)

Cancel a request. Cancel the request, release the packet, free the request object.

Parameters
request

Definition at line 151 of file prt_request.c.

References prt_request_s::packet, prt_assert, prt_packet_release(), and prt_request_s::request.

152 {
153  int retval;
154  // Cancel the request.
155  retval = MPI_Cancel(&request->request);
156  prt_assert(retval == MPI_SUCCESS, "error in MPI_Cancel");
157 
158  // Release the packet.
159  prt_packet_release(request->packet);
160 
161  // Free the request.
162  free(request);
163 }
void prt_packet_release(prt_packet_t *packet)
Release a packet. Decrements the number of active references. Destroys the packet when the last refer...
Definition: prt_packet.c:44
MPI_Request request
Definition: prt_request.h:33
struct prt_packet_s * packet
Definition: prt_request.h:28
#define prt_assert(cond, msg)
Definition: prt_assert.h:30

Here is the call graph for this function:

Here is the caller graph for this function:

void prt_request_destroy ( prt_request_t request)

request destructor Request is only an envelope for a packet. Request destruction does not affect the packet. Need be, packet is destroyed separately (e.g. send completion).

Parameters
request

Definition at line 48 of file prt_request.c.

49 {
50  // Free the request.
51  free(request);
52 }

Here is the caller graph for this function:

prt_request_t* prt_request_new ( prt_packet_t packet,
int  count,
MPI_Datatype  datatype,
int  peer,
int  tag 
)

request constructor

Parameters
packet
count
datatype
peer
tag
Returns
new request

Definition at line 25 of file prt_request.c.

References prt_request_s::count, prt_request_s::datatype, prt_request_s::packet, prt_request_s::peer, prt_assert, and prt_request_s::tag.

28 {
29  prt_request_t *request = (prt_request_t*)malloc(sizeof(prt_request_t));
30  prt_assert(request != NULL, "malloc failed");
31  request->packet = packet;
32  request->count = count;
33  request->datatype = datatype;
34  request->peer = peer;
35  request->tag = tag;
36  return request;
37 }
MPI_Datatype datatype
Definition: prt_request.h:30
struct prt_packet_s * packet
Definition: prt_request.h:28
#define prt_assert(cond, msg)
Definition: prt_assert.h:30
VSA proxy's communication request Contains basic information about the communication request...
Definition: prt_request.h:27

Here is the caller graph for this function:

void prt_request_recv ( prt_request_t request)

Post a receive request. Detects a possible overflow of the request size.

Parameters
request

Definition at line 93 of file prt_request.c.

References prt_request_s::count, prt_packet_s::data, prt_request_s::datatype, OliveDrab, prt_request_s::packet, prt_request_s::peer, prt_assert, prt_request_s::request, svg_trace_start(), svg_trace_stop(), and prt_request_s::tag.

94 {
95  int retval;
96  int type_size;
97  long request_size;
98 
99  // Compute type size. Check for overflow.
100  MPI_Type_size(request->datatype, &type_size);
101  request_size = (long)request->count*type_size;
102  prt_assert(request_size <= INT_MAX, "request size overflow");
103 
104  // Post and trace the request. Check the status.
105  svg_trace_start(0);
106  retval = MPI_Irecv(
107  request->packet->data,
108  request->count*type_size,
109  MPI_BYTE,
110  request->peer,
111  request->tag,
112  MPI_COMM_WORLD,
113  &request->request);
115  prt_assert(retval == MPI_SUCCESS, "error in MPI_Isend");
116 }
MPI_Datatype datatype
Definition: prt_request.h:30
MPI_Request request
Definition: prt_request.h:33
void * data
Definition: prt_packet.h:25
void svg_trace_start(int thread_rank)
Start tracing an event.
Definition: svg_trace.c:50
struct prt_packet_s * packet
Definition: prt_request.h:28
#define prt_assert(cond, msg)
Definition: prt_assert.h:30
void svg_trace_stop(int thread_rank, int color)
Stop tracing an event.
Definition: svg_trace.c:63

Here is the call graph for this function:

Here is the caller graph for this function:

void prt_request_send ( prt_request_t request)

Post a send request. Detects a possible overflow of the request size.

Parameters
request

Definition at line 61 of file prt_request.c.

References prt_request_s::count, DarkKhaki, prt_packet_s::data, prt_request_s::datatype, prt_request_s::packet, prt_request_s::peer, prt_assert, prt_request_s::request, svg_trace_start(), svg_trace_stop(), and prt_request_s::tag.

62 {
63  int retval;
64  int type_size;
65  long request_size;
66 
67  // Compute type size. Check for overflow.
68  MPI_Type_size(request->datatype, &type_size);
69  request_size = (long)request->count*type_size;
70  prt_assert(request_size <= INT_MAX, "request size overflow");
71 
72  // Post and trace the request. Check the status.
73  svg_trace_start(0);
74  retval = MPI_Isend(
75  request->packet->data,
76  request->count*type_size,
77  MPI_BYTE,
78  request->peer,
79  request->tag,
80  MPI_COMM_WORLD,
81  &request->request);
83  prt_assert(retval == MPI_SUCCESS, "error in MPI_Isend");
84 }
MPI_Datatype datatype
Definition: prt_request.h:30
MPI_Request request
Definition: prt_request.h:33
void * data
Definition: prt_packet.h:25
void svg_trace_start(int thread_rank)
Start tracing an event.
Definition: svg_trace.c:50
struct prt_packet_s * packet
Definition: prt_request.h:28
#define prt_assert(cond, msg)
Definition: prt_assert.h:30
void svg_trace_stop(int thread_rank, int color)
Stop tracing an event.
Definition: svg_trace.c:63

Here is the call graph for this function:

Here is the caller graph for this function:

int prt_request_test ( prt_request_t request)

Test a request. Trace only completed requests.

Parameters
request
Return values
0Operation pending.
1Operation completed.

Definition at line 128 of file prt_request.c.

References prt_assert, prt_request_s::request, RosyBrown, prt_request_s::status, svg_trace_start(), and svg_trace_stop().

129 {
130  int flag;
131  int retval;
132 
133  // Test the request.
134  // Check the status.
135  // Trace if completed.
136  svg_trace_start(0);
137  retval = MPI_Test(&request->request, &flag, &request->status);
138  if (flag == 1)
140  prt_assert(retval == MPI_SUCCESS, "error in MPI_Test");
141  return flag;
142 }
MPI_Status status
Definition: prt_request.h:34
MPI_Request request
Definition: prt_request.h:33
void svg_trace_start(int thread_rank)
Start tracing an event.
Definition: svg_trace.c:50
#define prt_assert(cond, msg)
Definition: prt_assert.h:30
void svg_trace_stop(int thread_rank, int color)
Stop tracing an event.
Definition: svg_trace.c:63

Here is the call graph for this function:

Here is the caller graph for this function: