From feb8eb8a909df9f3cbecd02c365cbcb1215e0e15 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 2 Feb 2012 23:57:09 +0000 Subject: [PATCH] Add the new MPI-3 function MPI_GET_LIBRARY_VERSION. This commit was SVN r25860. --- config/ompi_save_version.m4 | 6 +- examples/hello_c.c | 7 +- examples/hello_cxx.cc | 7 +- examples/hello_f77.f | 7 +- examples/hello_f90.f90 | 8 +- ompi/include/mpi.h.in | 5 +- ompi/include/mpif-config.h.in | 4 +- ompi/mpi/c/Makefile.am | 3 +- ompi/mpi/c/get_library_version.c | 125 ++++++++++++++++++ ompi/mpi/c/profile/Makefile.am | 3 +- ompi/mpi/c/profile/defines.h | 3 +- ompi/mpi/f77/Makefile.am | 3 +- ompi/mpi/f77/get_library_version_f.c | 76 +++++++++++ ompi/mpi/f77/profile/Makefile.am | 3 +- ompi/mpi/f77/prototypes_mpi.h | 3 +- ompi/mpi/f90/scripts/mpi-f90-interfaces.h.sh | 26 +++- ompi/mpi/man/man3/MPI_Get_library_version.3in | 84 ++++++++++++ ompi/mpi/man/man3/Makefile.extra | 3 +- 18 files changed, 357 insertions(+), 19 deletions(-) create mode 100644 ompi/mpi/c/get_library_version.c create mode 100644 ompi/mpi/f77/get_library_version_f.c create mode 100644 ompi/mpi/man/man3/MPI_Get_library_version.3in diff --git a/config/ompi_save_version.m4 b/config/ompi_save_version.m4 index defbbd4d01..a60aece94a 100644 --- a/config/ompi_save_version.m4 +++ b/config/ompi_save_version.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. -dnl Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -55,6 +55,10 @@ AC_DEFUN([OPAL_SAVE_VERSION], [ [Complete release number of ]$2) AC_DEFINE_UNQUOTED($1[_RELEASE_DATE], ["$]$1[_RELEASE_DATE"], [Release date of ]$2) + AC_DEFINE_UNQUOTED($1[_WANT_REPO_REV], ["$]$1[_WANT_REPO_REV"], + [Release date of ]$2) + AC_DEFINE_UNQUOTED($1[_REPO_REV], ["$]$1[_REPO_REV"], + [Release date of ]$2) AC_CONFIG_FILES([$4]) ])dnl diff --git a/examples/hello_c.c b/examples/hello_c.c index 17a4bd8ec7..a0e6d838c7 100644 --- a/examples/hello_c.c +++ b/examples/hello_c.c @@ -12,12 +12,15 @@ int main(int argc, char* argv[]) { - int rank, size; + int rank, size, len; + char version[MPI_MAX_LIBRARY_VERSION_STRING]; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); - printf("Hello, world, I am %d of %d\n", rank, size); + MPI_Get_library_version(version, &len); + printf("Hello, world, I am %d of %d, (%s, %d)\n", + rank, size, version, len); MPI_Finalize(); return 0; diff --git a/examples/hello_cxx.cc b/examples/hello_cxx.cc index 604726630c..b612a4f7c6 100644 --- a/examples/hello_cxx.cc +++ b/examples/hello_cxx.cc @@ -12,12 +12,15 @@ int main(int argc, char **argv) { - int rank, size; + int rank, size, len; + char version[MPI_MAX_LIBRARY_VERSION_STRING]; MPI::Init(); rank = MPI::COMM_WORLD.Get_rank(); size = MPI::COMM_WORLD.Get_size(); - std::cout << "Hello, world! I am " << rank << " of " << size << std::endl; + MPI_Get_library_version(version, &len); + std::cout << "Hello, world! I am " << rank << " of " << size + << "(" << version << ", " << len << ")" << std::endl; MPI::Finalize(); return 0; diff --git a/examples/hello_f77.f b/examples/hello_f77.f index 684b5d98c4..8b4ada3e7d 100644 --- a/examples/hello_f77.f +++ b/examples/hello_f77.f @@ -9,12 +9,15 @@ C program main implicit none include 'mpif.h' - integer ierr, rank, size + integer ierr, rank, size, len + character*(MPI_MAX_LIBRARY_VERSION_STRING) version call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr) - print *, "Hello, world, I am ", rank, " of ", size + call MPI_GET_LIBRARY_VERSION(version, len, ierr) + print *, "Hello, world, I am ", rank, " of ", size, " (", + & version, ",", len, ")" call MPI_FINALIZE(ierr) end diff --git a/examples/hello_f90.f90 b/examples/hello_f90.f90 index c5db03f260..dd6d9ed545 100644 --- a/examples/hello_f90.f90 +++ b/examples/hello_f90.f90 @@ -11,11 +11,15 @@ program main use mpi implicit none - integer :: ierr, rank, size + integer :: ierr, rank, size, len + character*(MPI_MAX_LIBRARY_VERSION_STRING) :: version + character*(MPI_MAX_OBJECT_NAME) :: name call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr) - print *, "Hello, world, I am ", rank, " of ", size + call MPI_GET_LIBRARY_VERSION(version, len, ierr) + print *, "Hello, world, I am ", rank, " of ", size," (", & + version, ",", len, ")" call MPI_FINALIZE(ierr) end diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index ef39b947ad..3a1bf43b7e 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ @@ -409,6 +409,7 @@ typedef int (MPI_Grequest_cancel_function)(void *, int); #define MPI_MAX_PROCESSOR_NAME OPAL_MAX_PROCESSOR_NAME /* max proc. name length */ #define MPI_MAX_ERROR_STRING OPAL_MAX_ERROR_STRING /* max error message length */ #define MPI_MAX_OBJECT_NAME OPAL_MAX_OBJECT_NAME /* max object name length */ +#define MPI_MAX_LIBRARY_VERSION_STRING 256 /* max length of library version string */ #define MPI_UNDEFINED -32766 /* undefined stuff */ #define MPI_CART 1 /* cartesian topology */ #define MPI_GRAPH 2 /* graph topology */ @@ -1250,6 +1251,7 @@ OMPI_DECLSPEC int MPI_Get(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win); +OMPI_DECLSPEC int MPI_Get_library_version(char *version, int *resultlen); OMPI_DECLSPEC int MPI_Get_processor_name(char *name, int *resultlen); OMPI_DECLSPEC int MPI_Get_version(int *version, int *subversion); OMPI_DECLSPEC int MPI_Graph_create(MPI_Comm comm_old, int nnodes, int *index, @@ -1778,6 +1780,7 @@ OMPI_DECLSPEC int PMPI_Get(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win); +OMPI_DECLSPEC int PMPI_Get_library_version(char *version, int *resultlen); OMPI_DECLSPEC int PMPI_Get_processor_name(char *name, int *resultlen); OMPI_DECLSPEC int PMPI_Get_version(int *version, int *subversion); OMPI_DECLSPEC int PMPI_Graph_create(MPI_Comm comm_old, int nnodes, int *index, diff --git a/ompi/include/mpif-config.h.in b/ompi/include/mpif-config.h.in index 905adcf2fc..4575e6e681 100644 --- a/ompi/include/mpif-config.h.in +++ b/ompi/include/mpif-config.h.in @@ -10,7 +10,7 @@ ! University of Stuttgart. All rights reserved. ! Copyright (c) 2004-2005 The Regents of the University of California. ! All rights reserved. -! Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. +! Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. ! $COPYRIGHT$ ! ! Additional copyrights may follow @@ -95,6 +95,7 @@ integer MPI_MAX_PROCESSOR_NAME integer MPI_MAX_ERROR_STRING integer MPI_MAX_OBJECT_NAME + integer MPI_MAX_LIBRARY_VERSION_STRING integer MPI_MAX_INFO_KEY integer MPI_MAX_INFO_VAL integer MPI_MAX_PORT_NAME @@ -102,6 +103,7 @@ parameter (MPI_MAX_PROCESSOR_NAME=@OPAL_MAX_PROCESSOR_NAME@-1) parameter (MPI_MAX_ERROR_STRING=@OPAL_MAX_ERROR_STRING@-1) parameter (MPI_MAX_OBJECT_NAME=@OPAL_MAX_OBJECT_NAME@-1) + parameter (MPI_MAX_LIBRARY_VERSION_STRING=256-1) parameter (MPI_MAX_INFO_KEY=@OPAL_MAX_INFO_KEY@-1) parameter (MPI_MAX_INFO_VAL=@OPAL_MAX_INFO_VAL@-1) parameter (MPI_MAX_PORT_NAME=@OPAL_MAX_PORT_NAME@-1) diff --git a/ompi/mpi/c/Makefile.am b/ompi/mpi/c/Makefile.am index c6357479bb..7fc180200d 100644 --- a/ompi/mpi/c/Makefile.am +++ b/ompi/mpi/c/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -139,6 +139,7 @@ libmpi_c_mpi_la_SOURCES = \ get_address.c \ get_count.c \ get_elements.c \ + get_library_version.c \ get_processor_name.c \ get_version.c \ graph_create.c \ diff --git a/ompi/mpi/c/get_library_version.c b/ompi/mpi/c/get_library_version.c new file mode 100644 index 0000000000..6ed115b9bc --- /dev/null +++ b/ompi/mpi/c/get_library_version.c @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "ompi_config.h" +#include + +#include "ompi/mpi/c/bindings.h" +#include "ompi/runtime/params.h" +#include "ompi/communicator/communicator.h" +#include "ompi/errhandler/errhandler.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_Get_library_version = PMPI_Get_library_version +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/c/profile/defines.h" +#endif + +static const char FUNC_NAME[] = "MPI_get_library_version"; + + +int MPI_Get_library_version(char *version, int *resultlen) +{ + int len_left; + MPI_Comm null = MPI_COMM_NULL; + char *ptr, tmp[MPI_MAX_LIBRARY_VERSION_STRING]; + + OPAL_CR_NOOP_PROGRESS(); + + if (MPI_PARAM_CHECK) { + /* Per MPI-3, this function can be invoked before + MPI_INIT, so we don't invoke the normal + MPI_ERR_INIT_FINALIZE() macro here */ + + if (NULL == version || NULL == resultlen) { + /* Note that we have to check and see if we have + previously called MPI_INIT or not. If so, use the + normal OMPI_ERRHANDLER_INVOKE, because the user may + have changed the default errhandler on MPI_COMM_WORLD. + If we have not invoked MPI_INIT, then just abort + (i.e., use a NULL communicator, which will end up at the + default errhandler, which is abort). */ + + if (ompi_mpi_initialized && !ompi_mpi_finalized) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, + FUNC_NAME); + } else { + return OMPI_ERRHANDLER_INVOKE(null, MPI_ERR_ARG, + FUNC_NAME); + } + } + } + + /* First write to a tmp variable so that we can write to *all* the + chars (MPI-3 says that we can only write resultlen chars to the + output string) */ + ptr = tmp; + len_left = sizeof(tmp); + memset(tmp, 0, MPI_MAX_LIBRARY_VERSION_STRING); + + snprintf(tmp, MPI_MAX_LIBRARY_VERSION_STRING, "Open MPI v%d.%d", + OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION); + ptr += strlen(tmp); + len_left -= strlen(tmp); + + if (OMPI_RELEASE_VERSION > 0) { + snprintf(ptr, len_left, ".%d", OMPI_RELEASE_VERSION); + ptr = tmp + strlen(tmp); + len_left = MPI_MAX_LIBRARY_VERSION_STRING - strlen(tmp); + } + if (NULL != OMPI_GREEK_VERSION && strlen(OMPI_GREEK_VERSION) > 0) { + snprintf(ptr, len_left, "%s", OMPI_GREEK_VERSION); + ptr = tmp + strlen(tmp); + len_left = MPI_MAX_LIBRARY_VERSION_STRING - strlen(tmp); + } + + /* Package name */ + if (NULL != OPAL_PACKAGE_STRING && strlen(OPAL_PACKAGE_STRING) > 0) { + snprintf(ptr, len_left, ", package: %s", OPAL_PACKAGE_STRING); + ptr = tmp + strlen(tmp); + len_left = MPI_MAX_LIBRARY_VERSION_STRING - strlen(tmp); + } + + /* Ident string */ + if (NULL != OMPI_IDENT_STRING && strlen(OMPI_IDENT_STRING) > 0) { + snprintf(ptr, len_left, ", ident: %s", OMPI_IDENT_STRING); + ptr = tmp + strlen(tmp); + len_left = MPI_MAX_LIBRARY_VERSION_STRING - strlen(tmp); + } + + /* Repository revision */ + if (OMPI_WANT_REPO_REV && + NULL != OMPI_REPO_REV && strlen(OMPI_REPO_REV) > 0) { + snprintf(ptr, len_left, ", repo rev: %s", OMPI_REPO_REV); + ptr = tmp + strlen(tmp); + len_left = MPI_MAX_LIBRARY_VERSION_STRING - strlen(tmp); + } + + /* Release date */ + if (NULL != OMPI_RELEASE_DATE && strlen(OMPI_RELEASE_DATE) > 0) { + snprintf(ptr, len_left, ", %s", OMPI_RELEASE_DATE); + ptr = tmp + strlen(tmp); + len_left = MPI_MAX_LIBRARY_VERSION_STRING - strlen(tmp); + } + + memcpy(version, tmp, strlen(tmp) + 1); + *resultlen = strlen(tmp) + 1; + + return MPI_SUCCESS; +} diff --git a/ompi/mpi/c/profile/Makefile.am b/ompi/mpi/c/profile/Makefile.am index c814ac73f3..35dda6ef35 100644 --- a/ompi/mpi/c/profile/Makefile.am +++ b/ompi/mpi/c/profile/Makefile.am @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -121,6 +121,7 @@ nodist_libmpi_c_pmpi_la_SOURCES = \ pget_address.c \ pget_count.c \ pget_elements.c \ + pget_library_version.c \ pget_processor_name.c \ pget_version.c \ pgraph_create.c \ diff --git a/ompi/mpi/c/profile/defines.h b/ompi/mpi/c/profile/defines.h index b37778df18..66841ab8b8 100644 --- a/ompi/mpi/c/profile/defines.h +++ b/ompi/mpi/c/profile/defines.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -165,6 +165,7 @@ #define MPI_Get_count PMPI_Get_count #define MPI_Get_elements PMPI_Get_elements #define MPI_Get PMPI_Get +#define MPI_Get_library_version PMPI_Get_library_version #define MPI_Get_processor_name PMPI_Get_processor_name #define MPI_Get_version PMPI_Get_version #define MPI_Graph_create PMPI_Graph_create diff --git a/ompi/mpi/f77/Makefile.am b/ompi/mpi/f77/Makefile.am index f5cf7b7383..db8c9c9a65 100644 --- a/ompi/mpi/f77/Makefile.am +++ b/ompi/mpi/f77/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -155,6 +155,7 @@ libmpi_f77_la_SOURCES += \ get_address_f.c \ get_count_f.c \ get_elements_f.c \ + get_library_version_f.c \ get_processor_name_f.c \ get_version_f.c \ graph_create_f.c \ diff --git a/ompi/mpi/f77/get_library_version_f.c b/ompi/mpi/f77/get_library_version_f.c new file mode 100644 index 0000000000..6d9a066a90 --- /dev/null +++ b/ompi/mpi/f77/get_library_version_f.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/f77/bindings.h" +#include "ompi/mpi/f77/f77_strings.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER +#pragma weak PMPI_GET_LIBRARY_VERSION = mpi_get_library_version_f +#pragma weak pmpi_get_library_version = mpi_get_library_version_f +#pragma weak pmpi_get_library_version_ = mpi_get_library_version_f +#pragma weak pmpi_get_library_version__ = mpi_get_library_version_f +#elif OMPI_PROFILE_LAYER +OMPI_GENERATE_F77_BINDINGS (PMPI_GET_LIBRARY_VERSION, + pmpi_get_library_version, + pmpi_get_library_version_, + pmpi_get_library_version__, + pmpi_get_library_version_f, + (char *version, MPI_Fint *resultlen, MPI_Fint *ierr, MPI_Fint version_len), + (version, resultlen, ierr, version_len) ) +#endif + +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_GET_LIBRARY_VERSION = mpi_get_library_version_f +#pragma weak mpi_get_library_version = mpi_get_library_version_f +#pragma weak mpi_get_library_version_ = mpi_get_library_version_f +#pragma weak mpi_get_library_version__ = mpi_get_library_version_f +#endif + +#if ! OPAL_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER +OMPI_GENERATE_F77_BINDINGS (MPI_GET_LIBRARY_VERSION, + mpi_get_library_version, + mpi_get_library_version_, + mpi_get_library_version__, + mpi_get_library_version_f, + (char *version, MPI_Fint *resultlen, MPI_Fint *ierr, MPI_Fint version_len), + (version, resultlen, ierr, version_len) ) +#endif + + +#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS +#include "ompi/mpi/f77/profile/defines.h" +#endif + +void mpi_get_library_version_f(char *version, MPI_Fint *resultlen, + MPI_Fint *ierr, MPI_Fint version_len) +{ + int err, c_resultlen; + char c_version[MPI_MAX_LIBRARY_VERSION_STRING]; + + err = MPI_Get_library_version(c_version, &c_resultlen); + if (MPI_SUCCESS == err) { + ompi_fortran_string_c2f(c_version, version, + OMPI_FINT_2_INT(version_len)); + *resultlen = OMPI_INT_2_FINT(c_resultlen); + *ierr = OMPI_INT_2_FINT(MPI_SUCCESS); + } else { + *ierr = OMPI_INT_2_FINT(err); + } +} diff --git a/ompi/mpi/f77/profile/Makefile.am b/ompi/mpi/f77/profile/Makefile.am index 2130c29eed..b959cac8e8 100644 --- a/ompi/mpi/f77/profile/Makefile.am +++ b/ompi/mpi/f77/profile/Makefile.am @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -120,6 +120,7 @@ nodist_libmpi_f77_pmpi_la_SOURCES = \ pget_address_f.c \ pget_count_f.c \ pget_elements_f.c \ + pget_library_version_f.c \ pget_processor_name_f.c \ pget_version_f.c \ pgraph_create_f.c \ diff --git a/ompi/mpi/f77/prototypes_mpi.h b/ompi/mpi/f77/prototypes_mpi.h index 1e60f22a65..bf1e4054f4 100644 --- a/ompi/mpi/f77/prototypes_mpi.h +++ b/ompi/mpi/f77/prototypes_mpi.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -198,6 +198,7 @@ PN(void, mpi_get_address, MPI_GET_ADDRESS, (char *location, MPI_Aint *address, M PN(void, mpi_get_count, MPI_GET_COUNT, (MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr)); PN(void, mpi_get_elements, MPI_GET_ELEMENTS, (MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr)); PN(void, mpi_get, MPI_GET, (char *origin_addr, MPI_Fint *origin_count, MPI_Fint *origin_datatype, MPI_Fint *target_rank, MPI_Aint *target_disp, MPI_Fint *target_count, MPI_Fint *target_datatype, MPI_Fint *win, MPI_Fint *ierr)); +PN(void, mpi_get_library_version, MPI_GET_LIBRARY_VERSION, (char *version, MPI_Fint *resultlen, MPI_Fint *ierr, MPI_Fint version_len)); PN(void, mpi_get_processor_name, MPI_GET_PROCESSOR_NAME, (char *name, MPI_Fint *resultlen, MPI_Fint *ierr, int name_len)); PN(void, mpi_get_version, MPI_GET_VERSION, (MPI_Fint *version, MPI_Fint *subversion, MPI_Fint *ierr)); PN(void, mpi_graph_create, MPI_GRAPH_CREATE, (MPI_Fint *comm_old, MPI_Fint *nnodes, MPI_Fint *index, MPI_Fint *edges, ompi_fortran_logical_t *reorder, MPI_Fint *comm_graph, MPI_Fint *ierr)); diff --git a/ompi/mpi/f90/scripts/mpi-f90-interfaces.h.sh b/ompi/mpi/f90/scripts/mpi-f90-interfaces.h.sh index 41c775df94..4fd7d968ee 100755 --- a/ompi/mpi/f90/scripts/mpi-f90-interfaces.h.sh +++ b/ompi/mpi/f90/scripts/mpi-f90-interfaces.h.sh @@ -5,7 +5,7 @@ # Corporation. All rights reserved. # Copyright (c) 2004-2006 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2006-2011 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -9553,3 +9553,27 @@ start MPI_Comm_spawn_multiple small output_284 MPI_Comm_spawn_multipleA "character(len=*), dimension(count,*)" output_284 MPI_Comm_spawn_multipleN "double precision" end MPI_Comm_spawn_multiple + +#------------------------------------------------------------------------ + +output_285() { + if test "$output" = "0"; then + return 0 + fi + + procedure=$1 + cat < +int MPI_Get_library_version(char \fI*version\fP, int \fI*resultlen\fP) + +.fi +.SH Fortran Syntax +.nf +INCLUDE 'mpif.h' +MPI_GET_LIBRARY_VERSION(\fIVERSION\fP, \fIRESULTLEN\fP, \fIIERROR\fP) + CHARACTER*(*) \fINAME\fP + INTEGER \fIRESULTLEN\fP, \fIIERROR\fP + +.fi +.SH C++ Syntax +.nf +There is no C++ binding for this function. + +.fi +.SH OUTPUT PARAMETERS +.ft R +.TP 1i +version +A string containing the Open MPI version (string). + +.ft R +.TP 1i +resultlen +Length (in characters) of result returned in \fIversion\fP (integer). + +.ft R +.TP 1i +IERROR +Fortran only: Error status (integer). + +.SH DESCRIPTION +.ft R +This routine returns a string representing the version of the MPI +library. The version argument is a character string for maximum +flexibility. +.sp +The number of characters actually written is returned in the output +argument, \fIresultlen\fP. In C, a '\\0' character is additionally +stored at \fIversion[resultlen]\fP. The \fIresultlen\fP cannot be +larger than (MPI_MAX_LIBRARY_VERSION_STRING - 1). In Fortran, version +is padded on the right with blank characters. The \fIresultlen\fP +cannot be larger than MPI_MAX_LIBRARY_VERSION_STRING. + +.SH NOTE +.ft R +The \fIversion\fP string that is passed must be at least +MPI_MAX_LIBRARY_VERSION_STRING characters long. +.sp +MPI_Get_library_version is one of the few functions that can be called +before MPI_Init and after MPI_Finalize. +.sp +MPI_Get_library_version is an MPI-3 function and has no C++ binding. + +.SH ERRORS +Almost all MPI routines return an error value; C routines as the value +of the function and Fortran routines in the last argument. +.sp +Before the error value is returned, the current MPI error handler is +called. By default, this error handler aborts the MPI job, except for +I/O function errors. The error handler may be changed with +MPI_Comm_set_errhandler; the predefined error handler +MPI_ERRORS_RETURN may be used to cause error values to be +returned. Note that MPI does not guarantee that an MPI program can +continue past an error. + +.SH SEE ALSO +.ft R +.nf +MPI_Get_version diff --git a/ompi/mpi/man/man3/Makefile.extra b/ompi/mpi/man/man3/Makefile.extra index 480898292e..fe4aec0b61 100644 --- a/ompi/mpi/man/man3/Makefile.extra +++ b/ompi/mpi/man/man3/Makefile.extra @@ -1,5 +1,5 @@ # -*- makefile -*- -# Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # $COPYRIGHT$ # @@ -149,6 +149,7 @@ mpi_api_man_pages = \ mpi/man/man3/MPI_Get_address.3 \ mpi/man/man3/MPI_Get_count.3 \ mpi/man/man3/MPI_Get_elements.3 \ + mpi/man/man3/MPI_Get_library_version.3 \ mpi/man/man3/MPI_Get_processor_name.3 \ mpi/man/man3/MPI_Get_version.3 \ mpi/man/man3/MPI_Graph_create.3 \