GADGET-4
mymalloc.cc
Go to the documentation of this file.
1 /*******************************************************************************
2  * \copyright This file is part of the GADGET4 N-body/SPH code developed
3  * \copyright by Volker Springel. Copyright (C) 2014-2020 by Volker Springel
4  * \copyright (vspringel@mpa-garching.mpg.de) and all contributing authors.
5  *******************************************************************************/
6 #include "gadgetconfig.h"
7 
8 #include <math.h>
9 #include <mpi.h>
10 #include <stddef.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 
15 #include "../data/allvars.h"
16 #include "../data/dtypes.h"
17 #include "../data/mymalloc.h"
18 #include "../logs/logs.h"
19 #include "../main/simulation.h"
20 #include "../mpi_utils/mpi_utils.h"
21 #include "../mpi_utils/shared_mem_handler.h"
22 #include "../system/system.h"
23 
54 void memory::mymalloc_init(int maxmemsize, enum restart_options restartflag)
55 {
56  BlockSize = (size_t *)malloc(MAXBLOCKS * sizeof(size_t));
57  Table = (char **)malloc(MAXBLOCKS * sizeof(void *));
58  MovableFlag = (char *)malloc(MAXBLOCKS * sizeof(char));
59  GenericFlag = (char *)malloc(MAXBLOCKS * sizeof(char));
60  BasePointers = (char ***)malloc(MAXBLOCKS * sizeof(void **));
61  VarName = (char *)malloc(MAXBLOCKS * MAXCHARS * sizeof(char));
62  FunctionName = (char *)malloc(MAXBLOCKS * MAXCHARS * sizeof(char));
63  ParentFileName = (char *)malloc(MAXBLOCKS * MAXCHARS * sizeof(char));
64  FileName = (char *)malloc(MAXBLOCKS * MAXCHARS * sizeof(char));
65  LineNumber = (int *)malloc(MAXBLOCKS * sizeof(int));
66  HighMarkTabBuf = (char *)malloc((100 + 4 * MAXCHARS) * (MAXBLOCKS + 10));
67  HighMarkTabBufWithoutGeneric = (char *)malloc((100 + 4 * MAXCHARS) * (MAXBLOCKS + 10));
68 
69  memset(VarName, 0, MAXBLOCKS * MAXCHARS);
70  memset(FunctionName, 0, MAXBLOCKS * MAXCHARS);
71  memset(ParentFileName, 0, MAXBLOCKS * MAXCHARS);
72  memset(FileName, 0, MAXBLOCKS * MAXCHARS);
73 
74  size_t n = maxmemsize * ((size_t)1024 * 1024);
76 
77  // add an extra cache line size to make sure we can guarantee that base returned from MPI_Win_allocate_shared is aligned
78  n += CACHELINESIZE;
79 
80  RestartFlag = restartflag;
81 
82  MPI_Barrier(MPI_COMM_WORLD); // wait until both regular and ghost processors are here
83 
84  double t0 = Logs.second();
85 
86  MPI_Info win_info;
87  MPI_Info_create(&win_info);
88  MPI_Info_set(win_info, "alloc_shared_noncontig", "true");
89 
90  if(MPI_Win_allocate_shared(n, 1, win_info, Shmem.SharedMemComm, &Base, &Shmem.SharedMemWin) != MPI_SUCCESS)
91  Terminate("Failed to allocate memory for `Base' (%d Mbytes).\n", All.MaxMemSize);
92 
93  /* we now make sure that the allocated local buffer is really aligned, not all MPI libraries guarantee this */
94 
95  int off = 0;
96  if((long long)Base / CACHELINESIZE > 0)
97  off = ((long long)Base / CACHELINESIZE + 1) * CACHELINESIZE - (long long)Base;
98 
99  /* allign our base */
100  Base += off;
101 
102  MPI_Info_free(&win_info);
103 
104  double t1 = Logs.second();
105  if(Shmem.World_ThisTask == 0)
106  mpi_printf("MALLOC: Allocation of shared memory took %g sec\n", Logs.timediff(t0, t1));
107 
108  TotBytes = FreeBytes = n - CACHELINESIZE;
109 
110  AllocatedBytes = 0;
111  Nblocks = 0;
112  HighMarkBytes = 0;
113  HighMarkBytesWithoutGeneric = 0;
114  OldGlobHighMarkMB = 0;
115  OldGlobHighMarkMBWithoutGeneric = 0;
116 
117  char mode[2], buf[MAXLEN_PATH_EXTRA];
118 
119  if(All.RestartFlag == RST_BEGIN)
120  strcpy(mode, "w");
121  else
122  strcpy(mode, "a");
123 
124  MPI_Bcast(All.OutputDir, sizeof(All.OutputDir), MPI_BYTE, 0, MPI_COMM_WORLD);
125 
126  if(Shmem.GhostRank == 0)
127  sprintf(buf, "%s%s", All.OutputDir, "memory.txt");
128  else
129  sprintf(buf, "%s%s", All.OutputDir, "memory_ghostranks.txt");
130 
131  if(!(FdMemory = fopen(buf, mode)))
132  Terminate("error in opening file '%s'\n", buf);
133 
134  /* tell also the ghost ranks about the total size of the simulation partition */
135  MPI_Bcast(&Shmem.Sim_NTask, 1, MPI_INT, 0, MPI_COMM_WORLD);
136 
137  Shmem.GetGhostRankForSimulCommRank = (int *)mymalloc("GetGhostRankForSimulCommRank", Shmem.Sim_NTask * sizeof(int));
138  Shmem.GetShmRankForSimulCommRank = (int *)mymalloc("GetShmRankForSimulCommRank", Shmem.Sim_NTask * sizeof(int));
139  Shmem.GetNodeIDForSimulCommRank = (int *)mymalloc("GetNodeIDForSimulCommRank", Shmem.Sim_NTask * sizeof(int));
140 
141  if(Shmem.GhostRank == 0)
142  {
143  MPI_Allgather(&Shmem.MyShmRankInGlobal, 1, MPI_INT, Shmem.GetGhostRankForSimulCommRank, 1, MPI_INT, Shmem.SimulationComm);
144  MPI_Allgather(&Shmem.Island_ThisTask, 1, MPI_INT, Shmem.GetShmRankForSimulCommRank, 1, MPI_INT, Shmem.SimulationComm);
145  MPI_Allgather(&Shmem.Island_Smallest_WorldTask, 1, MPI_INT, Shmem.GetNodeIDForSimulCommRank, 1, MPI_INT, Shmem.SimulationComm);
146  }
147 
148  // to make sure that also the ghost processors have this table
149  MPI_Bcast(Shmem.GetGhostRankForSimulCommRank, Shmem.Sim_NTask, MPI_INT, 0, MPI_COMM_WORLD);
150  MPI_Bcast(Shmem.GetShmRankForSimulCommRank, Shmem.Sim_NTask, MPI_INT, 0, MPI_COMM_WORLD);
151 
152  /* we also need the base offsets of the other MPI ranks in the same shared memory island */
153  Shmem.SharedMemBaseAddr = (void **)mymalloc("SharedMemBaseAddr", Shmem.Island_NTask * sizeof(void *));
154 
155  for(int i = 0; i < Shmem.Island_NTask; i++)
156  {
157  MPI_Aint size;
158  int disp_unit;
159  MPI_Win_shared_query(Shmem.SharedMemWin, i, &size, &disp_unit, &Shmem.SharedMemBaseAddr[i]);
160  }
161 
162  // now propagte the alignment correction also to the base addresses that all the other processes see
163  int *off_list = (int *)Mem.mymalloc("off_list", Shmem.Island_NTask * sizeof(int));
164 
165  MPI_Allgather(&off, 1, MPI_INT, off_list, 1, MPI_INT, Shmem.SharedMemComm);
166 
167  for(int i = 0; i < Shmem.Island_NTask; i++)
168  Shmem.SharedMemBaseAddr[i] = (char *)Shmem.SharedMemBaseAddr[i] + off_list[i];
169 
170  Mem.myfree(off_list);
171 }
172 
173 void memory::report_memory_usage(int rank, char *tabbuf)
174 {
175  int thistask;
176  MPI_Comm_rank(Communicator, &thistask);
177 
178  if(thistask == rank)
179  {
180  char *buf = (char *)mymalloc("buf", (100 + 4 * MAXCHARS) * (Nblocks + 10));
181  int cc = 0;
182  cc += sprintf(buf + cc, "\nMEMORY: Largest Allocation = %g Mbyte | Largest Allocation Without Generic = %g Mbyte\n\n",
183  OldGlobHighMarkMB, OldGlobHighMarkMBWithoutGeneric);
184 
185  cc += sprintf(buf + cc, "%s", tabbuf);
186  if(thistask == 0)
187  {
188  if(RestartFlag == RST_BEGIN || RestartFlag == RST_RESUME || RestartFlag == RST_STARTFROMSNAP)
189  {
190  fprintf(FdMemory, "%s", buf);
191  fflush(FdMemory);
192  }
193  }
194  else
195  {
196  MPI_Send(&cc, 1, MPI_INT, 0, TAG_N, Communicator);
197  MPI_Send(buf, cc + 1, MPI_BYTE, 0, TAG_PDATA, Communicator);
198  }
199  myfree(buf);
200  }
201 
202  if(thistask == 0 && rank > 0)
203  {
204  int cc;
205  MPI_Recv(&cc, 1, MPI_INT, rank, TAG_N, Communicator, MPI_STATUS_IGNORE);
206  char *buf = (char *)mymalloc("buf", cc + 1);
207  MPI_Recv(buf, cc + 1, MPI_BYTE, rank, TAG_PDATA, Communicator, MPI_STATUS_IGNORE);
208  if(RestartFlag == RST_BEGIN || RestartFlag == RST_RESUME || RestartFlag == RST_STARTFROMSNAP)
209  {
210  fprintf(FdMemory, "%s", buf);
211  fflush(FdMemory);
212  }
213  myfree(buf);
214  }
215 }
216 
221 {
222  int flag = 0;
223  int thistask;
224  MPI_Comm_rank(Communicator, &thistask);
225 
226  struct
227  {
228  double mem;
229  int rank;
230  } local, global;
231 
232  local.mem = HighMarkBytes * TO_MBYTE_FAC;
233  local.rank = thistask;
234 
235  MPI_Allreduce(&local, &global, 1, MPI_DOUBLE_INT, MPI_MAXLOC, Communicator);
236 
237  if(global.mem >= 1.05 * OldGlobHighMarkMB)
238  {
239  OldGlobHighMarkMB = global.mem;
240  flag |= 1;
241  }
242 
243  local.mem = HighMarkBytesWithoutGeneric * TO_MBYTE_FAC;
244  local.rank = thistask;
245 
246  MPI_Allreduce(&local, &global, 1, MPI_DOUBLE_INT, MPI_MAXLOC, Communicator);
247 
248  if(global.mem >= 1.05 * OldGlobHighMarkMBWithoutGeneric)
249  {
250  OldGlobHighMarkMBWithoutGeneric = global.mem;
251  flag |= 2;
252  }
253 
254  if(flag & 2)
255  report_memory_usage(global.rank, HighMarkTabBufWithoutGeneric);
256 
257  if(flag & 1)
258  report_memory_usage(global.rank, HighMarkTabBuf);
259 }
260 
265 {
266  char *buf = (char *)malloc(200 * (Nblocks + 10));
267  dump_memory_table_buffer(buf);
268  printf("%s", buf);
269  free(buf);
270 }
271 
277 int memory::dump_memory_table_buffer(char *p)
278 {
279  int cc = 0;
280  size_t totBlocksize = 0;
281  int thistask;
282  MPI_Comm_rank(Communicator, &thistask);
283 
284  cc +=
285  sprintf(p + cc, "-------------------------- Allocated Memory Blocks---- ( Step %8d )------------------\n", All.NumCurrentTiStep);
286  cc += sprintf(p + cc, "Task Nr F Variable MBytes Cumulative Function|File|Linenumber\n");
287  cc += sprintf(p + cc, "------------------------------------------------------------------------------------------\n");
288  for(int i = 0; i < Nblocks; i++)
289  {
290  totBlocksize += BlockSize[i];
291 
292  cc += sprintf(p + cc, "%4d %5d %d %40s %10.4f %10.4f %s%s()|%s|%d\n", thistask, i, MovableFlag[i], VarName + i * MAXCHARS,
293  BlockSize[i] * TO_MBYTE_FAC, totBlocksize * TO_MBYTE_FAC, ParentFileName + i * MAXCHARS,
294  FunctionName + i * MAXCHARS, FileName + i * MAXCHARS, LineNumber[i]);
295  }
296  cc += sprintf(p + cc, "------------------------------------------------------------------------------------------\n");
297 
298  return cc;
299 }
300 
311 void *memory::mymalloc_movable_fullinfo(void *ptr, const char *varname, size_t n, const char *func, const char *file, int line,
312  int movable_flag, int clear_flag, char *callorigin)
313 {
314  if((n % CACHELINESIZE) > 0)
315  n = (n / CACHELINESIZE + 1) * CACHELINESIZE;
316 
317  if(n < CACHELINESIZE)
318  n = CACHELINESIZE;
319 
320  if(Nblocks >= MAXBLOCKS)
321  Terminate("No blocks left in mymalloc_fullinfo() at %s()/%s/line %d. MAXBLOCKS=%d\n", func, file, line, MAXBLOCKS);
322 
323  if(n > FreeBytes)
324  {
326  Terminate(
327  "\nNot enough memory in mymalloc_fullinfo() to allocate %g MB for variable '%s' at %s()/%s/line %d (FreeBytes=%g MB).\n",
328  n * TO_MBYTE_FAC, varname, func, file, line, FreeBytes * TO_MBYTE_FAC);
329  }
330  Table[Nblocks] = Base + (TotBytes - FreeBytes);
331  FreeBytes -= n;
332 
333  strncpy(VarName + Nblocks * MAXCHARS, varname, MAXCHARS - 1);
334  if(callorigin)
335  {
336  strncpy(ParentFileName + Nblocks * MAXCHARS, callorigin, MAXCHARS - 1);
337  GenericFlag[Nblocks] = 1;
338  AllocatedBytesGeneric += n;
339  }
340  else
341  {
342  memset(ParentFileName + Nblocks * MAXCHARS, 0, MAXCHARS);
343  GenericFlag[Nblocks] = 0;
344  }
345  strncpy(FunctionName + Nblocks * MAXCHARS, func, MAXCHARS - 1);
346  strncpy(FileName + Nblocks * MAXCHARS, file, MAXCHARS - 1);
347  LineNumber[Nblocks] = line;
348 
349  AllocatedBytes += n;
350  BlockSize[Nblocks] = n;
351  MovableFlag[Nblocks] = movable_flag;
352  BasePointers[Nblocks] = (char **)ptr;
353 
354  Nblocks += 1;
355 
356  if(AllocatedBytes - AllocatedBytesGeneric > HighMarkBytesWithoutGeneric)
357  {
358  HighMarkBytesWithoutGeneric = AllocatedBytes - AllocatedBytesGeneric;
359  dump_memory_table_buffer(HighMarkTabBufWithoutGeneric);
360  }
361 
362  if(AllocatedBytes > HighMarkBytes)
363  {
364  HighMarkBytes = AllocatedBytes;
365  dump_memory_table_buffer(HighMarkTabBuf);
366  }
367 
368  if(clear_flag)
369  memset(Table[Nblocks - 1], 0, n);
370 
371  return Table[Nblocks - 1];
372 }
373 
375 {
376  if((n % CACHELINESIZE) > 0)
377  n = (n / CACHELINESIZE + 1) * CACHELINESIZE;
378 
379  return n;
380 }
381 
383 {
384  if(Nblocks == 0)
385  Terminate("no allocated blocks that could be returned");
386 
387  return Table[Nblocks - 1];
388 }
389 
399 void memory::myfree_movable_fullinfo(void *p, const char *func, const char *file, int line, int movable_flag)
400 {
401  if(Nblocks == 0)
402  Terminate("no allocated blocks that could be freed");
403 
404  /* first, let's find the block */
405  int nr;
406 
407  if(movable_flag)
408  {
409  for(nr = Nblocks - 1; nr >= 0; nr--)
410  if(p == Table[nr])
411  break;
412 
413  if(nr < 0)
414  {
416  Terminate("Wrong call of myfree_movable() from %s()/%s/line %d - this block has not been allocated!\n", func, file, line);
417  }
418 
419  if(nr < Nblocks - 1) /* the block is not the last allocated block */
420  {
421  /* check that all subsequent blocks are actually movable */
422  for(int i = nr + 1; i < Nblocks; i++)
423  if(MovableFlag[i] == 0)
424  {
426  myflush(stdout);
427  Terminate(
428  "Wrong call of myfree_movable() from %s()/%s/line %d - behind block=%d there are subsequent non-movable allocated "
429  "blocks\n",
430  func, file, line, nr);
431  }
432  }
433  }
434  else
435  {
436  nr = Nblocks - 1;
437  if(p != Table[nr])
438  {
440  Terminate("Wrong call of myfree() at %s()/%s/line %d: not the last allocated block!\n", func, file, line);
441  }
442  }
443 
444  if(GenericFlag[nr])
445  AllocatedBytesGeneric -= BlockSize[nr];
446 
447  AllocatedBytes -= BlockSize[nr];
448  FreeBytes += BlockSize[nr];
449 
450  if(BasePointers[nr])
451  *BasePointers[nr] = NULL;
452 
453  if(movable_flag)
454  {
455  ptrdiff_t offset = -BlockSize[nr];
456  size_t length = 0;
457 
458  for(int i = nr + 1; i < Nblocks; i++)
459  length += BlockSize[i];
460 
461  if(nr < Nblocks - 1)
462  memmove(Table[nr + 1] + offset, Table[nr + 1], length);
463 
464  for(int i = nr + 1; i < Nblocks; i++)
465  {
466  Table[i] += offset;
467  *BasePointers[i] = *BasePointers[i] + offset;
468  }
469 
470  for(int i = nr + 1; i < Nblocks; i++)
471  {
472  Table[i - 1] = Table[i];
473  BasePointers[i - 1] = BasePointers[i];
474  BlockSize[i - 1] = BlockSize[i];
475  MovableFlag[i - 1] = MovableFlag[i];
476  GenericFlag[i - 1] = GenericFlag[i];
477 
478  memmove(VarName + (i - 1) * MAXCHARS, VarName + i * MAXCHARS, MAXCHARS);
479  memmove(FunctionName + (i - 1) * MAXCHARS, FunctionName + i * MAXCHARS, MAXCHARS);
480  memmove(ParentFileName + (i - 1) * MAXCHARS, ParentFileName + i * MAXCHARS, MAXCHARS);
481  memmove(FileName + (i - 1) * MAXCHARS, FileName + i * MAXCHARS, MAXCHARS);
482  LineNumber[i - 1] = LineNumber[i];
483  }
484  }
485 
486  Nblocks -= 1;
487 }
488 
500 void *memory::myrealloc_movable_fullinfo(void *p, size_t n, const char *func, const char *file, int line, int movable_flag)
501 {
502  if((n % CACHELINESIZE) > 0)
503  n = (n / CACHELINESIZE + 1) * CACHELINESIZE;
504 
505  if(n < CACHELINESIZE)
506  n = CACHELINESIZE;
507 
508  if(Nblocks == 0)
509  Terminate("no allocated blocks that could be reallocated");
510 
511  /* first, let's find the block */
512  int nr;
513 
514  if(movable_flag)
515  {
516  for(nr = Nblocks - 1; nr >= 0; nr--)
517  if(p == Table[nr])
518  break;
519 
520  if(nr < 0)
521  {
523  Terminate("Wrong call of myrealloc_movable() from %s()/%s/line %d - this block has not been allocated!\n", func, file, line);
524  }
525 
526  if(nr < Nblocks - 1) /* the block is not the last allocated block */
527  {
528  /* check that all subsequent blocks are actually movable */
529  for(int i = nr + 1; i < Nblocks; i++)
530  if(MovableFlag[i] == 0)
531  {
533  Terminate(
534  "Wrong call of myrealloc_movable() from %s()/%s/line %d - behind block=%d there are subsequent non-movable "
535  "allocated blocks\n",
536  func, file, line, nr);
537  }
538  }
539  }
540  else
541  {
542  nr = Nblocks - 1;
543 
544  if(p != Table[nr])
545  {
547  Terminate("Wrong call of myrealloc() at %s()/%s/line %d - not the last allocated block!\n", func, file, line);
548  }
549  }
550 
551  if(GenericFlag[nr])
552  Terminate("unexpected");
553 
554  AllocatedBytes -= BlockSize[nr];
555  FreeBytes += BlockSize[nr];
556 
557  if(n > FreeBytes)
558  {
560  Terminate("At %s()/%s/line %d: Not enough memory in myremalloc_movable(n=%g MB). previous=%g FreeBytes=%g MB\n", func, file,
561  line, n * TO_MBYTE_FAC, BlockSize[nr] * TO_MBYTE_FAC, FreeBytes * TO_MBYTE_FAC);
562  }
563 
564  ptrdiff_t offset = n - BlockSize[nr];
565  size_t length = 0;
566 
567  for(int i = nr + 1; i < Nblocks; i++)
568  length += BlockSize[i];
569 
570  if(nr < Nblocks - 1)
571  memmove(Table[nr + 1] + offset, Table[nr + 1], length);
572 
573  for(int i = nr + 1; i < Nblocks; i++)
574  {
575  Table[i] += offset;
576 
577  *BasePointers[i] = *BasePointers[i] + offset;
578  }
579 
580  FreeBytes -= n;
581  AllocatedBytes += n;
582  BlockSize[nr] = n;
583 
584  if(AllocatedBytes > HighMarkBytes)
585  {
586  HighMarkBytes = AllocatedBytes;
587  dump_memory_table_buffer(HighMarkTabBuf);
588  }
589 
590  return Table[nr];
591 }
592 
594 {
595  int errflag = 0, errflag_tot;
596 
597  if(maxmemsize > (MemoryOnNode / 1024.0 / TasksInThisNode) && RankInThisNode == 0)
598  {
599  char name[MPI_MAX_PROCESSOR_NAME];
600  int len;
601  MPI_Get_processor_name(name, &len);
602 
603  printf("On node '%s', we have %d MPI ranks and at most %g MB available. This is not enough space for MaxMemSize = %g MB\n", name,
604  TasksInThisNode, MemoryOnNode / 1024.0, (double)maxmemsize);
605  errflag = 1;
606  fflush(stdout);
607  }
608 
609  if(maxmemsize > (SharedMemoryOnNode / 1024.0 / TasksInThisNode) && RankInThisNode == 0)
610  {
611  char name[MPI_MAX_PROCESSOR_NAME];
612  int len;
613  MPI_Get_processor_name(name, &len);
614 
615  printf(
616  "On node '%s', we have %d MPI ranks and at most %g MB of *shared* memory available. This is not enough space for MaxMemSize "
617  "= %g MB\n",
618  name, TasksInThisNode, SharedMemoryOnNode / 1024.0, (double)maxmemsize);
619  errflag = 1;
620  fflush(stdout);
621  }
622 
623  MPI_Allreduce(&errflag, &errflag_tot, 1, MPI_INT, MPI_MAX, Communicator);
624 
625  if(errflag_tot)
626  Terminate("At least one node has insufficient memory");
627 }
global_data_all_processes All
Definition: main.cc:40
double timediff(double t0, double t1)
Definition: logs.cc:488
double second(void)
Definition: logs.cc:471
void * myrealloc_movable_fullinfo(void *p, size_t n, const char *func, const char *file, int line, int movable_flag)
Reallocate an existing movable memory block.
Definition: mymalloc.cc:500
size_t FreeBytes
Definition: mymalloc.h:48
void * mymalloc_movable_fullinfo(void *ptr, const char *varname, size_t n, const char *func, const char *file, int line, int movable_flag, int clear_flag, char *originflag)
Allocate a movable memory block and store the relative information.
Definition: mymalloc.cc:311
void myfree_movable_fullinfo(void *p, const char *func, const char *file, int line, int movable_flag)
Deallocate a movable memory block.
Definition: mymalloc.cc:399
char * Base
Definition: mymalloc.h:49
void * myfree_query_last_block(void)
Definition: mymalloc.cc:382
void dump_memory_table(void)
Dump the buffer where the memory information is stored to the standard output.
Definition: mymalloc.cc:264
void report_detailed_memory_usage_of_largest_task(void)
Output memory usage for the task with the greatest amount of memory allocated.
Definition: mymalloc.cc:220
void check_maxmemsize_setting(int maxmemsize)
Definition: mymalloc.cc:593
size_t AllocatedBytes
Definition: mymalloc.h:47
void mymalloc_init(int maxmemsize, enum restart_options restartflag)
Initialize memory manager.
Definition: mymalloc.cc:54
size_t roundup_to_multiple_of_cacheline_size(size_t n)
Definition: mymalloc.cc:374
long long MemoryOnNode
Definition: setcomm.h:42
void mpi_printf(const char *fmt,...)
Definition: setcomm.h:55
int RankInThisNode
Definition: setcomm.h:39
MPI_Comm Communicator
Definition: setcomm.h:31
int TasksInThisNode
Definition: setcomm.h:38
long long SharedMemoryOnNode
Definition: setcomm.h:43
MPI_Comm SharedMemComm
int * GetNodeIDForSimulCommRank
int Island_ThisTask
int Island_NTask
void ** SharedMemBaseAddr
int * GetShmRankForSimulCommRank
MPI_Comm SimulationComm
int Island_Smallest_WorldTask
int * GetGhostRankForSimulCommRank
int MyShmRankInGlobal
MPI_Win SharedMemWin
int World_ThisTask
#define MAXLEN_PATH_EXTRA
Definition: constants.h:301
#define TO_MBYTE_FAC
Definition: constants.h:59
restart_options
Definition: dtypes.h:312
@ RST_STARTFROMSNAP
Definition: dtypes.h:315
@ RST_BEGIN
Definition: dtypes.h:313
@ RST_RESUME
Definition: dtypes.h:314
logs Logs
Definition: main.cc:43
#define Terminate(...)
Definition: macros.h:19
shmem Shmem
Definition: main.cc:45
#define TAG_PDATA
Definition: mpi_utils.h:27
#define TAG_N
Definition: mpi_utils.h:25
#define MAXBLOCKS
Definition: mymalloc.h:19
#define mymalloc(x, y)
Definition: mymalloc.h:26
memory Mem
Definition: main.cc:44
#define myfree(x)
Definition: mymalloc.h:34
#define CACHELINESIZE
Definition: mymalloc.h:17
#define MAXCHARS
Definition: mymalloc.h:20
enum restart_options RestartFlag
Definition: allvars.h:68
char OutputDir[MAXLEN_PATH]
Definition: allvars.h:272
void myflush(FILE *fstream)
Definition: system.cc:125