This is a workaround to bug in the Intel C++ compiler, version 9.1
(all versions up to and including 20060925). The issue has been reported to Intel, along with a small [non-MPI] test program that reproduces the problem (the test program and the OMPI C++ bindings work fine with Intel C++ 9.0 and many other C++ compilers). In short, a static initializer for a global variable (i.e., its constructor is fired before main()) that takes as an argument a reference to a typedef'd type will simply get the wrong value in the argument. Specifically: {{{ namespace MPI { Intracomm COMM_WORLD(MPI_COMM_WORLD); } }}} The constructor for MPI::Intracomm should get the value of &ompi_mpi_comm_world. It does not; it seems to get a random value. As mandated by MPI-2, annex B.13.4, for C/C++ interoperability, the prototype for this constructor is: {{{ class Intracomm { public: Intracomm(const MPI_Comm& data); }; }}} Experiments with icpc 9.1/20060925 have shown that removing the reference from the prototype makes it work (!). After lots of discussions about this issue with a C++ expert (Doug Gregor from IU), we decided the following (cut-n-paste from an e-mail): ----- > So here's my question: given that OMPI's MPI_<CLASS> types are all > pointers, is there any legal MPI program that adheres to the above > bindings that would fail to compile or work properly if we simply > removed the "&" from the second binding, above? I don't know of any way that a program could detect this change. FWIW, the C++ committee has agreed that implementation of the C++ standard library are allowed to decide arbitrarily between const& and by-value. If they don't care, MPI users won't care. When you remove the '&', I suggest also removing the "const". It is redundant, but can trigger some strange name mangling in Sun's C++ compiler. ----- So with this change: * we now work again with the Intel 9.1 compiler * our C++ bindings do not exactly conform to the MPI-2 spec, but valid/legal MPI C++ apps cannot tell the difference (i.e., the functionality is the same) This commit was SVN r12514.
Этот коммит содержится в:
родитель
a14ff905f8
Коммит
0a28212392
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -30,7 +31,7 @@ public:
|
||||
// copy
|
||||
inline Comm_Null(const Comm_Null& data) : pmpi_comm(data.pmpi_comm) { }
|
||||
// inter-language operability
|
||||
inline Comm_Null(const MPI_Comm& data) : pmpi_comm(data) { }
|
||||
inline Comm_Null(MPI_Comm data) : pmpi_comm(data) { }
|
||||
|
||||
inline Comm_Null(const PMPI::Comm_Null& data) : pmpi_comm(data) { }
|
||||
|
||||
@ -61,7 +62,7 @@ public:
|
||||
// copy
|
||||
inline Comm_Null(const Comm_Null& data) : mpi_comm(data.mpi_comm) { }
|
||||
// inter-language operability
|
||||
inline Comm_Null(const MPI_Comm& data) : mpi_comm(data) { }
|
||||
inline Comm_Null(MPI_Comm data) : mpi_comm(data) { }
|
||||
|
||||
// destruction
|
||||
virtual inline ~Comm_Null() { }
|
||||
@ -121,7 +122,7 @@ public:
|
||||
pmpi_comm((const PMPI::Comm&) data) { }
|
||||
|
||||
// inter-language operability
|
||||
Comm(const MPI_Comm& data) : Comm_Null(data), pmpi_comm(data) { }
|
||||
Comm(MPI_Comm data) : Comm_Null(data), pmpi_comm(data) { }
|
||||
|
||||
Comm(const PMPI::Comm& data) :
|
||||
Comm_Null((const PMPI::Comm_Null&)data),
|
||||
@ -151,7 +152,7 @@ public:
|
||||
#else
|
||||
Comm(const Comm& data) : Comm_Null(data.mpi_comm) { }
|
||||
// inter-language operability
|
||||
Comm(const MPI_Comm& data) : Comm_Null(data) { }
|
||||
Comm(MPI_Comm data) : Comm_Null(data) { }
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
// Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
// Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -31,7 +32,7 @@ public:
|
||||
inline Datatype() { }
|
||||
|
||||
// inter-language operability
|
||||
inline Datatype(const MPI_Datatype &i) : pmpi_datatype(i) { }
|
||||
inline Datatype(MPI_Datatype i) : pmpi_datatype(i) { }
|
||||
|
||||
// copy / assignment
|
||||
inline Datatype(const Datatype& dt) : pmpi_datatype(dt.pmpi_datatype) { }
|
||||
@ -67,7 +68,7 @@ public:
|
||||
inline Datatype() : mpi_datatype(MPI_DATATYPE_NULL) { }
|
||||
inline virtual ~Datatype() {}
|
||||
// inter-language operability
|
||||
inline Datatype(const MPI_Datatype &i) : mpi_datatype(i) { }
|
||||
inline Datatype(MPI_Datatype i) : mpi_datatype(i) { }
|
||||
|
||||
// copy / assignment
|
||||
inline Datatype(const Datatype& dt) : mpi_datatype(dt.mpi_datatype) { }
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -27,7 +28,7 @@ public:
|
||||
|
||||
inline virtual ~Errhandler() { }
|
||||
|
||||
inline Errhandler(const MPI_Errhandler &i)
|
||||
inline Errhandler(MPI_Errhandler i)
|
||||
: pmpi_errhandler(i) { }
|
||||
|
||||
// copy / assignment
|
||||
@ -65,7 +66,7 @@ public:
|
||||
|
||||
inline virtual ~Errhandler() { }
|
||||
|
||||
inline Errhandler(const MPI_Errhandler &i)
|
||||
inline Errhandler(MPI_Errhandler i)
|
||||
: mpi_errhandler(i) {}
|
||||
|
||||
// copy / assignment
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -36,7 +37,7 @@ public:
|
||||
// copy / assignment
|
||||
File(const File& data) : pmpi_file(data.pmpi_file) { }
|
||||
|
||||
File(const MPI_File &i) : pmpi_file(i) { }
|
||||
File(MPI_File i) : pmpi_file(i) { }
|
||||
|
||||
File& operator=(const File& data) {
|
||||
pmpi_file = data.pmpi_file; return *this; }
|
||||
@ -56,7 +57,7 @@ public:
|
||||
// copy
|
||||
File(const File& data) : mpi_file(data.mpi_file) { }
|
||||
|
||||
File(const MPI_File &i) : mpi_file(i) { }
|
||||
File(MPI_File i) : mpi_file(i) { }
|
||||
|
||||
virtual ~File() { }
|
||||
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -27,7 +28,7 @@ public:
|
||||
|
||||
// construction
|
||||
inline Group() { }
|
||||
inline Group(const MPI_Group &i) : pmpi_group(i) { }
|
||||
inline Group(MPI_Group i) : pmpi_group(i) { }
|
||||
// copy
|
||||
inline Group(const Group& g) : pmpi_group(g.pmpi_group) { }
|
||||
|
||||
@ -58,7 +59,7 @@ public:
|
||||
|
||||
// construction
|
||||
inline Group() : mpi_group(MPI_GROUP_NULL) { }
|
||||
inline Group(const MPI_Group &i) : mpi_group(i) { }
|
||||
inline Group(MPI_Group i) : mpi_group(i) { }
|
||||
|
||||
// copy
|
||||
inline Group(const Group& g) : mpi_group(g.mpi_group) { }
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -36,7 +37,7 @@ public:
|
||||
// copy / assignment
|
||||
Info(const Info& data) : pmpi_info(data.pmpi_info) { }
|
||||
|
||||
Info(const MPI_Info &i) : pmpi_info(i) { }
|
||||
Info(MPI_Info i) : pmpi_info(i) { }
|
||||
|
||||
Info& operator=(const Info& data) {
|
||||
pmpi_info = data.pmpi_info; return *this; }
|
||||
@ -57,7 +58,7 @@ public:
|
||||
// copy
|
||||
Info(const Info& data) : mpi_info(data.mpi_info) { }
|
||||
|
||||
Info(const MPI_Info &i) : mpi_info(i) { }
|
||||
Info(MPI_Info i) : mpi_info(i) { }
|
||||
|
||||
virtual ~Info() {}
|
||||
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -29,7 +30,7 @@ public:
|
||||
// copy
|
||||
Intercomm(const Comm_Null& data) : Comm(data) { }
|
||||
// inter-language operability
|
||||
Intercomm(const MPI_Comm& data) : Comm(data) { }
|
||||
Intercomm(MPI_Comm data) : Comm(data) { }
|
||||
|
||||
#if 0 /* OMPI_ENABLE_MPI_PROFILING */
|
||||
// copy
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -35,7 +36,7 @@ public:
|
||||
// into account.
|
||||
Intracomm(const Intracomm& data) : Comm(data), pmpi_comm(data) { }
|
||||
|
||||
Intracomm(const MPI_Comm& data) : Comm(data), pmpi_comm(data) { }
|
||||
Intracomm(MPI_Comm data) : Comm(data), pmpi_comm(data) { }
|
||||
|
||||
Intracomm(const PMPI::Intracomm& data)
|
||||
: Comm((const PMPI::Comm&)data), pmpi_comm(data) { }
|
||||
@ -60,7 +61,7 @@ public:
|
||||
#else
|
||||
Intracomm(const Intracomm& data) : Comm(data.mpi_comm) { }
|
||||
|
||||
inline Intracomm(const MPI_Comm& data);
|
||||
inline Intracomm(MPI_Comm data);
|
||||
|
||||
// assignment
|
||||
Intracomm& operator=(const Intracomm& data) {
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -18,7 +19,7 @@
|
||||
//
|
||||
|
||||
inline
|
||||
MPI::Intracomm::Intracomm(const MPI_Comm& data) {
|
||||
MPI::Intracomm::Intracomm(MPI_Comm data) {
|
||||
int flag;
|
||||
if (MPI::Is_initialized() && (data != MPI_COMM_NULL)) {
|
||||
(void)MPI_Comm_test_inter(data, &flag);
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -22,7 +23,7 @@ public:
|
||||
|
||||
// construction
|
||||
Op();
|
||||
Op(const MPI_Op &i);
|
||||
Op(MPI_Op i);
|
||||
Op(const Op& op);
|
||||
#if 0 /* OMPI_ENABLE_MPI_PROFILING */
|
||||
Op(const PMPI::Op& op) : pmpi_op(op) { }
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -26,7 +27,7 @@ inline
|
||||
MPI::Op::Op(const MPI::Op& o) : pmpi_op(o.pmpi_op) { }
|
||||
|
||||
inline
|
||||
MPI::Op::Op(const MPI_Op& o) : pmpi_op(o) { }
|
||||
MPI::Op::Op(MPI_Op o) : pmpi_op(o) { }
|
||||
|
||||
inline
|
||||
MPI::Op::~Op() { }
|
||||
@ -65,7 +66,7 @@ inline
|
||||
MPI::Op::Op() : mpi_op(MPI_OP_NULL) { }
|
||||
|
||||
inline
|
||||
MPI::Op::Op(const MPI_Op &i) : mpi_op(i) { }
|
||||
MPI::Op::Op(MPI_Op i) : mpi_op(i) { }
|
||||
|
||||
inline
|
||||
MPI::Op::Op(const MPI::Op& op)
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -27,7 +28,7 @@ public:
|
||||
|
||||
// construction
|
||||
Request() { }
|
||||
Request(const MPI_Request &i) : pmpi_request(i) { }
|
||||
Request(MPI_Request i) : pmpi_request(i) { }
|
||||
|
||||
// copy / assignment
|
||||
Request(const Request& r) : pmpi_request(r.pmpi_request) { }
|
||||
@ -58,7 +59,7 @@ public:
|
||||
// construction / destruction
|
||||
Request() { mpi_request = MPI_REQUEST_NULL; }
|
||||
virtual ~Request() {}
|
||||
Request(const MPI_Request &i) : mpi_request(i) { }
|
||||
Request(MPI_Request i) : mpi_request(i) { }
|
||||
|
||||
// copy / assignment
|
||||
Request(const Request& r) : mpi_request(r.mpi_request) { }
|
||||
|
@ -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) 2006 Cisco Systems, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -36,7 +37,7 @@ public:
|
||||
// copy / assignment
|
||||
Win(const Win& data) : pmpi_win(data.pmpi_win) { }
|
||||
|
||||
Win(const MPI_Win &i) : pmpi_win(i) { }
|
||||
Win(MPI_Win i) : pmpi_win(i) { }
|
||||
|
||||
Win& operator=(const Win& data) {
|
||||
pmpi_win = data.pmpi_win; return *this; }
|
||||
@ -56,7 +57,7 @@ public:
|
||||
// copy
|
||||
Win(const Win& data) : mpi_win(data.mpi_win) { }
|
||||
|
||||
Win(const MPI_Win &i) : mpi_win(i) { }
|
||||
Win(MPI_Win i) : mpi_win(i) { }
|
||||
|
||||
virtual ~Win() { }
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user