In dpc++ malloc_shared can we share a buffer between 2 gpus

Viewed 127

In sycl/dpc++ malloc_shared I am aware that it is possible to create a buffer which could be shared between the host and a single gpu with the below function.

void* malloc_shared(size_t num_bytes,
                    const sycl::device& dev,
                    const sycl::context& ctxt);

or

int *data = malloc_shared<int>(N, q);

I wanted to know if something existed that could possibly share the same data/buffer across multiple gpus? Something like the below

int *data = malloc_shared<int>(N, q1,q2);
1 Answers

No, there is no standardized way of allocating memory on multiple devices using sycl::malloc_shared.

If you wish to use the same buffer from between multiple devices (and the host), you need to use sycl::malloc_host (the overload taking sycl::context), but that will likely have a negative impact on performance.

Related