41const T
inf_plus(
const T& a,
const T& b) {
42 T inf = std::numeric_limits<T>::max();
43 if (a == inf || b == inf){
51struct BoolCopy2ndSRing
53 static OUT
id() {
return OUT(); }
55 static OUT
add(
const OUT & arg1,
const OUT & arg2)
57 std::cout <<
"Add should not happen (BoolCopy2ndSRing)!" << std::endl;
58 throw std::string(
"Add should not happen!");
62 static const OUT&
multiply(
bool arg1,
const OUT & arg2)
66 static void axpy(
bool a,
const OUT & x, OUT & y)
74 static bool exists =
false;
79 MPI_Op_create(
MPI_func,
true, &mpiop);
85 static void MPI_func(
void * invec,
void * inoutvec,
int * len, MPI_Datatype *datatype)
89 std::cout <<
"MPI Add should not happen (BoolCopy2ndSRing)!" << std::endl;
97struct BoolCopy1stSRing
99 static OUT
id() {
return OUT(); }
101 static OUT
add(
const OUT & arg1,
const OUT & arg2)
103 std::cout <<
"Add should not happen (BoolCopy1stSRing)!" << std::endl;
104 throw std::string(
"Add should not happen!");
108 static const OUT&
multiply(
const OUT & arg1,
bool arg2)
112 static void axpy(
const OUT& a,
bool x, OUT & y)
120 static bool exists =
false;
125 MPI_Op_create(
MPI_func,
true, &mpiop);
131 static void MPI_func(
void * invec,
void * inoutvec,
int * len, MPI_Datatype *datatype)
135 std::cout <<
"MPI Add should not happen (BoolCopy1stSRing)!" << std::endl;
143template <
class T1,
class T2,
class OUT>
146 static OUT
id() {
return OUT(); }
148 static MPI_Op
mpi_op() {
return MPI_MAX; };
149 static OUT
add(
const OUT & arg1,
const OUT & arg2)
153 static OUT
multiply(
const T1 & arg1,
const T2 & arg2)
156 return static_cast<OUT
>(arg2);
158 static void axpy(T1 a,
const T2 & x, OUT & y)
165template <
class T1,
class T2>
171 static MPI_Op
mpi_op() {
return MPI_MAX; };
174 return std::max(arg1, arg2);
185 y = std::max(y,
static_cast<T_promote>(a*x));
192struct SelectMaxSRing<bool, T2>
197 static MPI_Op
mpi_op() {
return MPI_MAX; };
200 return std::max(arg1, arg2);
212template <
class T1,
class T2>
218 static MPI_Op
mpi_op() {
return MPI_SUM; };
235template <
class T1,
class T2>
239 static T_promote id() {
return std::numeric_limits<T_promote>::max(); };
241 static MPI_Op
mpi_op() {
return MPI_MIN; };
244 return std::min(arg1, arg2);
const T inf_plus(const T &a, const T &b)
static const OUT & multiply(const OUT &arg1, bool arg2)
static OUT add(const OUT &arg1, const OUT &arg2)
static void axpy(const OUT &a, bool x, OUT &y)
static bool returnedSAID()
static void MPI_func(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype)
static bool returnedSAID()
static const OUT & multiply(bool arg1, const OUT &arg2)
static void MPI_func(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype)
static OUT add(const OUT &arg1, const OUT &arg2)
static void axpy(bool a, const OUT &x, OUT &y)
promote_trait< T1, T2 >::T_promote T_promote
static T_promote multiply(const T1 &arg1, const T2 &arg2)
static T_promote add(const T_promote &arg1, const T_promote &arg2)
static bool returnedSAID()
static void axpy(T1 a, const T2 &x, T_promote &y)
static T_promote multiply(const T1 &arg1, const T2 &arg2)
static T_promote add(const T_promote &arg1, const T_promote &arg2)
promote_trait< T1, T2 >::T_promote T_promote
static void axpy(T1 a, const T2 &x, T_promote &y)
static bool returnedSAID()
static void axpy(T1 a, const T2 &x, OUT &y)
static bool returnedSAID()
static OUT multiply(const T1 &arg1, const T2 &arg2)
static OUT add(const OUT &arg1, const OUT &arg2)
static bool returnedSAID()
static T_promote add(const T_promote &arg1, const T_promote &arg2)
static void axpy(bool a, const T2 &x, T_promote &y)
static T_promote multiply(const bool &arg1, const T2 &arg2)
static T_promote multiply(const T1 &arg1, const T2 &arg2)
static void axpy(T1 a, const T2 &x, T_promote &y)
static bool returnedSAID()
static T_promote add(const T_promote &arg1, const T_promote &arg2)
promote_trait< T1, T2 >::T_promote T_promote