This source file includes following definitions.
- MPI_Info_get
1
2
3
4
5
6
7
8 #include "mpioimpl.h"
9
10 #ifdef HAVE_WEAK_SYMBOLS
11
12 #if defined(HAVE_PRAGMA_WEAK)
13 #pragma weak MPI_Info_get = PMPI_Info_get
14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
15 #pragma _HP_SECONDARY_DEF PMPI_Info_get MPI_Info_get
16 #elif defined(HAVE_PRAGMA_CRI_DUP)
17 #pragma _CRI duplicate MPI_Info_get as PMPI_Info_get
18
19 #endif
20
21
22 #define MPIO_BUILD_PROFILING
23 #include "mpioprof.h"
24 #endif
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 int MPI_Info_get(MPI_Info info, char *key, int valuelen, char *value, int *flag)
41 {
42 MPI_Info curr;
43
44 if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) {
45 FPRINTF(stderr, "MPI_Info_get: Invalid info object\n");
46 MPI_Abort(MPI_COMM_WORLD, 1);
47 }
48
49 if (key <= (char *) 0) {
50 FPRINTF(stderr, "MPI_Info_get: key is an invalid address\n");
51 MPI_Abort(MPI_COMM_WORLD, 1);
52 }
53
54 if (strlen(key) > MPI_MAX_INFO_KEY) {
55 FPRINTF(stderr, "MPI_Info_get: key is longer than MPI_MAX_INFO_KEY\n");
56 MPI_Abort(MPI_COMM_WORLD, 1);
57 }
58
59 if (!strlen(key)) {
60 FPRINTF(stderr, "MPI_Info_get: key is a null string\n");
61 MPI_Abort(MPI_COMM_WORLD, 1);
62 }
63
64 if (valuelen <= 0) {
65 FPRINTF(stderr, "MPI_Info_get: Invalid valuelen argument\n");
66 MPI_Abort(MPI_COMM_WORLD, 1);
67 }
68
69 if (value <= (char *) 0) {
70 FPRINTF(stderr, "MPI_Info_get: value is an invalid address\n");
71 MPI_Abort(MPI_COMM_WORLD, 1);
72 }
73
74 curr = info->next;
75 *flag = 0;
76
77 while (curr) {
78 if (!strcmp(curr->key, key)) {
79 ADIOI_Strncpy(value, curr->value, valuelen);
80 value[valuelen] = '\0';
81 *flag = 1;
82 break;
83 }
84 curr = curr->next;
85 }
86
87 return MPI_SUCCESS;
88 }