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

PRT data channel implementation. More...

#include "prt_channel.h"
Include dependency graph for prt_channel.c:

Go to the source code of this file.


prt_channel_tprt_channel_new (int count, MPI_Datatype datatype, int *src_tuple, int src_slot, int *dst_tuple, int dst_slot)
 channel constructor More...
void prt_channel_delete (prt_channel_t *channel)
 channel destructor More...
void prt_channel_push (prt_channel_t *channel, prt_packet_t *packet)
 Sends a packed down a channel. Increments the packet's number of active references. More...
prt_packet_tprt_channel_pop (prt_channel_t *channel)
 Fetches a packef from a channel. Does not decrement the number of active references. The packet leaves the channel, but enters the VDP. More...
int prt_channel_empty (prt_channel_t *channel)
 Checks if a channel is empty. More...
int prt_channel_compare (void *channel1, void *channel2)
 Compare two channels. More...

Detailed Description

PRT data channel implementation.

Jakub Kurzak

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

Definition in file prt_channel.c.

Function Documentation

int prt_channel_compare ( void *  channel1,
void *  channel2 

Compare two channels.

Return values
-1channel1 is less than channel2.
0channel1 is equal to channel2.
1channel1 is greater than channel2.

Definition at line 174 of file prt_channel.c.

References prt_channel_s::dst_slot, prt_channel_s::dst_tuple, prt_tuple_compare(), prt_channel_s::src_slot, and prt_channel_s::src_tuple.

175 {
176  prt_channel_t *c1 = (prt_channel_t*)channel1;
177  prt_channel_t *c2 = (prt_channel_t*)channel2;
179  if (prt_tuple_compare(c1->src_tuple, c2->src_tuple) != 0)
180  return prt_tuple_compare(c1->src_tuple, c2->src_tuple);
182  if (c1->src_slot < c2->src_slot) return -1;
183  if (c1->src_slot > c2->src_slot) return 1;
185  if (prt_tuple_compare(c1->dst_tuple, c2->dst_tuple) != 0)
186  return prt_tuple_compare(c1->dst_tuple, c2->dst_tuple);
188  if (c1->dst_slot < c2->dst_slot) return -1;
189  if (c1->dst_slot > c2->dst_slot) return 1;
191  return 0;
192 }
int prt_tuple_compare(void *tuple_a, void *tuple_b)
tuple comparison
Definition: prt_tuple.c:135
int * dst_tuple
Definition: prt_channel.h:35
int * src_tuple
Definition: prt_channel.h:33
VDP&#39;s data channel Implements a data link between a pair of VDPs. Identifies the source and destinati...
Definition: prt_channel.h:29

Here is the call graph for this function:

Here is the caller graph for this function:

void prt_channel_delete ( prt_channel_t channel)

channel destructor


Definition at line 64 of file prt_channel.c.

References prt_channel_s::dst_tuple, icl_deque_destroy(), icl_deque_size(), prt_channel_s::packets, prt_assert, and prt_channel_s::src_tuple.

65 {
66  // Check for a NULL channel.
67  prt_assert(channel != NULL, "NULL channel");
69  // Free the source tuple.
70  prt_assert(channel->src_tuple != NULL, "NULL tuple");
71  free(channel->src_tuple);
73  // Free the destination tuple.
74  prt_assert(channel->dst_tuple != NULL, "NULL tuple");
75  free(channel->dst_tuple);
77  // Destroy the list of packets.
78  // Only an empty list can be destroyed.
79  // Therefore NULL given as the packet destructor.
80  prt_assert(channel->packets != NULL, "NULL packets list");
81  int size = icl_deque_size(channel->packets);
82  prt_assert(size == 0, "non-epty packet list");
83  icl_deque_destroy(channel->packets, NULL);
85  // Free the channel.
86  free(channel);
87 }
icl_deque_t * packets
Definition: prt_channel.h:40
int icl_deque_size(icl_deque_t *deque)
Return the deque size.
Definition: icl_deque.c:189
int * dst_tuple
Definition: prt_channel.h:35
int * src_tuple
Definition: prt_channel.h:33
int icl_deque_destroy(icl_deque_t *deque, void(*free_func)(void *))
deque destructor
Definition: icl_deque.c:53
#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:

int prt_channel_empty ( prt_channel_t channel)

Checks if a channel is empty.

Return values
0Channel is not empty. @
1Channel is empty.

Definition at line 153 of file prt_channel.c.

References icl_deque_first(), prt_channel_s::packets, and prt_assert.

154 {
155  // Check for a NULL input params.
156  prt_assert(channel != NULL, "NULL channel");
157  prt_assert(channel->packets != NULL, "NULL packet list");
159  // Return the status.
160  return (icl_deque_first(channel->packets) == NULL);
161 }
icl_deque_t * packets
Definition: prt_channel.h:40
icl_node_t * icl_deque_first(icl_deque_t *deque)
Get the first node in the deque.
Definition: icl_deque.c:76
#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: