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

changed type-traits since problems with bullxmpi

parent a85612bb
......@@ -7,14 +7,14 @@
namespace mpi14
{
template <class T, class Operation,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
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);
}
template <class T, class Operation,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
void all_reduce(Communicator& comm, T& inout, Operation)
{
MPI_Allreduce(MPI_IN_PLACE, &inout, 1, type_to_mpi<T>(), op_to_mpi<Operation>(), comm);
......
......@@ -44,30 +44,30 @@ namespace mpi14
// send mpi datatype
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
void send(Data const& data, int to, int tag = 0) const;
// send array of mpi datatypes
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
void send(T const* data, std::size_t size, int to, int tag = 0) const;
template <class T, std::size_t N,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
void send(T const (&data)[N], int to, int tag = 0) const
{
send(data, N, to, tag);
}
template <class T, std::size_t N,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
void send(std::array<T,N> const& array, int to, int tag = 0) const
{
send(array.data(), N, to, tag);
}
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
void send(std::vector<T> const& vec, int to, int tag = 0) const;
void send(std::string const& str, int to, int tag = 0) const
......@@ -80,7 +80,7 @@ namespace mpi14
// 2. send size of buffer (with MPI_Ibsend)
// 3. send buffer
template <class Data,
REQUIRES( !is_mpi_type<Data> )>
REQUIRES( !is_mpi_type<Data>::value )>
void send(Data const& data, int to, int tag = 0) const;
// -------------------------------------------------------------------------------------
......@@ -88,26 +88,26 @@ namespace mpi14
// send mpi datatype (non-blocking)
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request isend(Data const& data, int to, int tag = 0) const;
// send mpi datatype (non-blocking, buffered)
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request ibsend(Data const& data, int to, int tag = 0) const;
// send array of mpi datatypes (non-blocking)
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request isend(Data const* data, std::size_t size, int to, int tag = 0) const;
// send array of mpi datatypes (non-blocking, buffered)
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request ibsend(Data const* data, std::size_t size, int to, int tag = 0) const;
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
Request isend(std::vector<T> const& vec, int to, int tag = 0) const;
Request isend(std::string const& str, int to, int tag = 0) const
......@@ -123,37 +123,37 @@ namespace mpi14
// 2. send size of buffer (with MPI_Ibsend)
// 3. send buffer (with MPI_Ibsend)
template <class Data,
REQUIRES( !is_mpi_type<Data> )>
REQUIRES( !is_mpi_type<Data>::value )>
Request isend(Data const& data, int to, int tag = 0) const;
// -------------------------------------------------------------------------------------
// receive mpi datatype
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
MPI_Status recv(Data& data, int from, int tag = 0) const;
// receive array of mpi datatypes
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
MPI_Status recv(T* data, std::size_t size, int from, int tag = 0) const;
template <class T, std::size_t N,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
MPI_Status recv(T (&data)[N], int from, int tag = 0) const
{
return recv(data, N, from, tag);
}
template <class T, std::size_t N,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
MPI_Status recv(std::array<T,N>& data, int from, int tag = 0) const
{
return recv(data.data(), N, from, tag);
}
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
MPI_Status recv(std::vector<T>& data, int from, int tag = 0) const;
MPI_Status recv(std::string& str, int from, int tag = 0) const
......@@ -171,19 +171,19 @@ namespace mpi14
// receive complex datatype
template <class Data,
REQUIRES( !is_mpi_type<Data> )>
REQUIRES( !is_mpi_type<Data>::value )>
MPI_Status recv(Data& data, int from, int tag = 0) const;
// -------------------------------------------------------------------------------------
// receive mpi datatype
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request irecv(Data& data, int from, int tag = 0) const;
// receive array of mpi datatypes
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request irecv(Data* data, std::size_t size, int from, int tag = 0) const;
// receive vector of mpi datatypes
......@@ -191,7 +191,7 @@ namespace mpi14
// 2. resize data-vector
// 3. receive data into vector
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
Request irecv(std::vector<T>& vec, int from, int tag = 0) const;
Request irecv(std::string& str, int from, int tag = 0) const
......@@ -207,7 +207,7 @@ namespace mpi14
// receive complex datatype asynchronousely
// Wait for data, by calling Future::test() or Future::wait().
template <class Data,
REQUIRES( !is_mpi_type<Data> )>
REQUIRES( !is_mpi_type<Data>::value )>
Request irecv(Data& data, int from, int tag = 0) const;
......
......@@ -30,16 +30,16 @@ namespace mpi14
} // end namespace aux
template <class T>
constexpr bool is_mpi_type = aux::is_mpi_type<T>::value;
using is_mpi_type = aux::is_mpi_type<T>;
namespace aux
{
template <class T>
struct type_to_mpi
{
static_assert( mpi14::is_mpi_type<T>, "Type is not an MPI Datatype!" );
};
struct type_to_mpi;
// {
// static_assert( is_mpi_type<T>::value, "Type is not an MPI Datatype!" );
// };
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; } };
......@@ -70,10 +70,10 @@ namespace mpi14
template <class T> using always_false = std::false_type;
template <class Op>
struct op_to_mpi
{
static_assert( always_false<Op>::value, "Op is not an MPI operation!" );
};
struct op_to_mpi;
// {
// static_assert( always_false<Op>::value, "Op is not an MPI operation!" );
// };
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; } };
......
......@@ -4,7 +4,7 @@ namespace mpi14 {
// send mpi datatype
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
void Communicator::send(Data const& data, int to, int tag) const
{
MPI_Send(&data, 1, type_to_mpi<Data>(), to, tag, comm_);
......@@ -13,7 +13,7 @@ void Communicator::send(Data const& data, int to, int tag) const
// send array of mpi datatypes
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
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_);
......@@ -21,7 +21,7 @@ void Communicator::send(Data const* data, std::size_t size, int to, int tag) con
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
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_);
......@@ -33,7 +33,7 @@ void Communicator::send(std::vector<T> const& vec, int to, int tag) const
// 2. send size of buffer (with MPI_Ibsend)
// 3. send buffer
template <class Data,
REQUIRES( !is_mpi_type<Data> )>
REQUIRES( !is_mpi_type<Data>::value )>
void Communicator::send(Data const& data, int to, int tag) const
{
auto buffer = serialization::store(data);
......@@ -45,7 +45,7 @@ void Communicator::send(Data const& data, int to, int tag) const
// send mpi datatype (non-blocking)
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request Communicator::isend(Data const& data, int to, int tag) const
{
MPI_Request request;
......@@ -56,7 +56,7 @@ Request Communicator::isend(Data const& data, int to, int tag) const
// send mpi datatype (non-blocking, buffered)
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request Communicator::ibsend(Data const& data, int to, int tag) const
{
MPI_Request request;
......@@ -67,7 +67,7 @@ Request Communicator::ibsend(Data const& data, int to, int tag) const
// send array of mpi datatypes (non-blocking)
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request Communicator::isend(Data const* data, std::size_t size, int to, int tag) const
{
MPI_Request request;
......@@ -78,7 +78,7 @@ Request Communicator::isend(Data const* data, std::size_t size, int to, int tag)
// send array of mpi datatypes (non-blocking, buffered)
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request Communicator::ibsend(Data const* data, std::size_t size, int to, int tag) const
{
MPI_Request request;
......@@ -88,7 +88,7 @@ Request Communicator::ibsend(Data const* data, std::size_t size, int to, int tag
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
Request Communicator::isend(std::vector<T> const& vec, int to, int tag) const
{
MPI_Request request;
......@@ -102,7 +102,7 @@ Request Communicator::isend(std::vector<T> const& vec, int to, int tag) const
// 2. send size of buffer (with MPI_Ibsend)
// 3. send buffer (with MPI_Ibsend)
template <class Data,
REQUIRES( !is_mpi_type<Data> )>
REQUIRES( !is_mpi_type<Data>::value )>
Request Communicator::isend(Data const& data, int to, int tag) const
{
check_buffers();
......@@ -119,7 +119,7 @@ Request Communicator::isend(Data const& data, int to, int tag) const
// receive mpi datatype
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
MPI_Status Communicator::recv(Data& data, int from, int tag) const
{
MPI_Status status;
......@@ -130,7 +130,7 @@ MPI_Status Communicator::recv(Data& data, int from, int tag) const
// receive array of mpi datatypes
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
MPI_Status Communicator::recv(Data* data, std::size_t size, int from, int tag) const
{
MPI_Status status;
......@@ -141,7 +141,7 @@ MPI_Status Communicator::recv(Data* data, std::size_t size, int from, int tag) c
// receive array of mpi datatypes
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
MPI_Status Communicator::recv(std::vector<T>& vec, int from, int tag) const
{
MPI_Status status;
......@@ -158,7 +158,7 @@ MPI_Status Communicator::recv(std::vector<T>& vec, int from, int tag) const
// receive complex datatype
template <class Data,
REQUIRES( !is_mpi_type<Data> )>
REQUIRES( !is_mpi_type<Data>::value )>
MPI_Status Communicator::recv(Data& data, int from, int tag) const
{
MPI_Status status;
......@@ -179,7 +179,7 @@ MPI_Status Communicator::recv(Data& data, int from, int tag) const
// receive mpi datatype
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request Communicator::irecv(Data& data, int from, int tag) const
{
MPI_Request request;
......@@ -190,7 +190,7 @@ Request Communicator::irecv(Data& data, int from, int tag) const
// receive array of mpi datatypes
template <class Data,
REQUIRES( is_mpi_type<Data> )>
REQUIRES( is_mpi_type<Data>::value )>
Request Communicator::irecv(Data* data, std::size_t size, int from, int tag) const
{
MPI_Request request;
......@@ -200,7 +200,7 @@ Request Communicator::irecv(Data* data, std::size_t size, int from, int tag) con
template <class T,
REQUIRES( is_mpi_type<T> )>
REQUIRES( is_mpi_type<T>::value )>
Request Communicator::irecv(std::vector<T>& vec, int from, int tag) const
{
return {RecvDynamicSize(type_to_mpi<T>(),from,tag,comm_,
......@@ -213,7 +213,7 @@ Request Communicator::irecv(std::vector<T>& vec, int from, int tag) const
template <class Data,
REQUIRES( !is_mpi_type<Data> )>
REQUIRES( !is_mpi_type<Data>::value )>
Request Communicator::irecv(Data& data, int from, int tag) const
{
return {RecvDynamicSize(MPI_BYTE,from,tag,comm_,
......
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