libxmp/libxmpf in Omni Compiler  1.3.4
xmp_runtime.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "xmp_internal.h"
#include "mpi.h"
#include "config.h"
Include dependency graph for xmp_runtime.c:

Functions

void xmpc_traverse_init ()
 
void xmpc_traverse_finalize ()
 
int xmp_get_ruuning ()
 
void _XMP_init (int argc, char **argv, MPI_Comm comm)
 
void _XMP_finalize (bool isFinalize)
 
char * _XMP_desc_of (void *p)
 
void xmp_init_all (int argc, char **argv)
 
void xmp_finalize_all ()
 
size_t _XMP_get_datatype_size (int datatype)
 

Variables

int _XMPC_running = 1
 
int _XMPF_running = 0
 
void(* _xmp_pack_array )(void *buffer, void *src, int array_type, size_t array_type_size, int array_dim, int *l, int *u, int *s, unsigned long long *d) = _XMPC_pack_array
 
void(* _xmp_unpack_array )(void *dst, void *buffer, int array_type, size_t array_type_size, int array_dim, int *l, int *u, int *s, unsigned long long *d) = _XMPC_unpack_array
 

Function Documentation

◆ _XMP_desc_of()

char* _XMP_desc_of ( void *  p)
87 {
88  return (char *)p;
89 }

◆ _XMP_finalize()

void _XMP_finalize ( bool  isFinalize)
74 {
75  if (_XMP_runtime_working) {
77 
78 #if defined(_XMP_GASNET) || defined(_XMP_FJRDMA) || defined(_XMP_TCA) || defined(_XMP_MPI3_ONESIDED) || defined(_XMP_UTOFU)
80 #endif
81  _XMP_finalize_world(isFinalize);
82  _XMP_runtime_working = _XMP_N_INT_FALSE;
83  }
84 }
Here is the caller graph for this function:

◆ _XMP_get_datatype_size()

size_t _XMP_get_datatype_size ( int  datatype)
104 {
105  size_t size;
106 
107  // size of each type is obtained from config.h.
108  // Note: need to fix when building a cross compiler.
109  switch (datatype){
110 
111  case _XMP_N_TYPE_BOOL:
112  size = _XMPF_running ? SIZEOF_UNSIGNED_INT : SIZEOF__BOOL;
113  break;
114 
115  case _XMP_N_TYPE_CHAR:
117  size = SIZEOF_UNSIGNED_CHAR; break;
118 
119  case _XMP_N_TYPE_SHORT:
121  size = SIZEOF_UNSIGNED_SHORT; break;
122 
123  case _XMP_N_TYPE_INT:
125  size = SIZEOF_UNSIGNED_INT; break;
126 
127  case _XMP_N_TYPE_LONG:
129  size = SIZEOF_UNSIGNED_LONG; break;
130 
133  size = SIZEOF_UNSIGNED_LONG_LONG; break;
134 
135  case _XMP_N_TYPE_FLOAT:
136 #ifdef __STD_IEC_559_COMPLEX__
137  case _XMP_N_TYPE_FLOAT_IMAGINARY:
138 #endif
139  size = SIZEOF_FLOAT; break;
140 
141  case _XMP_N_TYPE_DOUBLE:
142 #ifdef __STD_IEC_559_COMPLEX__
143  case _XMP_N_TYPE_DOUBLE_IMAGINARY:
144 #endif
145  size = SIZEOF_DOUBLE; break;
146 
148 #ifdef __STD_IEC_559_COMPLEX__
149  case _XMP_N_TYPE_LONG_DOUBLE_IMAGINARY:
150 #endif
151  size = SIZEOF_LONG_DOUBLE; break;
152 
154  size = SIZEOF_FLOAT * 2; break;
155 
157  size = SIZEOF_DOUBLE * 2; break;
158 
160  size = SIZEOF_LONG_DOUBLE * 2; break;
161 
162  case _XMP_N_TYPE_NONBASIC: // should be fixed for structures.
163  default:
164  size = 0; break;
165  }
166 
167  return size;
168 }

◆ _XMP_init()

void _XMP_init ( int  argc,
char **  argv,
MPI_Comm  comm 
)
31 {
32  if (!_XMP_runtime_working) {
33  int flag = 0;
34  MPI_Initialized(&flag);
35 
36  if(!flag)
37  MPI_Init(&argc, &argv);
38  MPI_Comm_rank(MPI_COMM_WORLD, &_XMP_world_rank);
39  MPI_Comm_size(MPI_COMM_WORLD, &_XMP_world_size);
40 
41  // int result = 0;
42  // MPI_Comm_compare(MPI_COMM_WORLD, comm, &result);
43  // if(result != MPI_IDENT)
44  // _XMP_fatal("Now implementation does not support subcommunicator");
45 
46 #ifdef _XMP_XACC
47  _XACC_init();
48 #endif
49 
50 #ifdef _XMP_TCA
51  _XMP_init_tca();
52 #endif
53 
54 #if defined(_XMP_GASNET) || defined(_XMP_FJRDMA) || defined(_XMP_TCA) || defined(_XMP_MPI3_ONESIDED) || defined(_XMP_UTOFU)
56 #endif
57 #ifdef _XMP_MPI3
59 #endif
61  }
62 
63 
64  _XMP_init_world(NULL, NULL);
66 
67  if (!_XMP_runtime_working) {
69  }
70  _XMP_runtime_working = _XMP_N_INT_TRUE;
71 }
Here is the caller graph for this function:

◆ xmp_finalize_all()

void xmp_finalize_all ( )
97 {
98  _XMP_finalize(true);
99 }
Here is the call graph for this function:

◆ xmp_get_ruuning()

int xmp_get_ruuning ( )
26 {
27  return _XMP_runtime_working;
28 }

◆ xmp_init_all()

void xmp_init_all ( int  argc,
char **  argv 
)
92 {
93  _XMP_init(argc, argv, MPI_COMM_WORLD);
94 }
Here is the call graph for this function:

◆ xmpc_traverse_finalize()

void xmpc_traverse_finalize ( )

◆ xmpc_traverse_init()

void xmpc_traverse_init ( )

Variable Documentation

◆ _xmp_pack_array

void(* _xmp_pack_array) (void *buffer, void *src, int array_type, size_t array_type_size, int array_dim, int *l, int *u, int *s, unsigned long long *d) = _XMPC_pack_array

◆ _xmp_unpack_array

void(* _xmp_unpack_array) (void *dst, void *buffer, int array_type, size_t array_type_size, int array_dim, int *l, int *u, int *s, unsigned long long *d) = _XMPC_unpack_array

◆ _XMPC_running

int _XMPC_running = 1

◆ _XMPF_running

int _XMPF_running = 0
_XMP_N_TYPE_BOOL
#define _XMP_N_TYPE_BOOL
Definition: xmp_constant.h:80
_XMP_N_TYPE_INT
#define _XMP_N_TYPE_INT
Definition: xmp_constant.h:85
_XMP_init_tca
void _XMP_init_tca(void)
Definition: xmp_tca_runtime.c:4
xmpc_traverse_init
void xmpc_traverse_init()
_XMP_N_TYPE_DOUBLE
#define _XMP_N_TYPE_DOUBLE
Definition: xmp_constant.h:92
_XMP_world_size
int _XMP_world_size
Definition: xmp_world.c:8
_XMP_N_TYPE_DOUBLE_COMPLEX
#define _XMP_N_TYPE_DOUBLE_COMPLEX
Definition: xmp_constant.h:102
_XMP_finalize_world
void _XMP_finalize_world(void)
_XMP_N_TYPE_LONG_DOUBLE
#define _XMP_N_TYPE_LONG_DOUBLE
Definition: xmp_constant.h:93
_XMP_finalize
void _XMP_finalize(bool isFinalize)
Definition: xmp_runtime.c:73
_XMP_initialize_async_comm_tab
void _XMP_initialize_async_comm_tab()
Definition: xmp_async.c:50
_XMP_N_TYPE_NONBASIC
#define _XMP_N_TYPE_NONBASIC
Definition: xmp_constant.h:104
_XACC_init
void _XACC_init(void)
Definition: xacc_runtime.c:3
_XMP_world_rank
int _XMP_world_rank
Definition: xmp_world.c:9
_XMP_N_TYPE_UNSIGNED_LONGLONG
#define _XMP_N_TYPE_UNSIGNED_LONGLONG
Definition: xmp_constant.h:90
_XMPF_running
int _XMPF_running
Definition: xmp_runtime.c:16
_XMP_N_TYPE_LONG
#define _XMP_N_TYPE_LONG
Definition: xmp_constant.h:87
_XMP_N_TYPE_SHORT
#define _XMP_N_TYPE_SHORT
Definition: xmp_constant.h:83
_XMP_N_TYPE_FLOAT_COMPLEX
#define _XMP_N_TYPE_FLOAT_COMPLEX
Definition: xmp_constant.h:101
_XMP_N_TYPE_FLOAT
#define _XMP_N_TYPE_FLOAT
Definition: xmp_constant.h:91
_XMP_N_TYPE_UNSIGNED_INT
#define _XMP_N_TYPE_UNSIGNED_INT
Definition: xmp_constant.h:86
_XMP_N_INT_FALSE
#define _XMP_N_INT_FALSE
Definition: xmp_constant.h:5
_XMP_init_world
void _XMP_init_world(int *argc, char ***argv)
Definition: xmp_world.c:12
_XMP_N_TYPE_UNSIGNED_LONG
#define _XMP_N_TYPE_UNSIGNED_LONG
Definition: xmp_constant.h:88
_XMP_N_TYPE_UNSIGNED_SHORT
#define _XMP_N_TYPE_UNSIGNED_SHORT
Definition: xmp_constant.h:84
_XMP_N_TYPE_CHAR
#define _XMP_N_TYPE_CHAR
Definition: xmp_constant.h:81
_XMP_N_TYPE_UNSIGNED_CHAR
#define _XMP_N_TYPE_UNSIGNED_CHAR
Definition: xmp_constant.h:82
_XMP_initialize_onesided_functions
void _XMP_initialize_onesided_functions()
Definition: xmp_onesided.c:71
xmp_reduce_initialize
void xmp_reduce_initialize()
Definition: xmp_reduce.c:553
_XMP_N_TYPE_LONG_DOUBLE_COMPLEX
#define _XMP_N_TYPE_LONG_DOUBLE_COMPLEX
Definition: xmp_constant.h:103
_XMP_check_reflect_type
void _XMP_check_reflect_type(void)
Definition: xmp_pack_vector.c:300
_XMP_finalize_onesided_functions
void _XMP_finalize_onesided_functions()
Definition: xmp_onesided.c:142
_XMP_N_TYPE_LONGLONG
#define _XMP_N_TYPE_LONGLONG
Definition: xmp_constant.h:89
_XMP_init
void _XMP_init(int argc, char **argv, MPI_Comm comm)
Definition: xmp_runtime.c:30
xmpc_traverse_finalize
void xmpc_traverse_finalize()
_XMP_N_INT_TRUE
#define _XMP_N_INT_TRUE
Definition: xmp_constant.h:4