2004-01-25 22:07:54 +00:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "lam_config.h"
|
|
|
|
|
|
|
|
#include "mpi.h"
|
2004-03-17 18:45:16 +00:00
|
|
|
#include "mpi/c/bindings.h"
|
|
|
|
#include "lfc/lam_list.h"
|
|
|
|
#include "info/info.h"
|
2004-01-25 22:07:54 +00:00
|
|
|
|
|
|
|
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
|
|
|
#pragma weak MPI_Info_dup = PMPI_Info_dup
|
|
|
|
#endif
|
|
|
|
|
2004-02-01 22:28:20 +00:00
|
|
|
/**
|
|
|
|
* MPI_Info_dup - Duplicate an 'MPI_Info' object
|
|
|
|
*
|
|
|
|
* @param info source info object (handle)
|
|
|
|
* @param newinfo pointer to the new info object (handle)
|
|
|
|
*
|
|
|
|
* @retval MPI_SUCCESS
|
|
|
|
* @retval MPI_ERR_ARG
|
2004-02-11 15:23:43 +00:00
|
|
|
* @retval MPI_ERR_SYSRESOURCE
|
2004-02-01 22:28:20 +00:00
|
|
|
*
|
|
|
|
* Not only will the (key, value) pairs be duplicated, the order of keys
|
|
|
|
* will be the same in 'newinfo' as it is in 'info'.
|
|
|
|
* When an info object is no longer being used, it should be freed with
|
|
|
|
* 'MPI_Info_free'.
|
|
|
|
*/
|
2004-01-25 22:07:54 +00:00
|
|
|
int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) {
|
2004-02-03 22:34:01 +00:00
|
|
|
int err;
|
2004-02-01 22:28:20 +00:00
|
|
|
/**
|
|
|
|
* Here we need to do 2 things
|
|
|
|
* 1. Create a newinfo object using MPI_Info_create
|
|
|
|
* 2. Fetch all the values from info and copy them to
|
|
|
|
* newinfo using MPI_Info_set
|
2004-02-03 22:34:01 +00:00
|
|
|
* The new implementation facilitates traversal in many ways.
|
|
|
|
* I have chosen to get the number of elements on the list
|
|
|
|
* and copy them to newinfo one by one
|
2004-02-01 22:28:20 +00:00
|
|
|
*/
|
2004-02-03 22:34:01 +00:00
|
|
|
|
|
|
|
if (NULL == info){
|
|
|
|
printf ("Invalid MPI_Info handle passed\n");
|
|
|
|
return MPI_ERR_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = MPI_Info_create(newinfo);
|
|
|
|
if (MPI_SUCCESS != err) {
|
|
|
|
printf ("Creation of newinfo falied\n");
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Now to actually duplicate all the values
|
|
|
|
*/
|
2004-02-11 15:23:43 +00:00
|
|
|
err = lam_info_dup (info, newinfo);
|
2004-02-03 22:34:01 +00:00
|
|
|
|
2004-02-11 15:23:43 +00:00
|
|
|
if (err == MPI_ERR_SYSRESOURCE) {
|
|
|
|
printf ("Resources are not sufficient to finish dup'ing\n");
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2004-01-25 22:07:54 +00:00
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|