1 /* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #define SMPI_NO_OVERRIDE_MALLOC
11 #include <smpi/smpi.h>
13 #define AMPI_CALL(type, name, args) \
14 type _XBT_CONCAT(A, name) args __attribute__((weak)); \
15 type _XBT_CONCAT(AP, name) args;
21 // Internally disable these overrides (HAVE_SMPI is only defined when building the library)
22 #define malloc(nbytes) _sampi_malloc(nbytes)
23 #define calloc(n_elm, elm_size) _sampi_calloc((n_elm), (elm_size))
24 #define realloc(ptr, nbytes) _sampi_realloc((ptr), (nbytes))
25 #define free(ptr) _sampi_free(ptr)
30 XBT_PUBLIC void* _sampi_malloc(size_t size);
31 XBT_PUBLIC void* _sampi_calloc(size_t n_elm, size_t elm_size);
32 XBT_PUBLIC void* _sampi_realloc(void *ptr, size_t size);
33 XBT_PUBLIC void _sampi_free(void* ptr);
35 AMPI_CALL(XBT_PUBLIC int, MPI_Iteration_in, (MPI_Comm comm))
36 AMPI_CALL(XBT_PUBLIC int, MPI_Iteration_out, (MPI_Comm comm))
37 AMPI_CALL(XBT_PUBLIC void, MPI_Migrate, (MPI_Comm comm))