This source file includes following definitions.
- MPI_T_cvar_handle_alloc
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include "ompi/mpi/tool/mpit-internal.h"
15
16 #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
17 #pragma weak MPI_T_cvar_handle_alloc = PMPI_T_cvar_handle_alloc
18 #endif
19
20 #if OMPI_PROFILING_DEFINES
21 #include "ompi/mpi/tool/profile/defines.h"
22 #endif
23
24
25 int MPI_T_cvar_handle_alloc (int cvar_index, void *obj_handle,
26 MPI_T_cvar_handle *handle, int *count)
27 {
28 ompi_mpit_cvar_handle_t *new_handle;
29 int rc = MPI_SUCCESS;;
30
31 if (!mpit_is_initialized ()) {
32 return MPI_T_ERR_NOT_INITIALIZED;
33 }
34
35 if (MPI_PARAM_CHECK && (NULL == handle || NULL == count)) {
36 return MPI_ERR_ARG;
37 }
38
39 ompi_mpit_lock ();
40
41 *handle = NULL;
42
43 do {
44 new_handle = (ompi_mpit_cvar_handle_t *) malloc (sizeof (ompi_mpit_cvar_handle_t));
45 if (NULL == new_handle) {
46 rc = MPI_T_ERR_MEMORY;
47 break;
48 }
49
50 rc = mca_base_var_get(cvar_index, &new_handle->var);
51 if (OPAL_SUCCESS != rc) {
52 rc = (OPAL_ERR_VALUE_OUT_OF_BOUNDS == rc || OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX:
53 MPI_ERR_OTHER;
54 free (new_handle);
55 break;
56 }
57
58 new_handle->bound_object = obj_handle;
59
60 if (MCA_BASE_VAR_TYPE_STRING == new_handle->var->mbv_type) {
61
62 *count = 2048;
63 } else {
64
65
66 *count = 1;
67 }
68
69 *handle = (MPI_T_cvar_handle) new_handle;
70 } while (0);
71
72 ompi_mpit_unlock ();
73
74 return rc;
75 }