Commit da48c095 authored by Marco Agnese's avatar Marco Agnese Committed by Steffen Müthing

remove MPI deprectated methods

(cherry picked from commit 47830f03)
Signed-off-by: Steffen Müthing's avatarSteffen Müthing <muething@dune-project.org>
parent fc742161
......@@ -419,13 +419,8 @@ namespace Dune
{
IndexedTypeInformation& info=information_[proc];
assert((info.elements)<info.size);
#if MPI_2
MPI_Get_address( const_cast<void*>(CommPolicy<V>::getAddress(data_, local)),
info.displ+info.elements);
#else
MPI_Address( const_cast<void*>(CommPolicy<V>::getAddress(data_, local)),
info.displ+info.elements);
#endif
info.length[info.elements]=CommPolicy<V>::getSize(data_, local);
info.elements++;
}
......@@ -980,9 +975,7 @@ namespace Dune
for(iterator process = messageTypes.begin(); process != end; ++process) {
MPI_Datatype *type = &(process->second.first);
int finalized=0;
#if MPI_2
MPI_Finalized(&finalized);
#endif
if(*type!=MPI_DATATYPE_NULL && !finalized)
MPI_Type_free(type);
type = &(process->second.second);
......@@ -1011,11 +1004,7 @@ namespace Dune
IndexedTypeInformation& info=dataInfo.information_[process->first];
// Shift the displacement
MPI_Aint base;
#if MPI_2
MPI_Get_address(const_cast<void *>(CommPolicy<V>::getAddress(data, 0)), &base);
#else
MPI_Address(const_cast<void *>(CommPolicy<V>::getAddress(data, 0)), &base);
#endif
for(int i=0; i< info.elements; i++) {
info.displ[i]-=base;
......
......@@ -640,28 +640,15 @@ namespace Dune
// Compute displacement
MessageInformation message;
#if MPI_2
MPI_Get_address( &(message.publish), displacement);
MPI_Get_address( &(message.pairs), displacement+1);
#else
MPI_Address( &(message.publish), displacement);
MPI_Address( &(message.pairs), displacement+1);
#endif
// Make the displacement relative
#if MPI_2
MPI_Get_address(&message, &base);
#else
MPI_Address(&message, &base);
#endif
displacement[0] -= base;
displacement[1] -= base;
#if MPI_2
MPI_Type_create_struct( 2, blocklength, displacement, type, &datatype_);
#else
MPI_Type_struct( 2, blocklength, displacement, type, &datatype_);
#endif
MPI_Type_commit(&datatype_);
}
......
......@@ -238,11 +238,9 @@ namespace Dune
//! \brief calls MPI_Init with argc and argv as parameters
MPIHelper(int& argc, char**& argv)
{
#if MPI_2
int wasInitialized = -1;
MPI_Initialized( &wasInitialized );
if(!wasInitialized)
#endif
{
rank_ = -1;
size_ = -1;
......@@ -261,17 +259,13 @@ namespace Dune
//! \brief calls MPI_Finalize
~MPIHelper()
{
#if MPI_2
int wasFinalized = -1;
MPI_Finalized( &wasFinalized );
if(!wasFinalized) {
#endif
MPI_Finalize();
dverb << "Called MPI_Finalize on p=" << rank_ << "!" <<std::endl;
#if MPI_2
}
#endif
}
MPIHelper(const MPIHelper&);
MPIHelper& operator=(const MPIHelper);
......
......@@ -97,21 +97,12 @@ namespace Dune
FieldVector<K,n> fvector;
MPI_Aint base;
MPI_Aint displ;
#if MPI_2
MPI_Get_address(&fvector, &base);
MPI_Get_address(&(fvector[0]), &displ);
#else
MPI_Address(&fvector, &base);
MPI_Address(&(fvector[0]), &displ);
#endif
displ -= base;
int length[1]={1};
#if MPI_2
MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);
#else
MPI_Type_struct(1, length, &displ, &vectortype, &datatype);
#endif
MPI_Type_commit(&datatype);
}
return datatype;
......@@ -143,20 +134,11 @@ namespace Dune
bigunsignedint<k> data;
MPI_Aint base;
MPI_Aint displ;
#if MPI_2
MPI_Get_address(&data, &base);
MPI_Get_address(&(data.digit), &displ);
#else
MPI_Address(&data, &base);
MPI_Address(&(data.digit), &displ);
#endif
displ -= base;
int length[1]={1};
#if MPI_2
MPI_Type_create_struct(1, length, &displ, &vectortype, &datatype);
#else
MPI_Type_struct(1, length, &displ, &vectortype, &datatype);
#endif
MPI_Type_commit(&datatype);
}
return datatype;
......@@ -189,24 +171,13 @@ namespace Dune
MPITraits<T2>::getType(), MPI_UB};
std::pair<T1,T2> rep[2];
length[0]=length[1]=length[2]=length[3]=1;
#if MPI_2
MPI_Get_address(rep, disp); // lower bound of the datatype
MPI_Get_address(&(rep[0].first), disp+1);
MPI_Get_address(&(rep[0].second), disp+2);
MPI_Get_address(rep+1, disp+3); // upper bound of the datatype
#else
MPI_Address(rep, disp); // lower bound of the datatype
MPI_Address(&(rep[0].first), disp+1);
MPI_Address(&(rep[0].second), disp+2);
MPI_Address(rep+1, disp+3); // upper bound of the datatype
#endif
for(int i=3; i >= 0; --i)
disp[i] -= disp[0];
#if MPI_2
MPI_Type_create_struct(4, length, disp, types, &type);
#else
MPI_Type_struct(4, length, disp, types, &type);
#endif
MPI_Type_commit(&type);
}
return type;
......
......@@ -294,22 +294,12 @@ namespace Dune
MPI_Datatype types[3] = {MPI_LB, MPITraits<char>::getType(), MPI_UB};
ParallelLocalIndex<T> rep[2];
length[0]=length[1]=length[2]=1;
#if MPI_2
MPI_Get_address(rep, disp); // lower bound of the datatype
MPI_Get_address(&(rep[0].attribute_), disp+1);
MPI_Get_address(rep+1, disp+2); // upper bound of the datatype
#else
MPI_Address(rep, disp); // lower bound of the datatype
MPI_Address(&(rep[0].attribute_), disp+1);
MPI_Address(rep+1, disp+2); // upper bound of the datatype
#endif
for(int i=2; i >= 0; --i)
disp[i] -= disp[0];
#if MPI_2
MPI_Type_create_struct(3, length, disp, types, &type);
#else
MPI_Type_struct(3, length, disp, types, &type);
#endif
MPI_Type_commit(&type);
}
return type;
......
......@@ -891,24 +891,13 @@ namespace Dune {
MPITraits<ParallelLocalIndex<TA> >::getType(), MPI_UB};
IndexPair<TG,ParallelLocalIndex<TA> > rep[2];
length[0]=length[1]=length[2]=length[3]=1;
#if MPI_2
MPI_Get_address(rep, disp); // lower bound of the datatype
MPI_Get_address(&(rep[0].global_), disp+1);
MPI_Get_address(&(rep[0].local_), disp+2);
MPI_Get_address(rep+1, disp+3); // upper bound of the datatype
#else
MPI_Address(rep, disp); // lower bound of the datatype
MPI_Address(&(rep[0].global_), disp+1);
MPI_Address(&(rep[0].local_), disp+2);
MPI_Address(rep+1, disp+3); // upper bound of the datatype
#endif
for(int i=3; i >= 0; --i)
disp[i] -= disp[0];
#if MPI_2
MPI_Type_create_struct(4, length, disp, types, &type);
#else
MPI_Type_struct(4, length, disp, types, &type);
#endif
MPI_Type_commit(&type);
}
return type;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment