libxmp/libxmpf in Omni Compiler  1.3.4
xmpco_alloc.c File Reference
#include "xmpco_internal.h"
#include "_xmpco_alloc.h"
Include dependency graph for xmpco_alloc.c:

Functions

size_t xmp_coarray_malloc_bytes ()
 
size_t xmp_coarray_allocated_bytes ()
 
size_t xmp_coarray_garbage_bytes ()
 
CoarrayInfo_tXMPCO_malloc_coarray (char **addr, int count, size_t element, ResourceSet_t *rset)
 
CoarrayInfo_tXMPCO_regmem_coarray (void *var, int count, size_t element, ResourceSet_t *rset)
 
CoarrayInfo_tXMPCO_malloc_staticCoarray (char **addr, int count, size_t element, int namelen, char *name)
 have a share of memory in the pool (if not larger than threshold) or allocate individually (if larger than threshold) out: return : pointer to descriptor CoarrayInfo_t addr : address of the coarray object to be allocated in: count : count of elements element: element size namelen: character length of name (for debugging) name : name of the coarray (for debugging) More...
 
CoarrayInfo_tXMPCO_regmem_staticCoarray (void *var, int count, size_t element, int namelen, char *name)
 Similar to _alloc_static_coarray() except that the coarray is allocated not by the runtime but by the Fortran system. More...
 
void XMPCO_free_coarray (CoarrayInfo_t *cinfo)
 
void XMPCO_deregmem_coarray (CoarrayInfo_t *cinfo)
 
void XMPCO_malloc_pool ()
 
void XMPCO_count_size (int count, size_t element)
 
MPI_Comm _XMPCO_get_comm_fromCoarrayInfo (CoarrayInfo_t *cinfo)
 
void XMPCO_prolog (ResourceSet_t **rsetp, int namelen, char *name)
 
void XMPCO_epilog (ResourceSet_t **rsetp)
 
CoarrayInfo_tXMPCO_find_descptr (char *addr, int namelen, char *name)
 generate and return a descriptor for a coarray DUMMY ARGUMENT More...
 
void _XMPCO_set_corank (CoarrayInfo_t *cp, int corank)
 
void _XMPCO_set_codim_withBounds (CoarrayInfo_t *cp, int dim, int lb, int ub)
 
void _XMPCO_set_codim_withSize (CoarrayInfo_t *cp, int dim, int lb, int size)
 
void _XMPCO_set_varname (CoarrayInfo_t *cp, int namelen, char *name)
 
CoarrayInfo_t_XMPCO_set_nodes (CoarrayInfo_t *cinfo, _XMP_nodes_t *nodes)
 
char * _XMPCO_get_nameOfCoarray (CoarrayInfo_t *cinfo)
 
char * _XMPCO_get_baseAddrOfCoarray (CoarrayInfo_t *cinfo)
 
size_t _XMPCO_get_sizeOfCoarray (CoarrayInfo_t *cinfo)
 
size_t _XMPCO_get_offsetInCoarray (CoarrayInfo_t *cinfo, char *addr)
 
void * _XMPCO_get_descForMemoryChunk (CoarrayInfo_t *cinfo)
 
char * _XMPCO_get_orgAddrOfMemoryChunk (CoarrayInfo_t *cinfo)
 
size_t _XMPCO_get_sizeOfMemoryChunk (CoarrayInfo_t *cinfo)
 
size_t _XMPCO_get_offsetInMemoryChunk (CoarrayInfo_t *cinfo, char *addr)
 
BOOL _XMPCO_isAddrInMemoryChunk (char *localAddr, CoarrayInfo_t *cinfo)
 
void * _XMPCO_get_infoOfCtrlData (char **baseAddr, size_t *offset, char **name)
 
void * _XMPCO_get_infoOfLocalBuf (char **baseAddr, size_t *offset, char **name)
 
void * _XMPCO_get_desc_fromLocalAddr (char *localAddr, char **orgAddr, size_t *offset, char **name)
 
int _XMPCO_nowInTask ()
 
void _XMPCO_checkIfInTask (char *msgopt)
 

Variables

struct {
   MemoryChunkOrder_t *   head
 
   MemoryChunkOrder_t *   tail
 
_mallocStack
 

Function Documentation

◆ _XMPCO_checkIfInTask()

void _XMPCO_checkIfInTask ( char *  msgopt)
1426 {
1427  if (_XMPCO_nowInTask())
1428  _XMPCO_fatal("current restriction: "
1429  "cannot use %s in any task construct\n", msgopt);
1430 }
Here is the call graph for this function:

◆ _XMPCO_get_baseAddrOfCoarray()

char* _XMPCO_get_baseAddrOfCoarray ( CoarrayInfo_t cinfo)
707 {
708  return cinfo->baseAddr;
709 }

◆ _XMPCO_get_comm_fromCoarrayInfo()

MPI_Comm _XMPCO_get_comm_fromCoarrayInfo ( CoarrayInfo_t cinfo)
528 {
529  if (cinfo == NULL)
530  return MPI_COMM_NULL;
531 
532  _XMP_nodes_t *nodes = cinfo->nodes;
533 
534  if (nodes == NULL)
535  return MPI_COMM_NULL;
536 
537  return *(MPI_Comm*)(nodes->comm);
538 }
Here is the caller graph for this function:

◆ _XMPCO_get_desc_fromLocalAddr()

void* _XMPCO_get_desc_fromLocalAddr ( char *  localAddr,
char **  orgAddr,
size_t *  offset,
char **  name 
)
786 {
787  MemoryChunk_t* chunk = _findMemoryChunkInSortedChunkTable(localAddr);
788  if (chunk == NULL) {
789  *orgAddr = NULL;
790  *offset = 0;
791  *name = "(not found)";
792  return NULL;
793  }
794 
795  *orgAddr = chunk->orgAddr;
796  *offset = localAddr - *orgAddr;
797  *name = chunk->headCoarray->next->name;
798  return chunk->desc;
799 }
Here is the caller graph for this function:

◆ _XMPCO_get_descForMemoryChunk()

void* _XMPCO_get_descForMemoryChunk ( CoarrayInfo_t cinfo)
726 {
727  return cinfo->parent->desc;
728 }
Here is the caller graph for this function:

◆ _XMPCO_get_infoOfCtrlData()

void* _XMPCO_get_infoOfCtrlData ( char **  baseAddr,
size_t *  offset,
char **  name 
)
760 {
761  MemoryChunk_t *chunk = _cinfo_ctrlData->parent;
762  char *orgAddr = chunk->orgAddr; // origin address of the memory pool
763 
764  *baseAddr = _cinfo_ctrlData->baseAddr; // base address of the control data
765  *offset = orgAddr - *baseAddr; // offset of the control data in the memory pool
766  *name = _cinfo_ctrlData->name; // name of the control data
767  return chunk->desc; // descriptor of the memory pool
768 }

◆ _XMPCO_get_infoOfLocalBuf()

void* _XMPCO_get_infoOfLocalBuf ( char **  baseAddr,
size_t *  offset,
char **  name 
)
771 {
772  MemoryChunk_t *chunk = _cinfo_localBuf->parent;
773  char *orgAddr = chunk->orgAddr; // origin address of the memory pool
774 
775  *baseAddr = _cinfo_localBuf->baseAddr; // base address of the local buffer
776  *offset = orgAddr - *baseAddr; // offset of the local buffer in the memory pool
777  *name = _cinfo_localBuf->name; // name of the local buffer
778  return chunk->desc; // descriptor of the memory pool
779 }
Here is the caller graph for this function:

◆ _XMPCO_get_nameOfCoarray()

char* _XMPCO_get_nameOfCoarray ( CoarrayInfo_t cinfo)
702 {
703  return cinfo->name;
704 }
Here is the caller graph for this function:

◆ _XMPCO_get_offsetInCoarray()

size_t _XMPCO_get_offsetInCoarray ( CoarrayInfo_t cinfo,
char *  addr 
)
717 {
718  size_t offset = addr - cinfo->baseAddr;
719  return offset;
720 }

◆ _XMPCO_get_offsetInMemoryChunk()

size_t _XMPCO_get_offsetInMemoryChunk ( CoarrayInfo_t cinfo,
char *  addr 
)
741 {
742  char* orgAddr = cinfo->parent->orgAddr;
743  size_t offset = addr - orgAddr;
744  return offset;
745 }
Here is the caller graph for this function:

◆ _XMPCO_get_orgAddrOfMemoryChunk()

char* _XMPCO_get_orgAddrOfMemoryChunk ( CoarrayInfo_t cinfo)
731 {
732  return cinfo->parent->orgAddr;
733 }
Here is the caller graph for this function:

◆ _XMPCO_get_sizeOfCoarray()

size_t _XMPCO_get_sizeOfCoarray ( CoarrayInfo_t cinfo)
712 {
713  return cinfo->size;
714 }

◆ _XMPCO_get_sizeOfMemoryChunk()

size_t _XMPCO_get_sizeOfMemoryChunk ( CoarrayInfo_t cinfo)
736 {
737  return cinfo->parent->nbytes;
738 }
Here is the caller graph for this function:

◆ _XMPCO_isAddrInMemoryChunk()

BOOL _XMPCO_isAddrInMemoryChunk ( char *  localAddr,
CoarrayInfo_t cinfo 
)
748 {
749  char *orgAddr = _XMPCO_get_orgAddrOfMemoryChunk(cinfo);
750  size_t size = _XMPCO_get_sizeOfMemoryChunk(cinfo);
751  size_t offset = localAddr - orgAddr;
752  BOOL result = (offset < size);
753  return result;
754 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMPCO_nowInTask()

int _XMPCO_nowInTask ( )
1421 {
1423 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMPCO_set_codim_withBounds()

void _XMPCO_set_codim_withBounds ( CoarrayInfo_t cp,
int  dim,
int  lb,
int  ub 
)
619 {
620  int i, count, n_images, size;
621 
622  if (0 <= dim && dim < cp->corank - 1) { // not last dimension
623  cp->lcobound[dim] = lb;
624  cp->ucobound[dim] = ub;
625  size = ub - lb + 1;
626  cp->cosize[dim] = size;
627  if (cp->cosize[dim] <= 0)
628  _XMPCO_fatal("upper cobound less than lower cobound");
629  }
630  else if (dim == cp->corank - 1) { // last dimension
631  // ub is ignored.
632  cp->lcobound[dim] = lb;
633  n_images = _XMPCO_get_currentNumImages();
634  for (i = 0, count = 1; i < cp->corank - 1; i++)
635  count *= cp->cosize[i];
636  size = DIV_CEILING(n_images, count);
637  cp->cosize[dim] = size;
638  cp->ucobound[dim] = lb + size - 1;
639  }
640  else { // illegal
641  _XMPCO_fatal("spedified dim (%d) is too large or less than zero.\n", dim);
642  }
643 }
Here is the call graph for this function:

◆ _XMPCO_set_codim_withSize()

void _XMPCO_set_codim_withSize ( CoarrayInfo_t cp,
int  dim,
int  lb,
int  size 
)
646 {
647  int i, count, n_images, ub;
648 
649  if (0 <= dim && dim < cp->corank - 1) { // not last dimension
650  if (size < 0)
651  _XMPCO_fatal("Size should not be less than zero.");
652  cp->lcobound[dim] = lb;
653  cp->cosize[dim] = size;
654  ub = lb + size - 1;
655  cp->ucobound[dim] = ub;
656  }
657  else if (dim == cp->corank - 1) { // last dimension
658  // size is ignored.
659  cp->lcobound[dim] = lb;
660  n_images = _XMPCO_get_currentNumImages();
661  for (i = 0, count = 1; i < cp->corank - 1; i++)
662  count *= cp->cosize[i];
663  size = DIV_CEILING(n_images, count);
664  cp->cosize[dim] = size;
665  cp->ucobound[dim] = lb + size - 1;
666  }
667  else { // last dimension or more
668  _XMPCO_fatal("Spedified dim (%d) is too large or less than zero.\n", dim);
669  }
670 }
Here is the call graph for this function:

◆ _XMPCO_set_corank()

void _XMPCO_set_corank ( CoarrayInfo_t cp,
int  corank 
)
607 {
608  cp->corank = corank;
609  cp->lcobound = (int*)_MALLOC(sizeof(int) * corank);
610  cp->ucobound = (int*)_MALLOC(sizeof(int) * corank);
611  cp->cosize = (int*)_MALLOC(sizeof(int) * corank);
612 
613  _XMPCO_debugPrint("*** set corank of CoarrayInfo %s, corank=%d\n",
614  _dispCoarrayInfo(cp), cp->corank);
615 }

◆ _XMPCO_set_nodes()

CoarrayInfo_t* _XMPCO_set_nodes ( CoarrayInfo_t cinfo,
_XMP_nodes_t nodes 
)
683 {
684  if (cinfo != NULL) {
685  cinfo->nodes = nodes;
686  return cinfo;
687  }
688 
689  CoarrayInfo_t* cinfo1 = _newCoarrayInfo_empty();
690  cinfo1->nodes = nodes;
691  return cinfo1;
692 }

◆ _XMPCO_set_varname()

void _XMPCO_set_varname ( CoarrayInfo_t cp,
int  namelen,
char *  name 
)
674 {
675  cp->name = _xmp_strndup(name, namelen);
676  _XMPCO_debugPrint("*** set name of CoarrayInfo %s\n",
677  _dispCoarrayInfo(cp));
678 }

◆ xmp_coarray_allocated_bytes()

size_t xmp_coarray_allocated_bytes ( )
113 {
114  MemoryChunkOrder_t *chunkp;
115  MemoryChunk_t *chunk;
116  size_t size, size1;
117 
118  // sum all sizes of MemoryChunks
119  size = 0;
120  forallMemoryChunkOrder(chunkp) {
121  chunk = chunkp->chunk;
122  size1 = size + chunk->nbytes;
123  if (size1 < size)
124  _XMPCO_fatal("More than %llu-bytes of memory required for static coarrays\n",
125  ~(size_t)0 );
126  size = size1;
127  }
128 
129  // subtract the size of the localBuf and ctrlData CoarrayInfos
130  // because this is not allocated by the user
131  size -= _cinfo_ctrlData->size + _cinfo_localBuf->size;
132 
133  return size;
134 }
Here is the call graph for this function:

◆ xmp_coarray_garbage_bytes()

size_t xmp_coarray_garbage_bytes ( )
138 {
139  MemoryChunkOrder_t *chunkp;
140  MemoryChunk_t *chunk;
141  size_t size;
142 
143  size = 0;
144  forallMemoryChunkOrder(chunkp) {
145  chunk = chunkp->chunk;
146  if (chunk->isGarbage)
147  size += chunk->nbytes;
148  }
149 
150  return size;
151 }

◆ xmp_coarray_malloc_bytes()

size_t xmp_coarray_malloc_bytes ( )
108 {
109  return _mallocSize;
110 }

◆ XMPCO_count_size()

void XMPCO_count_size ( int  count,
size_t  element 
)
507 {
508  size_t thisSize = count * element;
509  size_t mallocSize = ROUND_UP_MALLOC(thisSize);
510 
511  if (mallocSize > _XMPCO_get_poolThreshold()) {
512  _XMPCO_debugPrint("XMPCO_COUNT_SIZE_: no count because of the large size\n"
513  " pooling threshold :%10u bytes\n"
514  " data size :%10u bytes\n",
515  _XMPCO_get_poolThreshold(), mallocSize);
516  return;
517  }
518 
519  pool_totalSize += mallocSize;
520  _XMPCO_debugPrint("XMPCO_COUNT_SIZE_: count up\n"
521  " %u bytes, totally %u bytes\n",
522  mallocSize, pool_totalSize);
523 }
Here is the call graph for this function:

◆ XMPCO_deregmem_coarray()

void XMPCO_deregmem_coarray ( CoarrayInfo_t cinfo)
375 {
376  MemoryChunk_t *chunk = cinfo->parent;
377 
378  // SYNCALL_AUTO
380 
381  _XMPCO_debugPrint("_XMPCO_DEREGMEM_COARRAY for MemoryChunk %s\n",
382  _dispMemoryChunk(chunk));
383 
384  // unlink and free CoarrayInfo keeping MemoryChunk
385  _unlinkCoarrayInfo(cinfo);
386  _freeCoarrayInfo(cinfo);
387 
388  if (IsEmptyMemoryChunk(chunk)) {
389  // unlink this memory chunk
390  _unlinkMemoryChunk(chunk);
391  }
392 }
Here is the call graph for this function:

◆ XMPCO_epilog()

void XMPCO_epilog ( ResourceSet_t **  rsetp)
551 {
552  if (*rsetp == NULL)
553  return;
554 
555  _XMPCO_debugPrint("XMPCO_EPILOG_ (procedure name=\'%s\', *rsetp=%p)\n",
556  (*rsetp)->name, *rsetp);
557 
558  _freeResourceSet(*rsetp); // with or without automatic SYNCALL
559  *rsetp = NULL;
560 }
Here is the call graph for this function:

◆ XMPCO_find_descptr()

CoarrayInfo_t* XMPCO_find_descptr ( char *  addr,
int  namelen,
char *  name 
)

generate and return a descriptor for a coarray DUMMY ARGUMENT

  1. find the memory chunk that contains the coarray data object,
  2. generate coarrayInfo for the coarray dummy argument and link it to the memory chunk, and
  3. return coarrayInfo as descPtr
575 {
576  MemoryChunk_t *myChunk;
577 
578  _XMPCO_debugPrint("_XMF_CO_FIND_DESCPTR_ "
579  "(varname=\'%.*s\')\n",
580  namelen, name);
581 
582  // generate a new descPtr for an allocatable dummy coarray
583  CoarrayInfo_t *cinfo = _newCoarrayInfo_empty();
584 
585  // search my MemoryChunk only from addr
586  myChunk = _findMemoryChunkInSortedChunkTable(addr);
587 
588  if (myChunk != NULL) {
589  _XMPCO_debugPrint("*** found my home MemoryChunk %s\n",
590  _dispMemoryChunk(myChunk));
591  // return coarrayInfo as descPtr
592  _addCoarrayInfo(myChunk, cinfo);
593  return cinfo;
594  }
595 
596  _XMPCO_debugPrint("*** found no MemoryChunk of mine\n");
597  return NULL;
598 }
Here is the call graph for this function:

◆ XMPCO_free_coarray()

void XMPCO_free_coarray ( CoarrayInfo_t cinfo)
352 {
353  MemoryChunk_t *chunk = cinfo->parent;
354 
355  // SYNCALL_AUTO
357 
358  _XMPCO_debugPrint("_XMPCO_FREE_COARRAY for MemoryChunk %s\n",
359  _dispMemoryChunk(chunk));
360 
361  // unlink and free CoarrayInfo keeping MemoryChunk
362  _unlinkCoarrayInfo(cinfo);
363  _freeCoarrayInfo(cinfo);
364 
365  if (IsEmptyMemoryChunk(chunk)) {
366  // unlink this memory chunk as a garbage
367  _unlinkMemoryChunk(chunk);
368  // now chance to cellect and free garbages
369  _garbageCollectMallocHistory();
370  }
371 }
Here is the call graph for this function:

◆ XMPCO_malloc_coarray()

CoarrayInfo_t* XMPCO_malloc_coarray ( char **  addr,
int  count,
size_t  element,
ResourceSet_t rset 
)
161 {
162  size_t nbytes = count * element;
163 
164  _XMPCO_debugPrint("_XMPCO_MALLOC_COARRAY\n");
165 
166  // malloc
167  MemoryChunk_t *chunk = _mallocMemoryChunk(count, element);
168  _XMPCO_debugPrint("*** new MemoryChunk %s\n",
169  _dispMemoryChunk(chunk));
170 
171  if (rset != NULL) {
172  _addMemoryChunkInResourceSet(rset, chunk);
173 
174  _XMPCO_debugPrint("*** MemoryChunk %s added to rset=%p\n",
175  _dispMemoryChunk(chunk), rset);
176  }
177 
178  // make coarrayInfo and linkage
179  CoarrayInfo_t *cinfo = _newCoarrayInfo(chunk->orgAddr, nbytes);
180 
181  _addCoarrayInfo(chunk, cinfo);
182 
183  *addr = cinfo->baseAddr; // == chunk->orgAddr
184  return cinfo;
185 }
Here is the call graph for this function:

◆ XMPCO_malloc_pool()

void XMPCO_malloc_pool ( )
456 {
457  size_t ctrlDataSize = sizeof(int) * 8;
458  size_t localBufSize = _XMPCO_get_localBufSize();
459 
460  _XMPCO_debugPrint("XMPCO_MALLOC_POOL_ contains:\n"
461  " system-defined local buffer :%10u bytes\n"
462  " system-defined control data :%10u bytes\n"
463  " user-defined coarays :%10u bytes\n",
464  localBufSize, ctrlDataSize, pool_totalSize);
465 
466  pool_totalSize += localBufSize + ctrlDataSize;
467 
468  // init malloc/free history (STRUCTURE-II)
469  _initMallocHistory();
470 
471  // init sorted chunk table (STRUCTURE-III)
472  _initSortedChunkTable();
473 
474  // malloc the pool
475  pool_chunk = _mallocMemoryChunk(1, pool_totalSize);
476  pool_currentAddr = pool_chunk->orgAddr;
477 
478  // share communication buffer in the pool
479  _cinfo_localBuf = _getShareOfStaticCoarray(localBufSize);
480  _cinfo_localBuf->name = "(localBuf)";
481  _setSimpleCoshapeToCoarrayInfo(_cinfo_localBuf);
482 
483  // share control data area in the pool
484  _cinfo_ctrlData = _getShareOfStaticCoarray(ctrlDataSize);
485  _cinfo_ctrlData->name = "(ctrlData)";
486  _setSimpleCoshapeToCoarrayInfo(_cinfo_ctrlData);
487 }
Here is the call graph for this function:

◆ XMPCO_malloc_staticCoarray()

CoarrayInfo_t* XMPCO_malloc_staticCoarray ( char **  addr,
int  count,
size_t  element,
int  namelen,
char *  name 
)

have a share of memory in the pool (if not larger than threshold) or allocate individually (if larger than threshold) out: return : pointer to descriptor CoarrayInfo_t addr : address of the coarray object to be allocated in: count : count of elements element: element size namelen: character length of name (for debugging) name : name of the coarray (for debugging)

223 {
224  size_t nbytes = count * element;
225  CoarrayInfo_t *cinfo;
226 
227  _XMPCO_debugPrint("_XMPCO_ALLOC_STATIC_COARRAY varname=\'%.*s\'\n"
228  " count=%d, element=%d, nbytes=%u\n",
229  namelen, name, count, element, nbytes);
230 
231  if (nbytes > _XMPCO_get_poolThreshold()) {
232  _XMPCO_debugPrint("*** LARGER (%u bytes) than threshold\n", nbytes);
233  cinfo = _allocLargeStaticCoarray(nbytes);
234  } else {
235  size_t nbytesRU = ROUND_UP_MALLOC(nbytes);
236  _XMPCO_debugPrint("*** Not LARGER (%u bytes) than threshold\n", nbytesRU);
237  cinfo = _getShareOfStaticCoarray(nbytesRU);
238  }
239  cinfo->name = _xmp_strndup(name, namelen);
240 
241  *addr = cinfo->baseAddr;
242  return cinfo;
243 }
Here is the call graph for this function:

◆ XMPCO_prolog()

void XMPCO_prolog ( ResourceSet_t **  rsetp,
int  namelen,
char *  name 
)
542 {
543  *rsetp = _newResourceSet(name, namelen);
544 
545  _XMPCO_debugPrint("XMPCO_PROLOG (procedure name=\'%s\', *rsetp=%p)\n",
546  (*rsetp)->name, *rsetp);
547 }

◆ XMPCO_regmem_coarray()

CoarrayInfo_t* XMPCO_regmem_coarray ( void *  var,
int  count,
size_t  element,
ResourceSet_t rset 
)
191 {
192  size_t nbytes = count * element;
193 
194  _XMPCO_debugPrint("_XMPCO_REGMEM_COARRAY\n");
195 
196  // regmem
197  MemoryChunk_t *chunk = _regmemMemoryChunk_core(var, nbytes);
198  _XMPCO_debugPrint("*** new MemoryChunk for RegMem variable %s\n",
199  _dispMemoryChunk(chunk));
200 
201  // make coarrayInfo and linkage
202  CoarrayInfo_t *cinfo = _newCoarrayInfo(chunk->orgAddr, nbytes);
203 
204  _addCoarrayInfo(chunk, cinfo);
205  return cinfo;
206 }
Here is the call graph for this function:

◆ XMPCO_regmem_staticCoarray()

CoarrayInfo_t* XMPCO_regmem_staticCoarray ( void *  var,
int  count,
size_t  element,
int  namelen,
char *  name 
)

Similar to _alloc_static_coarray() except that the coarray is allocated not by the runtime but by the Fortran system.

out: return : pointer to descriptor CoarrayInfo_t in: var : pointer to the coarray count : count of elements element : element size name : name of the coarray (for debugging) namelen : character length of name (for debugging)

259 {
260  CoarrayInfo_t *cinfo;
261 
262  _XMPCO_debugPrint("_XMPCO_REGMEM_STATIC_COARRAY varname=\'%.*s\'\n"
263  " count=%d, element=%ud\n",
264  namelen, name, count, element);
265 
266  // boundary check
267  if ((size_t)var % MALLOC_UNIT != 0) { // check base address
268  /* restriction */
269  _XMPCO_fatal("boundary violation detected for coarray \'%.*s\'\n"
270  " var=%p\n",
271  namelen, name, var);
272  }
273 
274  size_t nbytes = count * element;
275  //size_t nbytesRU = ROUND_UP_MALLOC(nbytes);
276 
277  _XMPCO_debugPrint("COARRAY_REGMEM_STATIC_ varname=\'%.*s\'\n",
278  namelen, name);
279 
280  cinfo = _regmemStaticCoarray(var, nbytes);
281  //cinfo = _regmemStaticCoarray(var, nbytesRU);
282  cinfo->name = _xmp_strndup(name, namelen);
283 
284  return cinfo;
285 }
Here is the call graph for this function:

Variable Documentation

◆ _mallocStack

struct { ... } _mallocStack

◆ head

◆ tail

ROUND_UP_MALLOC
#define ROUND_UP_MALLOC(n)
Definition: xmpco_internal.h:21
_memoryChunk_t::nbytes
size_t nbytes
Definition: _xmpco_alloc.h:82
_memoryChunkOrder_t::chunk
MemoryChunk_t * chunk
Definition: _xmpco_alloc.h:114
_coarrayInfo_t::corank
int corank
Definition: _xmpco_alloc.h:99
_memoryChunk_t::headCoarray
CoarrayInfo_t * headCoarray
Definition: _xmpco_alloc.h:84
_coarrayInfo_t::baseAddr
char * baseAddr
Definition: _xmpco_alloc.h:97
_XMPCO_debugPrint
void _XMPCO_debugPrint(char *format,...)
Definition: xmpco_msg.c:20
_coarrayInfo_t::size
size_t size
Definition: _xmpco_alloc.h:98
_memoryChunk_t::isGarbage
BOOL isGarbage
Definition: _xmpco_alloc.h:80
_memoryChunk_t::desc
void * desc
Definition: _xmpco_alloc.h:83
forallMemoryChunkOrder
#define forallMemoryChunkOrder(cp)
Definition: _xmpco_alloc.h:16
_coarrayInfo_t::name
char * name
Definition: _xmpco_alloc.h:96
MALLOC_UNIT
#define MALLOC_UNIT
Definition: xmpco_params.h:38
_XMPCO_get_initialNumImages
int _XMPCO_get_initialNumImages(void)
Definition: xmpco_lib.c:133
XMPCO_sync_all_auto
void XMPCO_sync_all_auto(void)
Definition: xmpco_sync.c:34
_coarrayInfo_t::cosize
int * cosize
Definition: _xmpco_alloc.h:102
BOOL
#define BOOL
Definition: xmpco_internal.h:14
DIV_CEILING
#define DIV_CEILING(m, n)
Definition: _xmpco_alloc.h:14
_coarrayInfo_t::nodes
_XMP_nodes_t * nodes
Definition: _xmpco_alloc.h:103
_memoryChunk_t::orgAddr
char * orgAddr
Definition: _xmpco_alloc.h:81
IsEmptyMemoryChunk
#define IsEmptyMemoryChunk(chk)
Definition: _xmpco_alloc.h:51
_XMPCO_fatal
void _XMPCO_fatal(char *format,...)
Definition: xmpco_msg.c:4
_memoryChunk_t
structure for each malloc/free call Every memory chunk is linked both:
Definition: _xmpco_alloc.h:76
_XMP_nodes_type::comm
_XMP_comm_t * comm
Definition: xmp_data_struct.h:53
_XMPCO_get_currentNumImages
int _XMPCO_get_currentNumImages(void)
Definition: xmpco_lib.c:143
_memoryChunkOrder_t
MEMORY MANAGEMENT STRUCTURE-II (for dynamic ALLOCATE/DEALLOCATE stmts.
Definition: _xmpco_alloc.h:111
_XMPCO_get_orgAddrOfMemoryChunk
char * _XMPCO_get_orgAddrOfMemoryChunk(CoarrayInfo_t *cinfo)
Definition: xmpco_alloc.c:730
_XMPCO_get_localBufSize
size_t _XMPCO_get_localBufSize(void)
Definition: xmpco_params.c:84
_XMPCO_nowInTask
int _XMPCO_nowInTask()
Definition: xmpco_alloc.c:1420
_XMP_nodes_type
Definition: xmp_data_struct.h:40
_coarrayInfo_t::next
CoarrayInfo_t * next
Definition: _xmpco_alloc.h:94
_coarrayInfo_t
structure for each coarray variable One or more coarrays can be linked from a single memory chunk and...
Definition: _xmpco_alloc.h:92
_coarrayInfo_t::parent
MemoryChunk_t * parent
Definition: _xmpco_alloc.h:95
_XMPCO_get_sizeOfMemoryChunk
size_t _XMPCO_get_sizeOfMemoryChunk(CoarrayInfo_t *cinfo)
Definition: xmpco_alloc.c:735
_coarrayInfo_t::lcobound
int * lcobound
Definition: _xmpco_alloc.h:100
_coarrayInfo_t::ucobound
int * ucobound
Definition: _xmpco_alloc.h:101
_XMPCO_get_poolThreshold
unsigned _XMPCO_get_poolThreshold(void)
Definition: xmpco_params.c:83