add more data types
This commit is contained in:
parent
5a457d69fc
commit
61626aaf85
@ -51,7 +51,7 @@ struct Sum;
|
||||
struct BitOR;
|
||||
} // namespace op
|
||||
/*!
|
||||
* \brief intialize the rabit module, call this once function before using anything
|
||||
* \brief intialize the rabit module, call this once before using anything
|
||||
* \param argc number of arguments in argv
|
||||
* \param argv the array of input arguments
|
||||
*/
|
||||
|
||||
@ -146,14 +146,21 @@ IEngine *GetEngine(void);
|
||||
namespace mpi {
|
||||
/*!\brief enum of all operators */
|
||||
enum OpType {
|
||||
kMax, kMin, kSum, kBitwiseOR
|
||||
kMax = 0,
|
||||
kMin = 1,
|
||||
kSum = 2,
|
||||
kBitwiseOR = 3
|
||||
};
|
||||
/*!\brief enum of supported data types */
|
||||
enum DataType {
|
||||
kInt,
|
||||
kUInt,
|
||||
kDouble,
|
||||
kFloat
|
||||
kChar = 0,
|
||||
kUChar = 1,
|
||||
kInt = 2,
|
||||
kUInt = 3,
|
||||
kLong = 4,
|
||||
kULong = 5,
|
||||
kFloat = 6,
|
||||
kDouble = 7
|
||||
};
|
||||
} // namespace mpi
|
||||
/*!
|
||||
|
||||
@ -18,6 +18,14 @@ namespace mpi {
|
||||
template<typename DType>
|
||||
inline DataType GetType(void);
|
||||
template<>
|
||||
inline DataType GetType<char>(void) {
|
||||
return kChar;
|
||||
}
|
||||
template<>
|
||||
inline DataType GetType<unsigned char>(void) {
|
||||
return kUChar;
|
||||
}
|
||||
template<>
|
||||
inline DataType GetType<int>(void) {
|
||||
return kInt;
|
||||
}
|
||||
@ -26,6 +34,14 @@ inline DataType GetType<unsigned>(void) {
|
||||
return kUInt;
|
||||
}
|
||||
template<>
|
||||
inline DataType GetType<long>(void) {
|
||||
return kLong;
|
||||
}
|
||||
template<>
|
||||
inline DataType GetType<unsigned long>(void) {
|
||||
return kULong;
|
||||
}
|
||||
template<>
|
||||
inline DataType GetType<float>(void) {
|
||||
return kFloat;
|
||||
}
|
||||
|
||||
@ -95,8 +95,12 @@ IEngine *GetEngine(void) {
|
||||
inline MPI::Datatype GetType(mpi::DataType dtype) {
|
||||
using namespace mpi;
|
||||
switch (dtype) {
|
||||
case kChar: return MPI::CHAR;
|
||||
case kUChar: return MPI::BYTE;
|
||||
case kInt: return MPI::INT;
|
||||
case kUInt: return MPI::UNSIGNED;
|
||||
case kLong: return MPI::LONG;
|
||||
case kULong: return MPI::UNSIGNED_LONG;
|
||||
case kFloat: return MPI::FLOAT;
|
||||
case kDouble: return MPI::DOUBLE;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user