Functionality to choose accelerator device (GPU)
When PARALLAX is compiled stand-alone, get_device_count always returns
1 (i.e. the CPU), and set_device_id is a sanity check confirming that
it's called with id 0.
When PARALLAX is linked to the PAccX library, these
subroutines are simple wrappers around
paccx_solver_get_device_count and
paccx_solver_set_device.
In turn, PAccX may be linked to different backends.
As of 2025-03-14 a CXX (i.e. CPU) backend is always present, and an
optional GPU backend is also available (CUDA or HIP, chosen at CMake
configure time).
Note: these subroutines control the global device settings of the
calling process/thread.
If your code links against PARALLAX and another accelerator-capable
library, please test thoroughly and ensure the code behaves as desired.
Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Enumerations
enum, bind(c)
Enumerators
enumerator
::
BACKEND_CPU
=
0
enumerator
::
BACKEND_GPU
=
1
enumerator
::
BACKEND_ROCALUTION
=
4
enumerator
::
BACKEND_AMGX
=
5
enumerator
::
BACKEND_HYPRE
=
6
Description
Enumerator defining the backends
These values MUST agree with the corresponding enum in
paccx.hxx from PAccX
Assign devices to MPI ranks in order.
Only works if number of ranks is greater or equal to number of devices
Device assigned to rank rr is (rr modulo total_number_of_devices).