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