Fix some more const_cast issues. Thanks to Martin Audet for helping
with this. This commit was SVN r8516.
Этот коммит содержится в:
родитель
25b2730a34
Коммит
4379be6edc
2
NEWS
2
NEWS
@ -29,6 +29,8 @@ version 1.0.
|
|||||||
1.0.2
|
1.0.2
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Fixed some more C++ const_cast<> issues. Thanks for Martin Audet
|
||||||
|
(again) for bringing this to our attention.
|
||||||
- Updated ROMIO with the version from MPICH 1.2.7p1, marked as version
|
- Updated ROMIO with the version from MPICH 1.2.7p1, marked as version
|
||||||
2005-06-09.
|
2005-06-09.
|
||||||
- Fixes for some cases where the use of MPI_BOTTOM could cause
|
- Fixes for some cases where the use of MPI_BOTTOM could cause
|
||||||
|
@ -124,7 +124,7 @@ public:
|
|||||||
#if ! 0 /* OMPI_ENABLE_MPI_PROFILING */
|
#if ! 0 /* OMPI_ENABLE_MPI_PROFILING */
|
||||||
// $%%@#%# AIX/POE 2.3.0.0 makes us put in this cast here
|
// $%%@#%# AIX/POE 2.3.0.0 makes us put in this cast here
|
||||||
(void)MPI_Errhandler_create((MPI_Handler_function*) &ompi_mpi_cxx_throw_excptn_fctn,
|
(void)MPI_Errhandler_create((MPI_Handler_function*) &ompi_mpi_cxx_throw_excptn_fctn,
|
||||||
(MPI_Errhandler *) &mpi_errhandler);
|
const_cast<MPI_Errhandler *> &mpi_errhandler);
|
||||||
#else
|
#else
|
||||||
pmpi_errhandler.init();
|
pmpi_errhandler.init();
|
||||||
#endif
|
#endif
|
||||||
@ -134,7 +134,7 @@ public:
|
|||||||
//this is called from MPI::Finalize
|
//this is called from MPI::Finalize
|
||||||
inline void free() const {
|
inline void free() const {
|
||||||
#if ! 0 /* OMPI_ENABLE_MPI_PROFILING */
|
#if ! 0 /* OMPI_ENABLE_MPI_PROFILING */
|
||||||
(void)MPI_Errhandler_free((MPI_Errhandler *) &mpi_errhandler);
|
(void)MPI_Errhandler_free(const_cast<MPI_Errhandler *> &mpi_errhandler);
|
||||||
#else
|
#else
|
||||||
pmpi_errhandler.free();
|
pmpi_errhandler.free();
|
||||||
#endif
|
#endif
|
||||||
|
@ -228,6 +228,12 @@ protected:
|
|||||||
PMPI::Intracomm pmpi_comm;
|
PMPI::Intracomm pmpi_comm;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Convert an array of p_nbr Info object into an array of MPI_Info.
|
||||||
|
// A pointer to the allocated array is returned and must be
|
||||||
|
// eventually deleted.
|
||||||
|
static inline MPI_Info *convert_info_to_mpi_info(int p_nbr,
|
||||||
|
const Info p_info_tbl[]);
|
||||||
|
|
||||||
public: // JGS see above about friend decls
|
public: // JGS see above about friend decls
|
||||||
#if ! 0 /* OMPI_ENABLE_MPI_PROFILING */
|
#if ! 0 /* OMPI_ENABLE_MPI_PROFILING */
|
||||||
static Op* current_op;
|
static Op* current_op;
|
||||||
|
@ -144,13 +144,25 @@ MPI::Intracomm::Alltoallw(const void *sendbuf, const int sendcounts[],
|
|||||||
void *recvbuf, const int recvcounts[],
|
void *recvbuf, const int recvcounts[],
|
||||||
const int rdispls[], const Datatype recvtypes[]) const
|
const int rdispls[], const Datatype recvtypes[]) const
|
||||||
{
|
{
|
||||||
(void)MPI_Alltoallw(const_cast<void *>(sendbuf),
|
const int comm_size = Get_size();
|
||||||
const_cast<int *>(sendcounts),
|
MPI_Datatype *const data_type_tbl = new MPI_Datatype [2*comm_size];
|
||||||
const_cast<int *>(sdispls),
|
|
||||||
(MPI_Datatype *)(sendtypes), recvbuf,
|
// This must be done because MPI::Datatype arrays cannot be
|
||||||
const_cast<int *>(recvcounts),
|
// converted directly into MPI_Datatype arrays.
|
||||||
const_cast<int *>(rdispls),
|
for (int i_rank=0; i_rank < comm_size; i_rank++) {
|
||||||
(MPI_Datatype *)(recvtypes), mpi_comm);
|
data_type_tbl[i_rank] = sendtypes[i_rank];
|
||||||
|
data_type_tbl[i_rank + comm_size] = recvtypes[i_rank];
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)MPI_Alltoallw(const_cast<void *>(sendbuf),
|
||||||
|
const_cast<int *>(sendcounts),
|
||||||
|
const_cast<int *>(sdispls),
|
||||||
|
data_type_tbl, recvbuf,
|
||||||
|
const_cast<int *>(recvcounts),
|
||||||
|
const_cast<int *>(rdispls),
|
||||||
|
data_type_tbl[comm_size], mpi_comm);
|
||||||
|
|
||||||
|
delete[] data_type_tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
@ -158,7 +170,7 @@ MPI::Intracomm::Reduce(const void *sendbuf, void *recvbuf, int count,
|
|||||||
const MPI::Datatype & datatype, const MPI::Op& op,
|
const MPI::Datatype & datatype, const MPI::Op& op,
|
||||||
int root) const
|
int root) const
|
||||||
{
|
{
|
||||||
current_op = (MPI::Op*)&op;
|
current_op = const_cast<MPI::Op*>(&op);
|
||||||
(void)MPI_Reduce(const_cast<void *>(sendbuf), recvbuf, count, datatype, op, root, mpi_comm);
|
(void)MPI_Reduce(const_cast<void *>(sendbuf), recvbuf, count, datatype, op, root, mpi_comm);
|
||||||
current_op = (Op*)0;
|
current_op = (Op*)0;
|
||||||
}
|
}
|
||||||
@ -167,7 +179,7 @@ inline void
|
|||||||
MPI::Intracomm::Allreduce(const void *sendbuf, void *recvbuf, int count,
|
MPI::Intracomm::Allreduce(const void *sendbuf, void *recvbuf, int count,
|
||||||
const MPI::Datatype & datatype, const MPI::Op& op) const
|
const MPI::Datatype & datatype, const MPI::Op& op) const
|
||||||
{
|
{
|
||||||
current_op = (MPI::Op*)&op;
|
current_op = const_cast<MPI::Op*>(&op);
|
||||||
(void)MPI_Allreduce (const_cast<void *>(sendbuf), recvbuf, count, datatype, op, mpi_comm);
|
(void)MPI_Allreduce (const_cast<void *>(sendbuf), recvbuf, count, datatype, op, mpi_comm);
|
||||||
current_op = (Op*)0;
|
current_op = (Op*)0;
|
||||||
}
|
}
|
||||||
@ -178,7 +190,7 @@ MPI::Intracomm::Reduce_scatter(const void *sendbuf, void *recvbuf,
|
|||||||
const MPI::Datatype & datatype,
|
const MPI::Datatype & datatype,
|
||||||
const MPI::Op& op) const
|
const MPI::Op& op) const
|
||||||
{
|
{
|
||||||
current_op = (MPI::Op*)&op;
|
current_op = const_cast<MPI::Op*>(&op);
|
||||||
(void)MPI_Reduce_scatter(const_cast<void *>(sendbuf), recvbuf, recvcounts,
|
(void)MPI_Reduce_scatter(const_cast<void *>(sendbuf), recvbuf, recvcounts,
|
||||||
datatype, op, mpi_comm);
|
datatype, op, mpi_comm);
|
||||||
current_op = (Op*)0;
|
current_op = (Op*)0;
|
||||||
@ -188,7 +200,7 @@ inline void
|
|||||||
MPI::Intracomm::Scan(const void *sendbuf, void *recvbuf, int count,
|
MPI::Intracomm::Scan(const void *sendbuf, void *recvbuf, int count,
|
||||||
const MPI::Datatype & datatype, const MPI::Op& op) const
|
const MPI::Datatype & datatype, const MPI::Op& op) const
|
||||||
{
|
{
|
||||||
current_op = (MPI::Op*)&op;
|
current_op = const_cast<MPI::Op*>(&op);
|
||||||
(void)MPI_Scan(const_cast<void *>(sendbuf), recvbuf, count, datatype, op, mpi_comm);
|
(void)MPI_Scan(const_cast<void *>(sendbuf), recvbuf, count, datatype, op, mpi_comm);
|
||||||
current_op = (Op*)0;
|
current_op = (Op*)0;
|
||||||
}
|
}
|
||||||
@ -198,7 +210,7 @@ MPI::Intracomm::Exscan(const void *sendbuf, void *recvbuf, int count,
|
|||||||
const MPI::Datatype & datatype,
|
const MPI::Datatype & datatype,
|
||||||
const MPI::Op& op) const
|
const MPI::Op& op) const
|
||||||
{
|
{
|
||||||
current_op = (MPI::Op*)&op;
|
current_op = const_cast<MPI::Op*>(&op);
|
||||||
(void)MPI_Exscan(const_cast<void *>(sendbuf), recvbuf, count, datatype, op, mpi_comm);
|
(void)MPI_Exscan(const_cast<void *>(sendbuf), recvbuf, count, datatype, op, mpi_comm);
|
||||||
current_op = (Op*)0;
|
current_op = (Op*)0;
|
||||||
}
|
}
|
||||||
@ -337,13 +349,29 @@ MPI::Intracomm::Spawn_multiple(int count,
|
|||||||
const Info array_of_info[], int root)
|
const Info array_of_info[], int root)
|
||||||
{
|
{
|
||||||
MPI_Comm newcomm;
|
MPI_Comm newcomm;
|
||||||
|
MPI_Info *const array_of_mpi_info =
|
||||||
|
convert_info_to_mpi_info(count, array_of_info);
|
||||||
|
|
||||||
MPI_Comm_spawn_multiple(count, const_cast<char **>(array_of_commands),
|
MPI_Comm_spawn_multiple(count, const_cast<char **>(array_of_commands),
|
||||||
const_cast<char ***>(array_of_argv), const_cast<int *>(array_of_maxprocs),
|
const_cast<char ***>(array_of_argv),
|
||||||
(MPI_Info *) array_of_info, root,
|
const_cast<int *>(array_of_maxprocs),
|
||||||
|
array_of_mpi_info, root,
|
||||||
mpi_comm, &newcomm, (int *)MPI_ERRCODES_IGNORE);
|
mpi_comm, &newcomm, (int *)MPI_ERRCODES_IGNORE);
|
||||||
|
delete[] array_of_mpi_info;
|
||||||
return newcomm;
|
return newcomm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline MPI_Info *
|
||||||
|
MPI::Intracomm::convert_info_to_mpi_info(int p_nbr, const Info p_info_tbl[])
|
||||||
|
{
|
||||||
|
MPI_Info *const mpi_info_tbl = new MPI_Info [p_nbr];
|
||||||
|
|
||||||
|
for (int i_tbl=0; i_tbl < p_nbr; i_tbl++) {
|
||||||
|
mpi_info_tbl[i_tbl] = p_info_tbl[i_tbl];
|
||||||
|
}
|
||||||
|
|
||||||
|
return mpi_info_tbl;
|
||||||
|
}
|
||||||
|
|
||||||
inline MPI::Intercomm
|
inline MPI::Intercomm
|
||||||
MPI::Intracomm::Spawn_multiple(int count,
|
MPI::Intracomm::Spawn_multiple(int count,
|
||||||
@ -354,10 +382,15 @@ MPI::Intracomm::Spawn_multiple(int count,
|
|||||||
int array_of_errcodes[])
|
int array_of_errcodes[])
|
||||||
{
|
{
|
||||||
MPI_Comm newcomm;
|
MPI_Comm newcomm;
|
||||||
|
MPI_Info *const array_of_mpi_info =
|
||||||
|
convert_info_to_mpi_info(count, array_of_info);
|
||||||
|
|
||||||
MPI_Comm_spawn_multiple(count, const_cast<char **>(array_of_commands),
|
MPI_Comm_spawn_multiple(count, const_cast<char **>(array_of_commands),
|
||||||
const_cast<char ***>(array_of_argv), const_cast<int *>(array_of_maxprocs),
|
const_cast<char ***>(array_of_argv),
|
||||||
(MPI_Info *) array_of_info, root,
|
const_cast<int *>(array_of_maxprocs),
|
||||||
|
array_of_mpi_info, root,
|
||||||
mpi_comm, &newcomm, array_of_errcodes);
|
mpi_comm, &newcomm, array_of_errcodes);
|
||||||
|
delete[] array_of_mpi_info;
|
||||||
return newcomm;
|
return newcomm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user