Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
[simgrid.git] / include / smpi / sampi.h
1 /* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 #ifndef SAMPI_H_
7 #define SAMPI_H_
8
9 #include <stdlib.h>
10 #include <smpi/smpi.h>
11
12 #define AMPI_CALL(type, name, args)                                                                                    \
13   type A##name args __attribute__((weak));                                                                             \
14   type AP##name args;
15
16 #ifndef HAVE_SMPI
17 // Internally disable these overrides (HAVE_SMPI is only defined when building the library)
18 #define malloc(nbytes) _sampi_malloc(nbytes)
19 #define calloc(n_elm,elm_size) _sampi_calloc(n_elm,elm_size)
20 #define realloc(ptr,nbytes) _sampi_realloc(ptr,nbytes)
21 #define free(ptr) _sampi_free(ptr)
22 #endif
23
24 SG_BEGIN_DECL()
25
26 XBT_PUBLIC void* _sampi_malloc(size_t size);
27 XBT_PUBLIC void* _sampi_calloc(size_t n_elm, size_t elm_size);
28 XBT_PUBLIC void* _sampi_realloc(void *ptr, size_t size);
29 XBT_PUBLIC void _sampi_free(void* ptr);
30
31 AMPI_CALL(XBT_PUBLIC int, MPI_Iteration_in, (MPI_Comm comm))
32 AMPI_CALL(XBT_PUBLIC int, MPI_Iteration_out, (MPI_Comm comm))
33 AMPI_CALL(XBT_PUBLIC void, MPI_Migrate, (MPI_Comm comm))
34
35 SG_END_DECL()
36
37 #endif