kokkos / kokkos-comm

Experimental MPI Wrapper for Kokkos
https://kokkos.org/kokkos-comm/
Other
12 stars 9 forks source link

More MPI Datatypes #48

Closed dutkalex closed 3 months ago

dutkalex commented 3 months ago

Title says it all :)

cwpearson commented 3 months ago

@dutkalex we require clang-format-8 at present - may be easiest to copy-paste the diff from the failed test and apply it to your branch 😄

dutkalex commented 3 months ago

TIL std::size_t is its own implementation-defined type, but std::int8_t etc are not apparently...

cwpearson commented 3 months ago

@dutkalex if it's easier than SFINAE for this, I'd accept an implementation that is basically

template <T>
MPI_Datatype mpi_type() {
if constexpr (std::is_same_v<T, char>) {return MPI_CHAR; }
else if constexpr (std::is_same_v<T, int16_t>) { return ...; }
...
}

I think you can just have a branch for each type, and even if two branches are for the same type on certain platforms we won't get any warnings.

dutkalex commented 3 months ago

@cwpearson Yes, this is actually how I intuitively implemented this in our in house solution, which explains why I did not run into the problem at the time. I will fix this ;)

dutkalex commented 3 months ago

Anything more we should add before merging this?