AnsweredAssumed Answered

Read/Write OpenCL memory buffers on multiple GPU in a single context

Question asked by chardson on Jun 20, 2012
Latest reply on Jun 21, 2012 by pesh

Assume a system with two distinct GPUs, but from the same vendor so they can be accessed from a single OpenCL Platform. Given the following simplified OpenCL code:

 

float* someRawData; 

cl_device_id gpu1 = clGetDeviceIDs(0,...);
cl_device_id gpu2 = clGetDeviceIDs(1,...);
cl_context ctx = clCreateContext(gpu1,gpu2,...); 

cl_command_queue queue1 = clCreateCommandQueue(ctx,gpu1,...);
cl_command_queue queue2 = clCreateCommandQueue(ctx,gpu2,...);

cl_mem gpuMem = clCreateBuffer(ctx, CL_MEM_READ_WRITE, ...);
clEnqueueWriteBuffer(queue1,gpuMem,...,someRawData,...);
clFlush(queue1);

 

At the end of the execution, will someRawData be on both GPU memory or will it be only on gpu1 memory?

Outcomes