Commit 89eb96d
committed
Retain info references on public info dup
We need to keep the references when duplicating info through
MPI_Info_dup so that subsequent calls to MPI_Info_dup
see the same info entries.
Test case provided by Neil Fortner:
```C
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#define ERROR(msg) \
do { \
printf(msg "\n"); \
exit(1); \
} while(0)
int main(void) {
MPI_Info info1 = MPI_INFO_NULL, info2 = MPI_INFO_NULL, info3 = MPI_INFO_NULL;
int nkeys1, nkeys2, nkeys3;
if (MPI_Info_create(&info1) != MPI_SUCCESS)
ERROR("MPI_Info_create failed");
if (MPI_Info_set(info1, "custom_key", "custom_value") != MPI_SUCCESS)
ERROR("MPI_Info_set failed");
if (MPI_Info_get_nkeys(info1, &nkeys1) != MPI_SUCCESS)
ERROR("MPI_Info_get_nkeys(info1, &nkeys1) failed");
if (MPI_Info_dup(info1, &info2) != MPI_SUCCESS)
ERROR("MPI_Info_dup failed");
if (MPI_Info_free(&info1) != MPI_SUCCESS)
ERROR("MPI_Info_free(&info1) failed");
if (MPI_Info_get_nkeys(info2, &nkeys2) != MPI_SUCCESS)
ERROR("MPI_Info_get_nkeys(info2, &nkeys2) failed");
if (nkeys1 != nkeys2)
ERROR("Number of keys on duplicated MPI info object does not match that on original");
if (MPI_Info_dup(info2, &info3) != MPI_SUCCESS)
ERROR("MPI_Info_dup failed");
if (MPI_Info_free(&info2) != MPI_SUCCESS)
ERROR("MPI_Info_free(&info2) failed");
if (MPI_Info_get_nkeys(info3, &nkeys3) != MPI_SUCCESS)
ERROR("MPI_Info_get_nkeys(info3, &nkeys3) failed");
if (nkeys1 != nkeys3)
ERROR("Number of keys on double duplicated MPI info object does not match that on original");
if (MPI_Info_free(&info3) != MPI_SUCCESS)
ERROR("MPI_Info_free(&info3) failed");
printf("test passed\n");
return 0;
}
```
Signed-off-by: Joseph Schuchart <[email protected]>1 parent 25ea13d commit 89eb96d
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
85 | 90 | | |
86 | 91 | | |
87 | 92 | | |
| |||
0 commit comments