Commit aafd52ee authored by Praetorius, Simon's avatar Praetorius, Simon

changed type-traits since problems with bullxmpi

parent df8bb4b4
......@@ -10,14 +10,14 @@ namespace mpi14
REQUIRES( is_mpi_type<T> )>
void all_reduce(Communicator& comm, T const& in, T& out, Operation)
{
MPI_Allreduce(&in, &out, 1, type_to_mpi<T>, op_to_mpi<Operation>, comm);
MPI_Allreduce(&in, &out, 1, type_to_mpi<T>(), op_to_mpi<Operation>(), comm);
}
template <class T, class Operation,
REQUIRES( is_mpi_type<T> )>
void all_reduce(Communicator& comm, T& inout, Operation)
{
MPI_Allreduce(MPI_IN_PLACE, &inout, 1, type_to_mpi<T>, op_to_mpi<Operation>, comm);
MPI_Allreduce(MPI_IN_PLACE, &inout, 1, type_to_mpi<T>(), op_to_mpi<Operation>(), comm);
}
} // end namespace mpi14
......@@ -41,25 +41,25 @@ namespace mpi14
static_assert( mpi14::is_mpi_type<T>, "Type is not an MPI Datatype!" );
};
template <> struct type_to_mpi<char> { static constexpr MPI_Datatype value = MPI_CHAR; };
template <> struct type_to_mpi<short> { static constexpr MPI_Datatype value = MPI_SHORT; };
template <> struct type_to_mpi<int> { static constexpr MPI_Datatype value = MPI_INT; };
template <> struct type_to_mpi<long> { static constexpr MPI_Datatype value = MPI_LONG; };
template <> struct type_to_mpi<long long> { static constexpr MPI_Datatype value = MPI_LONG_LONG; };
template <> struct type_to_mpi<signed char> { static constexpr MPI_Datatype value = MPI_SIGNED_CHAR; };
template <> struct type_to_mpi<unsigned char> { static constexpr MPI_Datatype value = MPI_UNSIGNED_CHAR; };
template <> struct type_to_mpi<unsigned short> { static constexpr MPI_Datatype value = MPI_UNSIGNED_SHORT; };
template <> struct type_to_mpi<unsigned int> { static constexpr MPI_Datatype value = MPI_UNSIGNED; };
template <> struct type_to_mpi<unsigned long> { static constexpr MPI_Datatype value = MPI_UNSIGNED_LONG; };
template <> struct type_to_mpi<unsigned long long> { static constexpr MPI_Datatype value = MPI_UNSIGNED_LONG_LONG; };
template <> struct type_to_mpi<float> { static constexpr MPI_Datatype value = MPI_FLOAT; };
template <> struct type_to_mpi<double> { static constexpr MPI_Datatype value = MPI_DOUBLE; };
template <> struct type_to_mpi<long double> { static constexpr MPI_Datatype value = MPI_LONG_DOUBLE; };
template <> struct type_to_mpi<char> { static MPI_Datatype value() { return MPI_CHAR; } };
template <> struct type_to_mpi<short> { static MPI_Datatype value() { return MPI_SHORT; } };
template <> struct type_to_mpi<int> { static MPI_Datatype value() { return MPI_INT; } };
template <> struct type_to_mpi<long> { static MPI_Datatype value() { return MPI_LONG; } };
template <> struct type_to_mpi<long long> { static MPI_Datatype value() { return MPI_LONG_LONG; } };
template <> struct type_to_mpi<signed char> { static MPI_Datatype value() { return MPI_SIGNED_CHAR; } };
template <> struct type_to_mpi<unsigned char> { static MPI_Datatype value() { return MPI_UNSIGNED_CHAR; } };
template <> struct type_to_mpi<unsigned short> { static MPI_Datatype value() { return MPI_UNSIGNED_SHORT; } };
template <> struct type_to_mpi<unsigned int> { static MPI_Datatype value() { return MPI_UNSIGNED; } };
template <> struct type_to_mpi<unsigned long> { static MPI_Datatype value() { return MPI_UNSIGNED_LONG; } };
template <> struct type_to_mpi<unsigned long long> { static MPI_Datatype value() { return MPI_UNSIGNED_LONG_LONG; } };
template <> struct type_to_mpi<float> { static MPI_Datatype value() { return MPI_FLOAT; } };
template <> struct type_to_mpi<double> { static MPI_Datatype value() { return MPI_DOUBLE; } };
template <> struct type_to_mpi<long double> { static MPI_Datatype value() { return MPI_LONG_DOUBLE; } };
} // end namespac aux
template <class T>
constexpr MPI_Datatype type_to_mpi = aux::type_to_mpi<T>::value;
MPI_Datatype type_to_mpi() { return aux::type_to_mpi<T>::value(); };
// additional functor-tags
struct minimum {};
......@@ -75,20 +75,20 @@ namespace mpi14
static_assert( always_false<Op>::value, "Op is not an MPI operation!" );
};
template <> struct op_to_mpi<minimum> { static constexpr MPI_Op value = MPI_MIN; };
template <> struct op_to_mpi<maximum> { static constexpr MPI_Op value = MPI_MAX; };
template <> struct op_to_mpi<std::plus<>> { static constexpr MPI_Op value = MPI_SUM; };
template <> struct op_to_mpi<std::multiplies<>> { static constexpr MPI_Op value = MPI_PROD; };
template <> struct op_to_mpi<std::logical_and<>> { static constexpr MPI_Op value = MPI_LAND; };
template <> struct op_to_mpi<std::logical_or<>> { static constexpr MPI_Op value = MPI_LOR; };
template <> struct op_to_mpi<std::bit_and<>> { static constexpr MPI_Op value = MPI_BAND; };
template <> struct op_to_mpi<std::bit_or<>> { static constexpr MPI_Op value = MPI_BOR; };
template <> struct op_to_mpi<std::bit_xor<>> { static constexpr MPI_Op value = MPI_BXOR; };
template <> struct op_to_mpi<minimum> { static MPI_Op value() { return MPI_MIN; } };
template <> struct op_to_mpi<maximum> { static MPI_Op value() { return MPI_MAX; } };
template <> struct op_to_mpi<std::plus<>> { static MPI_Op value() { return MPI_SUM; } };
template <> struct op_to_mpi<std::multiplies<>> { static MPI_Op value() { return MPI_PROD; } };
template <> struct op_to_mpi<std::logical_and<>> { static MPI_Op value() { return MPI_LAND; } };
template <> struct op_to_mpi<std::logical_or<>> { static MPI_Op value() { return MPI_LOR; } };
template <> struct op_to_mpi<std::bit_and<>> { static MPI_Op value() { return MPI_BAND; } };
template <> struct op_to_mpi<std::bit_or<>> { static MPI_Op value() { return MPI_BOR; } };
template <> struct op_to_mpi<std::bit_xor<>> { static MPI_Op value() { return MPI_BXOR; } };
} // end namespac aux
template <class T>
constexpr MPI_Op op_to_mpi = aux::op_to_mpi<T>::value;
MPI_Op op_to_mpi() { return aux::op_to_mpi<T>::value(); };
} // end namespace mpi14
......@@ -7,7 +7,7 @@ template <class Data,
REQUIRES( is_mpi_type<Data> )>
void Communicator::send(Data const& data, int to, int tag) const
{
MPI_Send(&data, 1, type_to_mpi<Data>, to, tag, comm_);
MPI_Send(&data, 1, type_to_mpi<Data>(), to, tag, comm_);
}
......@@ -16,7 +16,7 @@ template <class Data,
REQUIRES( is_mpi_type<Data> )>
void Communicator::send(Data const* data, std::size_t size, int to, int tag) const
{
MPI_Send(data, int(size), type_to_mpi<Data>, to, tag, comm_);
MPI_Send(data, int(size), type_to_mpi<Data>(), to, tag, comm_);
}
......@@ -24,7 +24,7 @@ template <class T,
REQUIRES( is_mpi_type<T> )>
void Communicator::send(std::vector<T> const& vec, int to, int tag) const
{
MPI_Send(vec.data(), int(vec.size()), type_to_mpi<T>, to, tag, comm_);
MPI_Send(vec.data(), int(vec.size()), type_to_mpi<T>(), to, tag, comm_);
}
......@@ -49,7 +49,7 @@ template <class Data,
Request Communicator::isend(Data const& data, int to, int tag) const
{
MPI_Request request;
MPI_Isend(&data, 1, type_to_mpi<Data>, to, tag, comm_, &request);
MPI_Isend(&data, 1, type_to_mpi<Data>(), to, tag, comm_, &request);
return {request};
}
......@@ -60,7 +60,7 @@ template <class Data,
Request Communicator::ibsend(Data const& data, int to, int tag) const
{
MPI_Request request;
MPI_Ibsend(&data, 1, type_to_mpi<Data>, to, tag, comm_, &request);
MPI_Ibsend(&data, 1, type_to_mpi<Data>(), to, tag, comm_, &request);
return {request};
}
......@@ -71,7 +71,7 @@ template <class Data,
Request Communicator::isend(Data const* data, std::size_t size, int to, int tag) const
{
MPI_Request request;
MPI_Isend(data, size, type_to_mpi<Data>, to, tag, comm_, &request);
MPI_Isend(data, size, type_to_mpi<Data>(), to, tag, comm_, &request);
return {request};
}
......@@ -82,7 +82,7 @@ template <class Data,
Request Communicator::ibsend(Data const* data, std::size_t size, int to, int tag) const
{
MPI_Request request;
MPI_Ibsend(data, size, type_to_mpi<Data>, to, tag, comm_, &request);
MPI_Ibsend(data, size, type_to_mpi<Data>(), to, tag, comm_, &request);
return {request};
}
......@@ -92,7 +92,7 @@ template <class T,
Request Communicator::isend(std::vector<T> const& vec, int to, int tag) const
{
MPI_Request request;
MPI_Isend(vec.data(), int(vec.size()), type_to_mpi<T>, to, tag, comm_, &request);
MPI_Isend(vec.data(), int(vec.size()), type_to_mpi<T>(), to, tag, comm_, &request);
return {request};
}
......@@ -123,7 +123,7 @@ template <class Data,
MPI_Status Communicator::recv(Data& data, int from, int tag) const
{
MPI_Status status;
MPI_Recv(&data, 1, type_to_mpi<Data>, from, tag, comm_, &status);
MPI_Recv(&data, 1, type_to_mpi<Data>(), from, tag, comm_, &status);
return status;
}
......@@ -134,7 +134,7 @@ template <class Data,
MPI_Status Communicator::recv(Data* data, std::size_t size, int from, int tag) const
{
MPI_Status status;
MPI_Recv(data, size, type_to_mpi<Data>, from, tag, comm_, &status);
MPI_Recv(data, size, type_to_mpi<Data>(), from, tag, comm_, &status);
return status;
}
......@@ -148,10 +148,10 @@ MPI_Status Communicator::recv(std::vector<T>& vec, int from, int tag) const
MPI_Probe(from, tag, comm_, &status);
int size = 0;
MPI_Get_count(&status, type_to_mpi<T>, &size);
MPI_Get_count(&status, type_to_mpi<T>(), &size);
vec.resize(size);
MPI_Recv(vec.data(), size, type_to_mpi<T>, from, tag, comm_, MPI_STATUS_IGNORE);
MPI_Recv(vec.data(), size, type_to_mpi<T>(), from, tag, comm_, MPI_STATUS_IGNORE);
return status;
}
......@@ -183,7 +183,7 @@ template <class Data,
Request Communicator::irecv(Data& data, int from, int tag) const
{
MPI_Request request;
MPI_Irecv(&data, 1, type_to_mpi<Data>, from, tag, comm_, &request);
MPI_Irecv(&data, 1, type_to_mpi<Data>(), from, tag, comm_, &request);
return {request};
}
......@@ -194,7 +194,7 @@ template <class Data,
Request Communicator::irecv(Data* data, std::size_t size, int from, int tag) const
{
MPI_Request request;
MPI_Irecv(data, size, type_to_mpi<Data>, from, tag, comm_, &request);
MPI_Irecv(data, size, type_to_mpi<Data>(), from, tag, comm_, &request);
return {request};
}
......@@ -203,11 +203,11 @@ template <class T,
REQUIRES( is_mpi_type<T> )>
Request Communicator::irecv(std::vector<T>& vec, int from, int tag) const
{
return {RecvDynamicSize(type_to_mpi<T>,from,tag,comm_,
return {RecvDynamicSize(type_to_mpi<T>(),from,tag,comm_,
[from,tag,comm=comm_,&vec](int size)
{
vec.resize(size);
MPI_Recv(vec.data(), size, type_to_mpi<T>, from, tag, comm, MPI_STATUS_IGNORE);
MPI_Recv(vec.data(), size, type_to_mpi<T>(), from, tag, comm, MPI_STATUS_IGNORE);
}) };
}
......
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