libxmp/libxmpf in Omni Compiler  1.3.4
xmp_reflect_gpu.c File Reference
#include "xmp_internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include "xacc_internal.h"
Include dependency graph for xmp_reflect_gpu.c:

Data Structures

struct  stride_t
 

Macros

#define TLOG_LOG(log)   do{}while(0)
 
#define BARRIER()
 

Functions

void _XMP_reflect_do_gpu (_XMP_array_t *array_desc)
 
void _XMP_reflect_init_gpu (void *acc_addr, _XMP_array_t *array_desc)
 
void _XMP_set_reflect_gpu (_XMP_array_t *a, int dim, int lwidth, int uwidth, int is_periodic)
 
void _XMP_reflect_gpu (void *dev_addr, _XMP_array_t *a)
 
void _XMP_init_reflect_sched_gpu (_XMP_reflect_sched_t *sched)
 
void _XMP_finalize_reflect_sched_gpu (_XMP_reflect_sched_t *sched, _Bool free_buf)
 

Macro Definition Documentation

◆ BARRIER

#define BARRIER ( )

◆ TLOG_LOG

#define TLOG_LOG (   log)    do{}while(0)

Function Documentation

◆ _XMP_finalize_reflect_sched_gpu()

void _XMP_finalize_reflect_sched_gpu ( _XMP_reflect_sched_t sched,
_Bool  free_buf 
)
825 {
826  if(sched == NULL) return;
827 
828  if (sched->datatype_lo != MPI_DATATYPE_NULL) MPI_Type_free(&sched->datatype_lo);
829  if (sched->datatype_hi != MPI_DATATYPE_NULL) MPI_Type_free(&sched->datatype_hi);
830 
831  for (int j = 0; j < 4; j++){
832  if (sched->req[j] != MPI_REQUEST_NULL) MPI_Request_free(&sched->req[j]);
833  }
834 
835  if(useHostBuffer){
836  _XACC_host_free(&(sched->lo_send_host_buf));
837  _XACC_host_free(&(sched->lo_recv_host_buf));
838  }
839 
840  if (free_buf && packVector){
841  _XACC_memory_free(&(sched->lo_send_buf_mem));
842  _XACC_memory_free(&(sched->lo_recv_buf_mem));
843  }
844 
845  if(sched->lo_async_id){
846  _XACC_queue_destroy(&(sched->lo_async_id));
847  }
848  if(sched->hi_async_id){
849  _XACC_queue_destroy(&(sched->hi_async_id));
850  }
851 
852  sched->dev_mem = NULL;
853 }
Here is the caller graph for this function:

◆ _XMP_init_reflect_sched_gpu()

void _XMP_init_reflect_sched_gpu ( _XMP_reflect_sched_t sched)
802 {
803  if(sched == NULL) return;
804 
805  sched->is_periodic = -1; /* not used yet */
806  sched->datatype_lo = MPI_DATATYPE_NULL;
807  sched->datatype_hi = MPI_DATATYPE_NULL;
808  for (int j = 0; j < 4; j++) sched->req[j] = MPI_REQUEST_NULL;
809  sched->lo_send_buf_mem = NULL;
810  sched->lo_recv_buf_mem = NULL;
811  sched->hi_send_buf_mem = NULL;
812  sched->hi_recv_buf_mem = NULL;
813  sched->lo_send_host_buf = NULL;
814  sched->lo_recv_host_buf = NULL;
815  sched->hi_send_host_buf = NULL;
816  sched->hi_recv_host_buf = NULL;
817 
818  sched->lo_async_id = _XACC_QUEUE_NULL;
819  sched->hi_async_id = _XACC_QUEUE_NULL;
820 
821  sched->dev_mem = NULL;
822 }
Here is the caller graph for this function:

◆ _XMP_reflect_do_gpu()

void _XMP_reflect_do_gpu ( _XMP_array_t array_desc)
120  {
122 
123  // _XMP_reflect_start(array_desc, 0);
124  // _XMP_reflect_wait(array_desc);
125  _XMP_reflect_(array_desc, 0);
126 }
Here is the caller graph for this function:

◆ _XMP_reflect_gpu()

void _XMP_reflect_gpu ( void *  dev_addr,
_XMP_array_t a 
)
62 {
63  _XMP_reflect_init_gpu(dev_addr, a);
65 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMP_reflect_init_gpu()

void _XMP_reflect_init_gpu ( void *  acc_addr,
_XMP_array_t array_desc 
)
68 {
70 
71  static char isFlagSetted = 0;
72  if(! isFlagSetted ){
73  char *mode_str = getenv("XACC_COMM_MODE");
74  if(mode_str != NULL){
75  int mode = atoi(mode_str);
76  switch(mode){
77  default:
78  case 0:
79  packVector = 1;
80  useHostBuffer = 1;
81  break;
82  case 1:
83  packVector = 1;
84  useHostBuffer = 0;
85  break;
86  case 2:
87  packVector = 0;
88  useHostBuffer = 0;
89  break;
90  }
91  }
92  isFlagSetted = 1;
93  }
94  //printf("reflect mode (%d, %d)\n", packVector, useHostBuffer);
95 
96  if (!a->is_allocated){
97  _xmpf_set_reflect_flag = 0;
98  return;
99  }
100 
101  if (!_xmpf_set_reflect_flag){
102  for (int i = 0; i < a->dim; i++){
103  _XMP_array_info_t *ai = &(a->info[i]);
104  _xmp_lwidth[i] = ai->shadow_size_lo;
105  _xmp_uwidth[i] = ai->shadow_size_hi;
106  _xmp_is_periodic[i] = 0;
107  }
108  }
109 
110  _XMP_reflect_sched(a, _xmp_lwidth, _xmp_uwidth, _xmp_is_periodic, 0, dev_addr);
111 
112  _xmpf_set_reflect_flag = 0;
113  for (int i = 0; i < a->dim; i++){
114  _xmp_lwidth[i] = 0;
115  _xmp_uwidth[i] = 0;
116  _xmp_is_periodic[i] = 0;
117  }
118 }
Here is the caller graph for this function:

◆ _XMP_set_reflect_gpu()

void _XMP_set_reflect_gpu ( _XMP_array_t a,
int  dim,
int  lwidth,
int  uwidth,
int  is_periodic 
)
54 {
55  _xmpf_set_reflect_flag = 1;
56  _xmp_lwidth[dim] = lwidth;
57  _xmp_uwidth[dim] = uwidth;
58  _xmp_is_periodic[dim] = is_periodic;
59 }
Here is the caller graph for this function:
_XMP_reflect_sched_type::is_periodic
int is_periodic
Definition: xmp_data_struct.h:126
_XMP_reflect_sched_type::datatype_hi
MPI_Datatype datatype_hi
Definition: xmp_data_struct.h:129
_XMP_array_info_type
Definition: xmp_data_struct.h:194
_XMP_reflect_sched_type::req
MPI_Request req[4]
Definition: xmp_data_struct.h:131
_XMP_reflect_sched_type::datatype_lo
MPI_Datatype datatype_lo
Definition: xmp_data_struct.h:128
_XMP_array_info_type::shadow_size_lo
int shadow_size_lo
Definition: xmp_data_struct.h:249
_XACC_host_free
void _XACC_host_free(void **ptr)
Definition: xacc_util_cl.c:108
_XMP_array_info_type::shadow_size_hi
int shadow_size_hi
Definition: xmp_data_struct.h:250
_XMP_reflect_do_gpu
void _XMP_reflect_do_gpu(_XMP_array_t *array_desc)
Definition: xmp_reflect_gpu.c:120
_XACC_queue_destroy
void _XACC_queue_destroy(_XACC_queue_t *queue)
Definition: xacc_util_cl.c:35
_XMP_RETURN_IF_SINGLE
#define _XMP_RETURN_IF_SINGLE
Definition: xmp_internal.h:37
_XMP_reflect_init_gpu
void _XMP_reflect_init_gpu(void *acc_addr, _XMP_array_t *array_desc)
Definition: xmp_reflect_gpu.c:67
_XACC_memory_free
void _XACC_memory_free(_XACC_memory_t *memory)
Definition: xacc_util_cl.c:64