introduce check that CPU-GPU transfers/assignments are made between compatible types - Redmine #2936
The following
- The bonded, constraints and update code makes the implicit
assumption that the
fvec
andfloat3
types are compatible both in size and layout and it is safe to copy data from an array of the former to the latter. TODO: update this with the current state of the update-constraints code
- Buffer ops code transfers from rvec* host to float3* device buffers.
- The nonbonded module transfer LJ combination rule parameters from gmx::HostVector to float2.
- Note that PME passes the coordinates from rvec* host as float* to the device.
We should add a check for this assumption in the relevant modules, checking at least that the sizes of the types are equal using a static_assert.
- OpenCL requires additional assertions on the validity of the data
type compatibility we implicitly assume (e.g.
sizeof(float)==sizeof(cl_float)
).
(from redmine: issue id 2936, created on 2019-04-29 by pszilard)
- Relations:
- relates #2888 (closed)
- relates #2675 (closed)
- relates #3311 (closed)
- relates #3312
- Changesets:
- Revision c5c220a0 by Artem Zhmurov on 2020-02-06T07:49:39Z:
Use RVec instead of float for x, v and f device buffers
Using RVec instead of float for coordinates data-types allows to
remove multiplications by DIM when the adresses, offsets and sizes
are computed. Since the native device types are not used in CPU
part of the code, the type casting remains.
Refs #3312 and #2936
Change-Id: Iaea914a474195f214ca860f7345f6878b9a04813