From 108799ea0e1a474bac622c30adcebc4af642d9ff Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 17 Feb 2012 11:42:51 +0000 Subject: [PATCH] Fixes trac:2933: a bunch of C++ API corrections from Fujitsu. Custom patch from the ticket, released under the BSD license. This commit was SVN r25949. The following Trac tickets were found above: Ticket 2933 --> https://svn.open-mpi.org/trac/ompi/ticket/2933 --- ompi/mpi/cxx/comm.h | 3 +- ompi/mpi/cxx/comm_inln.h | 3 +- ompi/mpi/cxx/constants.h | 35 ++++++++++++++--- ompi/mpi/cxx/datatype.h | 23 ++++++++++++ ompi/mpi/cxx/datatype_inln.h | 71 +++++++++++++++++++++++++++++++++++ ompi/mpi/cxx/functions.h | 10 +++++ ompi/mpi/cxx/functions_inln.h | 23 ++++++++++++ ompi/mpi/cxx/intercomm.h | 3 +- ompi/mpi/cxx/intercomm_inln.h | 3 +- ompi/mpi/cxx/mpicxx.cc | 3 ++ ompi/mpi/cxx/mpicxx.h | 2 + ompi/mpi/cxx/topology.h | 3 +- ompi/mpi/cxx/topology_inln.h | 3 +- 13 files changed, 174 insertions(+), 11 deletions(-) diff --git a/ompi/mpi/cxx/comm.h b/ompi/mpi/cxx/comm.h index 469134eabe..9e9305a5f4 100644 --- a/ompi/mpi/cxx/comm.h +++ b/ompi/mpi/cxx/comm.h @@ -11,6 +11,7 @@ // 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) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -384,7 +385,7 @@ public: static Errhandler Create_errhandler(Comm::Errhandler_function* function); - virtual void Set_errhandler(const Errhandler& errhandler) const; + virtual void Set_errhandler(const Errhandler& errhandler); virtual Errhandler Get_errhandler() const; diff --git a/ompi/mpi/cxx/comm_inln.h b/ompi/mpi/cxx/comm_inln.h index b55da77f2a..cd829bb840 100644 --- a/ompi/mpi/cxx/comm_inln.h +++ b/ompi/mpi/cxx/comm_inln.h @@ -11,6 +11,7 @@ // 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) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -543,7 +544,7 @@ MPI::Comm::Get_errhandler() const } inline void -MPI::Comm::Set_errhandler(const MPI::Errhandler& errhandler) const +MPI::Comm::Set_errhandler(const MPI::Errhandler& errhandler) { (void)MPI_Comm_set_errhandler(mpi_comm, errhandler); } diff --git a/ompi/mpi/cxx/constants.h b/ompi/mpi/cxx/constants.h index 9dcdffe70f..fbe73c521d 100644 --- a/ompi/mpi/cxx/constants.h +++ b/ompi/mpi/cxx/constants.h @@ -11,6 +11,7 @@ // Copyright (c) 2004-2005 The Regents of the University of California. // All rights reserved. // Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -39,19 +40,41 @@ static const int ERR_OTHER = MPI_ERR_OTHER; static const int ERR_INTERN = MPI_ERR_INTERN; static const int ERR_PENDING = MPI_ERR_PENDING; static const int ERR_IN_STATUS = MPI_ERR_IN_STATUS; -static const int ERR_LASTCODE = MPI_ERR_LASTCODE; - +static const int ERR_ACCESS = MPI_ERR_ACCESS; +static const int ERR_AMODE = MPI_ERR_AMODE; +static const int ERR_ASSERT = MPI_ERR_ASSERT; +static const int ERR_BAD_FILE = MPI_ERR_BAD_FILE; static const int ERR_BASE = MPI_ERR_BASE; -static const int ERR_INFO_VALUE = MPI_ERR_INFO_VALUE; -static const int ERR_INFO_KEY = MPI_ERR_INFO_KEY; +static const int ERR_CONVERSION = MPI_ERR_CONVERSION; +static const int ERR_DISP = MPI_ERR_DISP; +static const int ERR_DUP_DATAREP = MPI_ERR_DUP_DATAREP; +static const int ERR_FILE_EXISTS = MPI_ERR_FILE_EXISTS; +static const int ERR_FILE_IN_USE = MPI_ERR_FILE_IN_USE; +static const int ERR_FILE = MPI_ERR_FILE; +static const int ERR_INFO_KEY = MPI_ERR_INFO_KEY;; static const int ERR_INFO_NOKEY = MPI_ERR_INFO_NOKEY; +static const int ERR_INFO_VALUE = MPI_ERR_INFO_VALUE; +static const int ERR_INFO = MPI_ERR_INFO; +static const int ERR_IO = MPI_ERR_IO; static const int ERR_KEYVAL = MPI_ERR_KEYVAL; +static const int ERR_LOCKTYPE = MPI_ERR_LOCKTYPE; static const int ERR_NAME = MPI_ERR_NAME; static const int ERR_NO_MEM = MPI_ERR_NO_MEM; +static const int ERR_NOT_SAME = MPI_ERR_NOT_SAME; +static const int ERR_NO_SPACE = MPI_ERR_NO_SPACE; +static const int ERR_NO_SUCH_FILE = MPI_ERR_NO_SUCH_FILE; +static const int ERR_PORT = MPI_ERR_PORT; +static const int ERR_QUOTA = MPI_ERR_QUOTA; +static const int ERR_READ_ONLY = MPI_ERR_READ_ONLY; +static const int ERR_RMA_CONFLICT = MPI_ERR_RMA_CONFLICT; +static const int ERR_RMA_SYNC = MPI_ERR_RMA_SYNC; static const int ERR_SERVICE = MPI_ERR_SERVICE; +static const int ERR_SIZE = MPI_ERR_SIZE; static const int ERR_SPAWN = MPI_ERR_SPAWN; +static const int ERR_UNSUPPORTED_DATAREP = MPI_ERR_UNSUPPORTED_DATAREP; +static const int ERR_UNSUPPORTED_OPERATION = MPI_ERR_UNSUPPORTED_OPERATION; static const int ERR_WIN = MPI_ERR_WIN; - +static const int ERR_LASTCODE = MPI_ERR_LASTCODE; // assorted constants OMPI_DECLSPEC extern void* const BOTTOM; @@ -136,12 +159,14 @@ OMPI_DECLSPEC extern const Datatype REAL8; // optional datatype (C / C++) OMPI_DECLSPEC extern const Datatype LONG_LONG; +OMPI_DECLSPEC extern const Datatype LONG_LONG_INT; OMPI_DECLSPEC extern const Datatype UNSIGNED_LONG_LONG; // c++ types OMPI_DECLSPEC extern const Datatype BOOL; OMPI_DECLSPEC extern const Datatype COMPLEX; OMPI_DECLSPEC extern const Datatype DOUBLE_COMPLEX; +OMPI_DECLSPEC extern const Datatype F_DOUBLE_COMPLEX; OMPI_DECLSPEC extern const Datatype LONG_DOUBLE_COMPLEX; // special datatypes for contstruction of derived datatypes diff --git a/ompi/mpi/cxx/datatype.h b/ompi/mpi/cxx/datatype.h index 21fa6ac79e..061173bca8 100644 --- a/ompi/mpi/cxx/datatype.h +++ b/ompi/mpi/cxx/datatype.h @@ -12,6 +12,7 @@ // All rights reserved. // Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved. // Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -148,6 +149,14 @@ public: virtual int Pack_size(int incount, const Comm& comm) const; + virtual void Pack_external(const char* datarep, const void* inbuf, int incount, + void* outbuf, Aint outsize, Aint& position) const; + + virtual Aint Pack_external_size(const char* datarep, int incount) const; + + virtual void Unpack_external(const char* datarep, const void* inbuf, + Aint insize, Aint& position, void* outbuf, int outcount) const; + // // Miscellany // @@ -156,6 +165,20 @@ public: const int array_of_starts[], int order) const; + virtual Datatype Create_darray(int size, int rank, int ndims, + const int array_of_gsizes[], const int array_of_distribs[], + const int array_of_dargs[], const int array_of_psizes[], + int order) const; + + // Language Binding + static Datatype Create_f90_complex(int p, int r); + + static Datatype Create_f90_integer(int r); + + static Datatype Create_f90_real(int p, int r); + + static Datatype Match_size(int typeclass, int size); + // // External Interfaces // diff --git a/ompi/mpi/cxx/datatype_inln.h b/ompi/mpi/cxx/datatype_inln.h index 018e514d79..610838daaf 100644 --- a/ompi/mpi/cxx/datatype_inln.h +++ b/ompi/mpi/cxx/datatype_inln.h @@ -11,6 +11,7 @@ // Copyright (c) 2004-2005 The Regents of the University of California. // All rights reserved. // Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // @@ -163,6 +164,29 @@ MPI::Datatype::Pack_size(int incount, const MPI::Comm& comm) const return size; } +inline void +MPI::Datatype::Pack_external(const char* datarep, const void* inbuf, int incount, + void* outbuf, MPI::Aint outsize, MPI::Aint& position) const +{ + (void)MPI_Pack_external(const_cast(datarep), const_cast(inbuf), + incount, mpi_datatype, outbuf, outsize, &position); +} + +inline MPI::Aint +MPI::Datatype::Pack_external_size(const char* datarep, int incount) const +{ + MPI_Aint addr; + (void)MPI_Pack_external_size(const_cast(datarep), incount, mpi_datatype, &addr); + return addr; +} + +inline void +MPI::Datatype::Unpack_external(const char* datarep, const void* inbuf, + MPI::Aint insize, MPI::Aint& position, void* outbuf, int outcount) const +{ + (void)MPI_Unpack_external(const_cast(datarep), const_cast(inbuf), + insize, &position, outbuf, outcount, mpi_datatype); +} // // Miscellany @@ -182,6 +206,53 @@ MPI::Datatype::Create_subarray(int ndims, const int array_of_sizes[], return type; } +inline MPI::Datatype +MPI::Datatype::Create_darray(int size, int rank, int ndims, + const int array_of_gsizes[], const int array_of_distribs[], + const int array_of_dargs[], const int array_of_psizes[], + int order) const +{ + MPI_Datatype type; + (void) MPI_Type_create_darray(size, rank, ndims, + const_cast(array_of_gsizes), + const_cast(array_of_distribs), + const_cast(array_of_dargs), + const_cast(array_of_psizes), + order, mpi_datatype, &type); + return type; +} + +inline MPI::Datatype +MPI::Datatype::Create_f90_complex(int p, int r) +{ + MPI_Datatype type; + (void) MPI_Type_create_f90_complex(p, r, &type); + return type; +} + +inline MPI::Datatype +MPI::Datatype::Create_f90_integer(int r) +{ + MPI_Datatype type; + (void) MPI_Type_create_f90_integer(r, &type); + return type; +} + +inline MPI::Datatype +MPI::Datatype::Create_f90_real(int p, int r) +{ + MPI_Datatype type; + (void) MPI_Type_create_f90_real(p, r, &type); + return type; +} + +inline MPI::Datatype +MPI::Datatype::Match_size(int typeclass, int size) +{ + MPI_Datatype type; + (void) MPI_Type_match_size(typeclass, size, &type); + return type; +} // // External Interfaces diff --git a/ompi/mpi/cxx/functions.h b/ompi/mpi/cxx/functions.h index 062bdc794e..a132496083 100644 --- a/ompi/mpi/cxx/functions.h +++ b/ompi/mpi/cxx/functions.h @@ -11,6 +11,7 @@ // Copyright (c) 2004-2005 The Regents of the University of California. // All rights reserved. // Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -39,6 +40,15 @@ Compute_dims(int nnodes, int ndims, int dims[]); // Environmental Inquiry // +int +Add_error_class(); + +int +Add_error_code(int errorclass); + +void +Add_error_string(int errorcode, const char* string); + void Get_processor_name(char* name, int& resultlen); diff --git a/ompi/mpi/cxx/functions_inln.h b/ompi/mpi/cxx/functions_inln.h index 3ee7a0c98d..0fd30c5fe4 100644 --- a/ompi/mpi/cxx/functions_inln.h +++ b/ompi/mpi/cxx/functions_inln.h @@ -11,6 +11,7 @@ // Copyright (c) 2004-2005 The Regents of the University of California. // All rights reserved. // Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -53,6 +54,28 @@ MPI::Compute_dims(int nnodes, int ndims, int dims[]) // Environmental Inquiry // +inline int +MPI::Add_error_class() +{ + int errcls; + (void)MPI_Add_error_class(&errcls); + return errcls; +} + +inline int +MPI::Add_error_code(int errorclass) +{ + int errcode; + (void)MPI_Add_error_code(errorclass, &errcode); + return errcode; +} + +inline void +MPI::Add_error_string(int errorcode, const char* string) +{ + (void)MPI_Add_error_string(errorcode, const_cast(string)); +} + inline void MPI::Get_processor_name(char* name, int& resultlen) { diff --git a/ompi/mpi/cxx/intercomm.h b/ompi/mpi/cxx/intercomm.h index 8858f188c7..7dbc855c72 100644 --- a/ompi/mpi/cxx/intercomm.h +++ b/ompi/mpi/cxx/intercomm.h @@ -11,6 +11,7 @@ // Copyright (c) 2004-2005 The Regents of the University of California. // All rights reserved. // Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -77,7 +78,7 @@ public: virtual Group Get_remote_group() const; - virtual Intracomm Merge(bool high); + virtual Intracomm Merge(bool high) const; virtual Intercomm Create(const Group& group) const; diff --git a/ompi/mpi/cxx/intercomm_inln.h b/ompi/mpi/cxx/intercomm_inln.h index cd8a410e60..658f75f53a 100644 --- a/ompi/mpi/cxx/intercomm_inln.h +++ b/ompi/mpi/cxx/intercomm_inln.h @@ -10,6 +10,7 @@ // University of Stuttgart. All rights reserved. // Copyright (c) 2004-2005 The Regents of the University of California. // All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -51,7 +52,7 @@ MPI::Intercomm::Get_remote_group() const } inline MPI::Intracomm -MPI::Intercomm::Merge(bool high) +MPI::Intercomm::Merge(bool high) const { MPI_Comm newcomm; (void)MPI_Intercomm_merge(mpi_comm, (int)high, &newcomm); diff --git a/ompi/mpi/cxx/mpicxx.cc b/ompi/mpi/cxx/mpicxx.cc index 35e5d8d04e..f40275cdf2 100644 --- a/ompi/mpi/cxx/mpicxx.cc +++ b/ompi/mpi/cxx/mpicxx.cc @@ -12,6 +12,7 @@ // All rights reserved. // Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved. // Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -102,11 +103,13 @@ const Datatype REAL8((MPI_Datatype)&(ompi_mpi_double)); // optional datatype (C / C++) const Datatype UNSIGNED_LONG_LONG(MPI_UNSIGNED_LONG_LONG); const Datatype LONG_LONG(MPI_LONG_LONG); +const Datatype LONG_LONG_INT(MPI_LONG_LONG_INT); // c++ types const Datatype BOOL((MPI_Datatype)&(ompi_mpi_cxx_bool)); const Datatype COMPLEX((MPI_Datatype)&(ompi_mpi_cxx_cplex)); const Datatype DOUBLE_COMPLEX((MPI_Datatype)&(ompi_mpi_cxx_dblcplex)); +const Datatype F_DOUBLE_COMPLEX((MPI_Datatype)&(ompi_mpi_cxx_dblcplex)); const Datatype LONG_DOUBLE_COMPLEX((MPI_Datatype)&(ompi_mpi_cxx_ldblcplex)); // reserved communicators diff --git a/ompi/mpi/cxx/mpicxx.h b/ompi/mpi/cxx/mpicxx.h index 4b12b5e9df..5aa22e9712 100644 --- a/ompi/mpi/cxx/mpicxx.h +++ b/ompi/mpi/cxx/mpicxx.h @@ -12,6 +12,7 @@ // All rights reserved. // Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. // Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -192,6 +193,7 @@ namespace MPI { #endif typedef MPI_Aint Aint; + typedef MPI_Fint Fint; typedef MPI_Offset Offset; #ifdef OMPI_BUILDING_CXX_BINDINGS_LIBRARY diff --git a/ompi/mpi/cxx/topology.h b/ompi/mpi/cxx/topology.h index c3f5340112..dee2632296 100644 --- a/ompi/mpi/cxx/topology.h +++ b/ompi/mpi/cxx/topology.h @@ -10,6 +10,7 @@ // University of Stuttgart. All rights reserved. // Copyright (c) 2004-2005 The Regents of the University of California. // All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -80,7 +81,7 @@ public: virtual void Shift(int direction, int disp, int &rank_source, int &rank_dest) const; - virtual Cartcomm Sub(const bool remain_dims[]); + virtual Cartcomm Sub(const bool remain_dims[]) const; virtual int Map(int ndims, const int dims[], const bool periods[]) const; diff --git a/ompi/mpi/cxx/topology_inln.h b/ompi/mpi/cxx/topology_inln.h index c44d74b7d2..3bdbab2ddc 100644 --- a/ompi/mpi/cxx/topology_inln.h +++ b/ompi/mpi/cxx/topology_inln.h @@ -11,6 +11,7 @@ // Copyright (c) 2004-2005 The Regents of the University of California. // All rights reserved. // Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. +// Copyright (c) 2011 FUJITSU LIMITED. All rights reserved. // $COPYRIGHT$ // // Additional copyrights may follow @@ -99,7 +100,7 @@ MPI::Cartcomm::Shift(int direction, int disp, } inline MPI::Cartcomm -MPI::Cartcomm::Sub(const bool remain_dims[]) +MPI::Cartcomm::Sub(const bool remain_dims[]) const { int ndims; MPI_Cartdim_get(mpi_comm, &ndims);