1 /* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "smpi_info.hpp"
8 #include "smpi_comm.hpp"
10 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
12 /* PMPI User level calls */
14 int PMPI_Info_create( MPI_Info *info){
15 CHECK_NULL(1, MPI_ERR_ARG, info)
16 *info = new simgrid::smpi::Info();
20 int PMPI_Info_set( MPI_Info info, const char *key, const char *value){
22 CHECK_NULL(2, MPI_ERR_INFO_KEY, key)
23 CHECK_NULL(3, MPI_ERR_INFO_VALUE, value)
24 info->set(key, value);
28 int PMPI_Info_free( MPI_Info *info){
29 CHECK_NULL(1, MPI_ERR_ARG, info)
31 (*info)->mark_as_deleted();
32 simgrid::smpi::Info::unref(*info);
37 int PMPI_Info_get(MPI_Info info, const char *key,int valuelen, char *value, int *flag){
41 CHECK_NULL(2, MPI_ERR_INFO_KEY, key)
42 CHECK_NULL(3, MPI_ERR_INFO_VALUE, value)
43 CHECK_NULL(4, MPI_ERR_ARG, flag)
45 return info->get(key, valuelen, value, flag);
48 int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo){
50 CHECK_NULL(2, MPI_ERR_ARG, newinfo)
51 *newinfo = new simgrid::smpi::Info(info);
55 int PMPI_Info_delete(MPI_Info info, const char *key){
57 CHECK_NULL(2, MPI_ERR_INFO_KEY, key)
58 return info->remove(key);
61 int PMPI_Info_get_nkeys( MPI_Info info, int *nkeys){
63 CHECK_NULL(2, MPI_ERR_ARG, nkeys)
64 return info->get_nkeys(nkeys);
67 int PMPI_Info_get_nthkey( MPI_Info info, int n, char *key){
69 CHECK_NULL(2, MPI_ERR_INFO_KEY, key)
70 if (n<0 || n> MPI_MAX_INFO_KEY)
72 return info->get_nthkey(n, key);
75 int PMPI_Info_get_valuelen( MPI_Info info, const char *key, int *valuelen, int *flag){
78 CHECK_NULL(2, MPI_ERR_INFO_KEY, key)
79 CHECK_NULL(2, MPI_ERR_INFO_VALUE, valuelen)
80 return info->get_valuelen(key, valuelen, flag);
83 MPI_Info PMPI_Info_f2c(MPI_Fint info){
86 return simgrid::smpi::Info::f2c(info);
89 MPI_Fint PMPI_Info_c2f(MPI_Info info){
90 if(info==MPI_INFO_NULL)