Skip to content

C GPU bindings

Fully functional GPU bindings in C

Closes #17 (closed).

The C Host functions have not changed, they could be implemented in terms of device functions, and/or have a new _host prefix. No such change has been made yet.

Removals:

  • GlobalRegistry's copy_from_host_to and copy_to_host_from functions which are now unneeded

Additions:

  • Tests and CI: add C support with HIP, CUDA, CUDA+OpenACC.
  • Docs: add documentation for C device support
  • CMake: new MM_NUM_MAX_GPU option (default 8) to control the number of GPUs of each type on the platform (HIP/CUDA currently).
  • C:
    • Add functions mm_device_ctx_create(), mm_device_ctx_is_valid(), mm_device_ctx_delete() and mm_device_ctx_delete_all() to request a and manipulate device contexts. The device descriptions are done with the enum mm_device
    • Note: All further functions use the context (a number) to interact with the requested device. Also, the host is simply considered a device in all the new functions.
    • Add functions mm_device_allocate_<type>() and mm_device_is_allocated().
    • Add function mm_device_copy to copy between host and device, or peer devices.
    • Add functions mm_device_find_<type>() to access a variable's pointer.
  • C++
    • Device VarData can now be initialized with the host initialization parameters
    • get_device_id<Device>() and set_device_id<Device>() functions to access and set device IDs

Changes (C++):

  • Exception error message improvements
  • Change the device representation types for simplicity and templated information access
  • Global Registry templated copy_var allows a generic copy between any device source and destination (except HIP<->CUDA, which requires a host jump).
  • Template all high-level interface functions, such as is_allocated, allocate_var, and find to address a specific device
Edited by Terry Cojean

Merge request reports

Loading