move d_ubuf to kokkos_type.h
https://matsci.org/t/a-few-kokkos-development-questions/56598/8 (Q11) "More correct would be to use a union with ubuf as is done in the atom_vec styles, so that no precision is lost for converting a huge 64-bit integer to a double."
This commit is contained in:
@ -24,17 +24,6 @@
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
union d_ubuf {
|
||||
double d;
|
||||
int64_t i;
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
d_ubuf(double arg) : d(arg) {}
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
d_ubuf(int64_t arg) : i(arg) {}
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
d_ubuf(int arg) : i(arg) {}
|
||||
};
|
||||
|
||||
class AtomVecKokkos : virtual public AtomVec {
|
||||
public:
|
||||
AtomVecKokkos(class LAMMPS *);
|
||||
|
||||
@ -41,6 +41,16 @@ constexpr int HALF = 4;
|
||||
#define MAX_TYPES_STACKPARAMS 12
|
||||
static constexpr LAMMPS_NS::bigint LMP_KOKKOS_AV_DELTA = 10;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
union d_ubuf {
|
||||
double d;
|
||||
int64_t i;
|
||||
KOKKOS_INLINE_FUNCTION d_ubuf(double arg) : d(arg) {}
|
||||
KOKKOS_INLINE_FUNCTION d_ubuf(int64_t arg) : i(arg) {}
|
||||
KOKKOS_INLINE_FUNCTION d_ubuf(int arg) : i(arg) {}
|
||||
};
|
||||
}
|
||||
|
||||
namespace Kokkos {
|
||||
static auto NoInit = [](std::string const& label) {
|
||||
return Kokkos::view_alloc(Kokkos::WithoutInitializing, label);
|
||||
|
||||
Reference in New Issue
Block a user