Package: lammps
Version: 20240207+dfsg-1.1+b4
Severity: wishlist
X-Debbugs-Cc: c...@slerp.xyz

Dear Maintainer,

The lammps project has an AMD ROCm backend for hardware acceleration on
AMD GPUs. It would be good to enable this functionality.

There are two different backends for LAMMP based on AMD ROCm. There is a
GPU backend which uses HIP directly and a GPU backend that uses Kokkos.
A ROCm-enabled kokkos package is required for the latter and has been
requested in Debian Bug #1082813 [1]. The lammps documentation notes
that performance is typically better on large simulations with double
precision when using Kokkos support [2].

The ROCm libraries packaged for Debian are currently built for gfx803,
gfx900, gfx906, gfx908, gfx90a, gfx1010, gfx1030, gfx1100, gfx1101, and
gfx1102. They will soon be be built for gfx942 as well. However, kokkos
appears to be limited to gfx900, gfx906, gfx908, gfx90a, gfx942,
gfx1030, and gfx1100. I supppose the lammps backend that uses kokkos
may be limited to fewer architectures than the backend that uses HIP
directly.

When building for the AMD GPU backend (without kokkos), the following
packages are required:

hipcc
libhipcub-dev

And the relevent configuration options include [3]:
-DPKG_GPU=ON
-DGPU_API=hip
-DGPU_PREC=<mixed,single,double>
-DHIP_ARCH=<targets>

When building for the kokkos backend, the libhipcub-dev package is not
required. However, kokkos depends on having an FFT package available.
The following packages would be used for the AMD GPU backend with
kokkos:

hipcc
libhipfft-dev

And the relevent configuration options include:
-DFFT_KOKKOS=hipfft

The compiling of GPU code will require the use of hipcc as the C++
compiler.  This can be done with CXX=hipcc before calling into CMake.
Any options that are incompatible with device code can be restricted to
host code by prefixing -Xarch_host. For an example of this, see the
rocthrust package [4].

I would suggest adding -DROCPRIM_USE_ARCH_CONVERSION to the
DEB_CXXFLAGS_MAINT_PREPEND flags when building either backend. This is a
rocprim build option that affects rocthrust and hipcub. It causes
gfx902, gfx909, and gfx90c to use gfx900 code paths and causes gfx1031,
gfx1032, gfx1033, gfx1034, gfx1035, and gfx1036 to use gfx1030 code
paths. It may or may not be sufficient to kokkos support to those
architectures, but it will at least be necessary.

If you require access to compatible hardware to test this functionality,
please reach out privately and I may be able to help.

Sincerely,
Cory Bloor

[1]: https://bugs.debian.org/1082813
[2]: https://docs.lammps.org/Speed_kokkos.html#performance-to-expect
[3]: https://docs.lammps.org/Build_extras.html#gpu
[4]: 
https://salsa.debian.org/rocm-team/rocthrust/-/blob/debian/5.7.1-3/debian/rules#L8-10

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.10.11-amd64 (SMP w/32 CPU threads; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages lammps depends on:
ii  lammps-data      20240207+dfsg-1.1
ii  libc6            2.40-3
ii  libgcc-s1        14.2.0-5
ii  liblammps0t64    20240207+dfsg-1.1+b4
ii  libopenmpi3t64   4.1.6-13.3
ii  libstdc++6       14.2.0-5
ii  mpi-default-bin  1.17

Versions of packages lammps recommends:
ii  lammps-doc  20240207+dfsg-1.1

Versions of packages lammps suggests:
pn  openkim-models  <none>
ii  python3         3.12.6-1

-- no debconf information

Reply via email to