xmuben

Is this a bug in multi-gpu application?

Discussion created by xmuben on Sep 26, 2010
Latest reply on Oct 3, 2010 by ThomasUCF

I use opencl to write a multi-gpu application.

A strange problem has trapped me for a few days.


in single gpu case, both codes work well.
but in multi-gpu case, h_Test1 in code one gets right data, while h_Test1 in code two gets error data. It happens in all devices except device 0.
i really don't know why this happen. I guess it may be a bug.
does anybody know about the reason?
thank you for your kindness!

// g_Context is the global context for all gpu devices // g_Devices is the device list. //code one cl_command_queue commandQueue = clCreateCommandQueue(g_Context,g_Devices[iDeviceID],0,&iStatus); cl_uint h_Test0[16] = {1}; cl_mem d_Test = clCreateBuffer(g_Context,CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,16*sizeof(cl_uint),h_Test0,&iStatus); cl_uint h_Test1[16]={0}; iStatus = clEnqueueReadBuffer(commandQueue,d_Test,CL_TRUE,0,16*sizeof(cl_uint),h_Test1,0,NULL,NULL); iStatus = clReleaseMemObject(d_Test); //code two cl_command_queue commandQueue = clCreateCommandQueue(g_Context,g_Devices[iDeviceID],0,&iStatus); cl_uint h_Test0[16] = {1}; cl_mem d_Test = clCreateBuffer(g_Context,CL_MEM_READ_ONLY,16*sizeof(cl_uint),NULL,&iStatus); iStatus=clEnqueueWriteBuffer(commandQueue,d_Test,CL_TRUE,0,16*sizeof(cl_uint),h_Test0,0,NULL,NULL); cl_uint h_Test1[16]={0}; iStatus = clEnqueueReadBuffer(commandQueue,d_Test,CL_TRUE,0,16*sizeof(cl_uint),h_Test1,0,NULL,NULL); iStatus = clReleaseMemObject(d_Test);

Outcomes