2004-01-26 01:07:54 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-26 01:07:54 +03:00
|
|
|
|
|
|
|
#include "mpi.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mpi/c/bindings.h"
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "class/ompi_list.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "info/info.h"
|
2004-02-04 01:34:01 +03:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2004-04-21 02:13:39 +04:00
|
|
|
#include "errhandler/errhandler.h"
|
|
|
|
#include "communicator/communicator.h"
|
2004-01-26 01:07:54 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
2004-01-26 01:07:54 +03:00
|
|
|
#pragma weak MPI_Info_set = PMPI_Info_set
|
|
|
|
#endif
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_PROFILING_DEFINES
|
2004-04-20 22:50:43 +04:00
|
|
|
#include "mpi/c/profile/defines.h"
|
|
|
|
#endif
|
|
|
|
|
2004-02-02 01:28:20 +03:00
|
|
|
/**
|
|
|
|
* MPI_Info_set - Set a (key, value) pair in an 'MPI_Info' object
|
|
|
|
*
|
|
|
|
* @param key null-terminated character string of the index key
|
|
|
|
* @param value null-terminated character string of the value
|
|
|
|
* @param info info object (handle)
|
|
|
|
*
|
|
|
|
* @retval MPI_SUCCESS
|
|
|
|
* @retval MPI_ERR_ARG
|
|
|
|
* @retval MPI_ERR_INFO_KEY
|
|
|
|
* @retval MPI_ERR_INFO_VAL
|
|
|
|
* @retval MPI_ERR_INFO_NOKEY
|
|
|
|
* @retval MPI_ERR_INTERN
|
|
|
|
*
|
|
|
|
* MPI_Info_set adds the (key,value) pair to info, and overrides
|
|
|
|
* teh value if for the same key a previsou value was set. key and
|
2004-02-04 01:34:01 +03:00
|
|
|
* value must be NULL terminated strings in C. In fortan, leading
|
2004-02-02 01:28:20 +03:00
|
|
|
* and trailing spaces in key and value are stripped. If either
|
|
|
|
* key or value is greater than the allowed maxima, MPI_ERR_INFO_KEY
|
|
|
|
* and MPI_ERR_INFO_VALUE are raised
|
|
|
|
*/
|
2004-01-26 01:07:54 +03:00
|
|
|
int MPI_Info_set(MPI_Info info, char *key, char *value) {
|
2004-02-11 18:23:43 +03:00
|
|
|
int err;
|
2004-02-04 01:34:01 +03:00
|
|
|
int key_length;
|
|
|
|
int value_length;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Error conditions are
|
|
|
|
* 1. MPI_ERR_ARG if
|
|
|
|
* - info is NULL
|
|
|
|
* 2. MPI_ERR_SYSRESOURCE
|
|
|
|
* - No storage space available for the new value
|
|
|
|
* 3. MPI_ERR_INFO_KEY
|
|
|
|
* - Key length exceeded MPI_MAX_KEY_VAL
|
|
|
|
* 3. MPI_ERR_INFO_VAL
|
|
|
|
* - value length exceeded MPI_MAX_KEY_VAL
|
|
|
|
*/
|
|
|
|
|
2004-04-21 02:13:39 +04:00
|
|
|
if (MPI_PARAM_CHECK) {
|
|
|
|
if (NULL == info){
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_ARG,
|
2004-04-21 02:13:39 +04:00
|
|
|
"MPI_Info_set");
|
|
|
|
}
|
2004-02-04 01:34:01 +03:00
|
|
|
|
2004-04-21 02:13:39 +04:00
|
|
|
key_length = (key) ? strlen (key) : 0;
|
|
|
|
if ( (0 == key_length) || (MPI_MAX_INFO_KEY <= key_length)) {
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_INFO_KEY,
|
2004-04-21 02:13:39 +04:00
|
|
|
"MPI_Info_set");
|
|
|
|
}
|
2004-02-04 01:34:01 +03:00
|
|
|
|
2004-04-21 02:13:39 +04:00
|
|
|
value_length = (value) ? strlen (value) : 0;
|
|
|
|
if ( (0 == value_length) || (MPI_MAX_INFO_KEY <= value_length)) {
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_INFO_VALUE,
|
2004-04-21 02:13:39 +04:00
|
|
|
"MPI_Info_set");
|
|
|
|
}
|
2004-02-04 01:34:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2004-02-11 18:23:43 +03:00
|
|
|
* If all is right with the arguments, then call the back-end
|
|
|
|
* allocator.
|
2004-02-04 01:34:01 +03:00
|
|
|
*/
|
2004-02-11 18:23:43 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
err = ompi_info_set (info, key, value);
|
2004-02-04 01:34:01 +03:00
|
|
|
|
2004-02-11 18:23:43 +03:00
|
|
|
if (MPI_ERR_SYSRESOURCE == err) {
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_SYSRESOURCE,
|
2004-04-21 02:13:39 +04:00
|
|
|
"MPI_Info_set");
|
2004-02-04 01:34:01 +03:00
|
|
|
}
|
|
|
|
|
2004-02-11 18:23:43 +03:00
|
|
|
return err;
|
2004-01-26 01:07:54 +03:00
|
|
|
}
|