Project

General

Profile

Task #2936

introduce check that CPU-GPU transfers/assignments are made between compatible types

Added by Szilárd Páll about 1 year ago. Updated 5 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Difficulty:
simple
Close

Description

The following

  • The bonded, constraints and update code makes the implicit assumption that the fvec and float3 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<real> 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)).

Related issues

Related to GROMACS - Feature #2888: CUDA Update and Constraints moduleClosed
Related to GROMACS - Task #2675: bonded CUDA offload taskIn Progress
Related to GROMACS - Feature #3311: GPU infrastructure developmentIn Progress
Related to GROMACS - Task #3312: Data type for coordinates, xyzq data, LJ parameters data to use for GPU buffersIn Progress

Associated revisions

Revision c5c220a0 (diff)
Added by Artem Zhmurov 5 months ago

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

History

#1 Updated by Szilárd Páll about 1 year ago

  • Related to Feature #2888: CUDA Update and Constraints module added

#2 Updated by Szilárd Páll about 1 year ago

  • Related to Task #2675: bonded CUDA offload task added

#3 Updated by Artem Zhmurov about 1 year ago

Although this is not trivial in the current form, but since we use wrapper, maybe we should make these checks inside it? I guess, static_assert will not work in this case though.

#4 Updated by Artem Zhmurov 7 months ago

  • Target version changed from 2020 to 2021

Started to add these checks in current master (see https://gerrit.gromacs.org/#/c/gromacs/+/14859/). Solution for the proper data type for the coordinates device buffer is needed: RVec/rvec can not be directly used in the GPU code, float3 is not available in the CPU code. Re-targeting to the next version.

#5 Updated by Szilárd Páll 5 months ago

  • Subject changed from introduce check that CPU-GPU transfers are made between arrays of compatible types to introduce check that CPU-GPU transfers/assignments are made between compatible types
  • Description updated (diff)

#6 Updated by Szilárd Páll 5 months ago

#7 Updated by Szilárd Páll 5 months ago

Szilárd Páll wrote:

  • The nonbonded module transfer LJ combination rule parameters from gmx::HostVector<real> to float2.

Would there be no benefit in loading these in pairs in the CPU code too? I see the SIMD kernel doing:

        SimdReal c6s_S0 = SimdReal(ljc[sci2 + 0]);
        SimdReal c6s_S1 = SimdReal(ljc[sci2 + 1]);

#8 Updated by Szilárd Páll 5 months ago

  • Related to Task #3312: Data type for coordinates, xyzq data, LJ parameters data to use for GPU buffers added

Also available in: Atom PDF