-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
explicitly defining an MPI_Datatype for size_t because gcc gets confu… #155
base: develop
Are you sure you want to change the base?
Conversation
…sed on some platforms.
I see. This fix is not portable either. I guess I need to wrap it with precompiler guards or something. |
Looks like the test that failed did so because the Arrow fetch barfed, @steiltre. I think that this is now ready to merge. |
The A list of these types in MPI can be found here. |
To solve this issue, how about utilizing Here is an example mpi_typeof function that uses template <typename T>
inline constexpr MPI_Datatype mpi_typeof(T) {
if constexpr (std::is_same_v<T, char>) {
return MPI_CHAR;
} else if constexpr (std::is_same_v<T, bool>) {
return MPI_CXX_BOOL;
} else if constexpr (std::is_same_v<T, int8_t>) {
return MPI_INT8_T;
} else if constexpr (std::is_same_v<T, int16_t>) {
return MPI_INT16_T;
} else if constexpr (std::is_same_v<T, int32_t>) {
return MPI_INT32_T;
} else if constexpr (std::is_same_v<T, int64_t>) {
return MPI_INT64_T;
} else if constexpr (std::is_same_v<T, uint8_t>) {
return MPI_UINT8_T;
} else if constexpr (std::is_same_v<T, uint16_t>) {
return MPI_UINT16_T;
} else if constexpr (std::is_same_v<T, uint32_t>) {
return MPI_UINT32_T;
} else if constexpr (std::is_same_v<T, uint64_t> ||
std::is_same_v<T, std::size_t>) {
return MPI_UINT64_T;
} else if constexpr (std::is_same_v<T, float>) {
return MPI_FLOAT;
} else if constexpr (std::is_same_v<T, double>) {
return MPI_DOUBLE;
} else if constexpr (std::is_same_v<T, long double>) {
return MPI_LONG_DOUBLE;
} else {
// Thanks to 'constexpr', the following static_assert does not assert
// as long as 'T' is one of the supported types above.
static_assert(always_false<>, "Unkown MPI Type");
}
return 0;
} What do you think? |
…sed on some platforms.