This source file includes following definitions.
- MPI_Alloc_mem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #include "ompi_config.h"
26
27 #include <stdio.h>
28 #include <stdlib.h>
29
30 #include "ompi/mpi/c/bindings.h"
31 #include "ompi/runtime/params.h"
32 #include "ompi/communicator/communicator.h"
33 #include "ompi/errhandler/errhandler.h"
34 #include "ompi/info/info.h"
35 #include "opal/mca/mpool/mpool.h"
36
37 #if OMPI_BUILD_MPI_PROFILING
38 #if OPAL_HAVE_WEAK_SYMBOLS
39 #pragma weak MPI_Alloc_mem = PMPI_Alloc_mem
40 #endif
41 #define MPI_Alloc_mem PMPI_Alloc_mem
42 #endif
43
44 static const char FUNC_NAME[] = "MPI_Alloc_mem";
45
46
47 int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr)
48 {
49 char info_value[MPI_MAX_INFO_VAL + 1];
50 char *mpool_hints = NULL;
51
52 if (MPI_PARAM_CHECK) {
53 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
54 if (size < 0 || NULL == baseptr) {
55 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
56 FUNC_NAME);
57 } else if (NULL == info || ompi_info_is_freed(info)) {
58 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INFO,
59 FUNC_NAME);
60 }
61 }
62
63
64
65
66
67
68
69
70 if (0 == size) {
71 *((void **) baseptr) = NULL;
72 return MPI_SUCCESS;
73 }
74
75 OPAL_CR_ENTER_LIBRARY();
76
77 if (MPI_INFO_NULL != info) {
78 int flag;
79 (void) ompi_info_get (info, "mpool_hints", MPI_MAX_INFO_VAL, info_value, &flag);
80 if (flag) {
81 mpool_hints = info_value;
82 }
83 }
84
85 *((void **) baseptr) = mca_mpool_base_alloc ((size_t) size, (struct opal_info_t*)info,
86 mpool_hints);
87 OPAL_CR_EXIT_LIBRARY();
88 if (NULL == *((void **) baseptr)) {
89 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM,
90 FUNC_NAME);
91 }
92
93
94 return MPI_SUCCESS;
95 }
96