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

Data Structures

struct  packet_t
 
struct  tca_ring_buf_t
 

Macros

#define RING_SIZE   (8)
 

Typedefs

typedef struct packet_t packet_t
 
typedef unsigned long long psn_t
 
typedef struct tca_ring_buf_t tca_ring_buf_t
 

Functions

void _XMP_tca_comm_init ()
 
void _XMP_tca_comm_finalize ()
 
void _XMP_tca_initialize ()
 Initialize TCA. More...
 
void _XMP_tca_finalize ()
 Finalize TCA. More...
 
void _XMP_tca_comm_send (const int rank, const int tag, const int data)
 
bool _XMP_tca_comm_recv_nowait (const int rank, packet_t *packet)
 
void _XMP_tca_comm_recv (const int rank, int *tag, int *data)
 
double getElapsedTime_ (struct timespec *begin, struct timespec *end)
 
void _XMP_tca_lock ()
 
void _XMP_tca_unlock ()
 

Variables

const int _wait_slot_offset = 16
 
const int _dmac_channel = 0
 
const int _handle_sendrecv_tag = 123
 
const int _packet_wait_tag = 31
 
const int _psn_wait_tag = 32
 
tca_ring_buf_t_ring_bufs
 
struct timespec begin_ts end_ts
 

Macro Definition Documentation

◆ RING_SIZE

#define RING_SIZE   (8)

Typedef Documentation

◆ packet_t

typedef struct packet_t packet_t

◆ psn_t

typedef unsigned long long psn_t

◆ tca_ring_buf_t

Function Documentation

◆ _XMP_tca_comm_finalize()

void _XMP_tca_comm_finalize ( )
197 {
198  for(int i = 0; i < _XMP_world_size; i++){
199  if(i == _XMP_world_rank) continue;
200  _XMP_tca_ring_buf_finalize(&_ring_bufs[i]);
201  }
203  //fprintf(stderr, "spin_wait_count=%llu\n", spin_wait_count);
204 }

◆ _XMP_tca_comm_init()

void _XMP_tca_comm_init ( )
187 {
189  for(int i = 0; i < _XMP_world_size; i++){
190  if(i == _XMP_world_rank) continue;
191  _XMP_tca_ring_buf_init(&_ring_bufs[i], i);
192  }
193 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMP_tca_comm_recv()

void _XMP_tca_comm_recv ( const int  rank,
int *  tag,
int *  data 
)
340 {
341  if(rank == _XMP_world_rank){
342  _XMP_fatal("recv from self is not supported");
343  }
344  _XMP_tca_ring_buf_recv(&_ring_bufs[rank], tag, data);
345 }
Here is the call graph for this function:

◆ _XMP_tca_comm_recv_nowait()

bool _XMP_tca_comm_recv_nowait ( const int  rank,
packet_t packet 
)
331  {
332  if(rank == _XMP_world_rank){
333  _XMP_fatal("recv from self is not supported");
334  return false;
335  }
336  return _XMP_tca_ring_buf_recv_nowait(&_ring_bufs[rank], packet);
337 }
Here is the call graph for this function:

◆ _XMP_tca_comm_send()

void _XMP_tca_comm_send ( const int  rank,
const int  tag,
const int  data 
)
247 {
248  if(rank == _XMP_world_rank){
249  _XMP_fatal("send to self is not supported");
250  }
251  _XMP_tca_ring_buf_send(&_ring_bufs[rank], tag, data);
252 }
Here is the call graph for this function:

◆ _XMP_tca_finalize()

void _XMP_tca_finalize ( )

Finalize TCA.

46 {
47  _XMP_tca_lock();
48  destroy_comm_thread();
51 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMP_tca_initialize()

void _XMP_tca_initialize ( )

Initialize TCA.

23 {
24  if(_XMP_world_rank == 0){
25  fprintf(stderr, "TCA Library Version = %s\n", TCA_LIB_VERSION);
26  }
27 
28  if(_XMP_world_size > 16)
29  _XMP_fatal("TCA reflect has been not implemented in 16 more than nodes.");
30 
31  _XMP_tca_lock();
32  /* TCA_CHECK(tcaInit()); */
33 
34  //this is probably unnecessary
35  TCA_CHECK(tcaDMADescInt_Init()); // Initialize Descriptor (Internal Memory) Mode
36 
38  create_comm_thread();
40 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMP_tca_lock()

void _XMP_tca_lock ( )
416 {
417  int ret = pthread_mutex_lock(&_XMP_tca_mutex);
418  if(ret == 0) return;
419 
420  _XMP_fatal("tca lock failed");
421 }
Here is the caller graph for this function:

◆ _XMP_tca_unlock()

void _XMP_tca_unlock ( )
424 {
425  int ret = pthread_mutex_unlock(&_XMP_tca_mutex);
426  if(ret == 0) return;
427  _XMP_fatal("tca unlock failed");
428 }
Here is the caller graph for this function:

◆ getElapsedTime_()

double getElapsedTime_ ( struct timespec *  begin,
struct timespec *  end 
)
352  {
353  return (end->tv_sec - begin->tv_sec) + (end->tv_nsec - begin->tv_nsec) * 1e-9;
354 }

Variable Documentation

◆ _dmac_channel

const int _dmac_channel = 0

◆ _handle_sendrecv_tag

const int _handle_sendrecv_tag = 123

◆ _packet_wait_tag

const int _packet_wait_tag = 31

◆ _psn_wait_tag

const int _psn_wait_tag = 32

◆ _ring_bufs

tca_ring_buf_t* _ring_bufs

◆ _wait_slot_offset

const int _wait_slot_offset = 16

◆ end_ts

struct timespec begin_ts end_ts
_XMP_tca_lock
void _XMP_tca_lock()
Definition: xmp_onesided_tca.c:415
_XMP_tca_comm_finalize
void _XMP_tca_comm_finalize()
Definition: xmp_onesided_tca.c:196
_ring_bufs
tca_ring_buf_t * _ring_bufs
Definition: xmp_onesided_tca.c:85
_XMP_alloc
void * _XMP_alloc(size_t size)
Definition: xmp_util.c:21
_XMP_world_size
int _XMP_world_size
Definition: xmp_world.c:8
_XMP_tca_unlock
void _XMP_tca_unlock()
Definition: xmp_onesided_tca.c:423
_XMP_world_rank
int _XMP_world_rank
Definition: xmp_world.c:9
_XMP_free
void _XMP_free(void *p)
Definition: xmp_util.c:37
_XMP_fatal
void _XMP_fatal(char *msg)
Definition: xmp_util.c:42
_XMP_tca_comm_init
void _XMP_tca_comm_init()
Definition: xmp_onesided_tca.c:186
tca_ring_buf_t
Definition: xmp_onesided_tca.c:67