alecandido / gpu

0 stars 0 forks source link

cupy AMD #1

Open scarrazza opened 2 years ago

scarrazza commented 2 years ago

This sentence is imprecise:

https://github.com/AleCandido/gpu/blob/007bc0200c145e2bd609366a0a152821af2061b6/python/README.md?plain=1#L28

CuPy works perfectly with devices with ROCm support. Moreover, you could even write cupy.RawKernels in CUDA that are automatically compiled for ROCm.

alecandido commented 2 years ago

I didn't decide by myself:

Installation

Requirements

NVIDIA CUDA GPU with the Compute Capability 3.0 or larger.

While they classify support for ROCm as experimental

Using CuPy on AMD GPU (experimental)

CuPy has an experimental support for AMD GPU (ROCm).

Moreover, the main interoperability API is based on CUDA, together with the whole low-level API.

Moreover, you could even write cupy.RawKernels in CUDA that are automatically compiled for ROCm.

This I didn't know, it was not apparent at first sight. But good to know, I'll investigate and update.

scarrazza commented 2 years ago

They are very conservative given that rocm is not as mature as Cuda. Here the example that everything works as expected https://github.com/qiboteam/qibojit, see fig 5 for performance comparison https://arxiv.org/abs/2203.08826

alecandido commented 2 years ago

I see, I will amend and test.

But the interoperability doesn't work with ROCm, it is based on some CUDA feature:

Limitations

The following features are not available due to the limitation of ROCm or because that they are specific to CUDA:

  • CUDA Array Interface
  • [...]
scarrazza commented 2 years ago

Indeed, good point.