OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

clSVMAlloc() failure on i5 6500

wang_f_
Beginner
334 Views

Hi

We are trying to use Opencl with i5 6500.When we use clSVMAlloc() for SVM over a certain size,it will return failure.The questions as belows:

1. What factor decides the max SVM size ?(The size of host memory ? );

2.How does SVM work on physical storage?

3.How can I get the value of max SVM size on my platform?

regards.

0 Kudos
4 Replies
Michal_M_Intel
Employee
334 Views

For 32-bit applications total size available is 4GB due to the 32 bit address range size.

Whenever kernel using SVM allocation is being submitted to the GPU, whole SVM allocation needs to be resident at once, so it cannot be bigger then the total amount of host memory.

Maximal size of SVM allocation can be queried with

clGetDeviceInfo + CL_DEVICE_MAX_MEM_ALLOC_SIZE

wang_f_
Beginner
334 Views

Michal M. (Intel) wrote:

For 32-bit applications total size available is 4GB due to the 32 bit address range size.

Whenever kernel using SVM allocation is being submitted to the GPU, whole SVM allocation needs to be resident at once, so it cannot be bigger then the total amount of host memory.

Maximal size of SVM allocation can be queried with

clGetDeviceInfo + CL_DEVICE_MAX_MEM_ALLOC_SIZE

typedef struct rnamatrix{
	int i;
	bool flag;  
} rnamatrix;

rnamatrix * matrix_SVM_buffer;
matrix_SVM_buffer=(rnamatrix*)clSVMAlloc(context,CL_MEM_READ_WRITE,rnalen*rnalen*sizeof(rnamatrix),0);
if(matrix_SVM_buffer==NULL)
{
	cout<<"clSVMAlloc() failure!\n";
}  

My program is based on 64-bit and the system is also 64-bit. However,when I set rnalen=5200,the function of clSVMAlloc return NULL.When setting rnalen=4000,it will allocate successful.

I dont know why.Thank u for your attention.Looking forward to your reply.

Regards

 

Michal_M_Intel
Employee
334 Views

Can you share more details :

- What Operating System is used?

- What does clGetDeviceInfo + CL_DEVICE_MAX_MEM_ALLOC_SIZE return ?

- What does clGetDeviceInfo + CL_DEVICE_GLOBAL_MEM_SIZE return ? 

- What are clCreateContext parameters?

- Is it specific to CPU device , does the same problem reproduce on GPU device?

wang_f_
Beginner
334 Views

Michal M. (Intel) wrote:

Can you share more details :

- What Operating System is used?

- What does clGetDeviceInfo + CL_DEVICE_MAX_MEM_ALLOC_SIZE return ?

- What does clGetDeviceInfo + CL_DEVICE_GLOBAL_MEM_SIZE return ? 

- What are clCreateContext parameters?

- Is it specific to CPU device , does the same problem reproduce on GPU device?

1.OS:Ubuntu 16.04LTS

2.Max memory allocation: 8397942784(7.821GiB)

3.Global memory size: 33591771136(31.28GiB)

4.context = clCreateContext(  NULL,numDevices, devices,  NULL,  NULL,  &status);  PS:numDevices=2 and the devices array has two elements.

5.Yes

Reply