# Maximum data size in OpenCL

**URL:** <https://forums.developer.nvidia.com/t/maximum-data-size-in-opencl/16067>\
**Category:** CUDA Programming and Performance\
**Created:** [April 13, 2010, 1:08am UTC](https://forums.developer.nvidia.com/t/maximum-data-size-in-opencl/16067 "2010-04-13T01:08:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thuy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Thuy](https://forums.developer.nvidia.com/u/Thuy)\
**Post date:** [April 13, 2010, 1:08am UTC](https://forums.developer.nvidia.com/t/maximum-data-size-in-opencl/16067/1 "2010-04-13T01:08:44Z")

</div>

Do you know what determine the maximum size of an array (of integer, for example) that can be passed from host to device?

For example, in the dot product program what limited the maximum size of the array to 10 million?

Is the size of pageable memory matter to this limitation?

Thank you,

---

<div class="post-metadata">

**Author:** ![pcmaster](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pcmaster](https://forums.developer.nvidia.com/u/pcmaster)\
**Post date:** [April 15, 2010, 3:09pm UTC](https://forums.developer.nvidia.com/t/maximum-data-size-in-opencl/16067/2 "2010-04-15T15:09:28Z")

</div>

> [@](#):
>
> Do you know what determine the maximum size of an array (of integer, for example) that can be passed from host to device?
> 
> For example, in the dot product program what limited the maximum size of the array to 10 million?
> 
> Is the size of pageable memory matter to this limitation?
> 
> Thank you,

CL\_DEVICE\_ADDRESS\_BITS, CL\_DEVICE\_MAX\_MEM\_ALLOC\_SIZE (and CL\_DEVICE\_GLOBAL\_MEM\_SIZE) should help. On GF8800GT they return 32 bits, 128MB (and 511MB). That would mean, that on this card the biggest buffer you can get is 128 MB (and theoretically have 3 such buffers and one smaller altogether, 'cuz only 511MB of 512 is accessible). So you can have 128MB/4B = 32M = 2^25 = 33554432 32bit ints or floats in a single array.

On AMD CPU, the values are 32bit, 512MB and 1024MB now.

---

<div class="post-metadata">

**Author:** ![pcmaster](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pcmaster](https://forums.developer.nvidia.com/u/pcmaster)\
**Post date:** [April 15, 2010, 3:09pm UTC](https://forums.developer.nvidia.com/t/maximum-data-size-in-opencl/16067/3 "2010-04-15T15:09:28Z")

</div>

> [@](#):
>
> Do you know what determine the maximum size of an array (of integer, for example) that can be passed from host to device?
> 
> For example, in the dot product program what limited the maximum size of the array to 10 million?
> 
> Is the size of pageable memory matter to this limitation?
> 
> Thank you,

CL\_DEVICE\_ADDRESS\_BITS, CL\_DEVICE\_MAX\_MEM\_ALLOC\_SIZE (and CL\_DEVICE\_GLOBAL\_MEM\_SIZE) should help. On GF8800GT they return 32 bits, 128MB (and 511MB). That would mean, that on this card the biggest buffer you can get is 128 MB (and theoretically have 3 such buffers and one smaller altogether, 'cuz only 511MB of 512 is accessible). So you can have 128MB/4B = 32M = 2^25 = 33554432 32bit ints or floats in a single array.

On AMD CPU, the values are 32bit, 512MB and 1024MB now.

---

<div class="post-metadata">

**Author:** ![Thuy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Thuy](https://forums.developer.nvidia.com/u/Thuy)\
**Post date:** [April 15, 2010, 10:58pm UTC](https://forums.developer.nvidia.com/t/maximum-data-size-in-opencl/16067/4 "2010-04-15T22:58:01Z")

</div>

> [@](#):
>
> CL\_DEVICE\_ADDRESS\_BITS, CL\_DEVICE\_MAX\_MEM\_ALLOC\_SIZE (and CL\_DEVICE\_GLOBAL\_MEM\_SIZE) should help. On GF8800GT they return 32 bits, 128MB (and 511MB). That would mean, that on this card the biggest buffer you can get is 128 MB (and theoretically have 3 such buffers and one smaller altogether, 'cuz only 511MB of 512 is accessible). So you can have 128MB/4B = 32M = 2^25 = 33554432 32bit ints or floats in a single array.
> 
> On AMD CPU, the values are 32bit, 512MB and 1024MB now.

Thank you, PCMASTER.

In case I have 64-bit system, my array will be smaller? From your calculation, I will have maximum 16M integer array. Yes?

That is close to the number that I got from my test.

Thank you,

---

<div class="post-metadata">

**Author:** ![Thuy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Thuy](https://forums.developer.nvidia.com/u/Thuy)\
**Post date:** [April 15, 2010, 10:58pm UTC](https://forums.developer.nvidia.com/t/maximum-data-size-in-opencl/16067/5 "2010-04-15T22:58:01Z")

</div>

> [@](#):
>
> CL\_DEVICE\_ADDRESS\_BITS, CL\_DEVICE\_MAX\_MEM\_ALLOC\_SIZE (and CL\_DEVICE\_GLOBAL\_MEM\_SIZE) should help. On GF8800GT they return 32 bits, 128MB (and 511MB). That would mean, that on this card the biggest buffer you can get is 128 MB (and theoretically have 3 such buffers and one smaller altogether, 'cuz only 511MB of 512 is accessible). So you can have 128MB/4B = 32M = 2^25 = 33554432 32bit ints or floats in a single array.
> 
> On AMD CPU, the values are 32bit, 512MB and 1024MB now.

Thank you, PCMASTER.

In case I have 64-bit system, my array will be smaller? From your calculation, I will have maximum 16M integer array. Yes?

That is close to the number that I got from my test.

Thank you,

---

<div class="post-metadata">

**Author:** ![pcmaster](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pcmaster](https://forums.developer.nvidia.com/u/pcmaster)\
**Post date:** [April 15, 2010, 11:51pm UTC](https://forums.developer.nvidia.com/t/maximum-data-size-in-opencl/16067/6 "2010-04-15T23:51:06Z")

</div>

Actually no :-) A 64bit system can address much more memory. However, the memory of the devices is limited, no matter how many bits the OS can address :-D I have a 64 bit system myself and these are the readings. You really should be able to allocate 32M ints, if you have a similar device!

---

<div class="post-metadata">

**Author:** ![pcmaster](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pcmaster](https://forums.developer.nvidia.com/u/pcmaster)\
**Post date:** [April 15, 2010, 11:51pm UTC](https://forums.developer.nvidia.com/t/maximum-data-size-in-opencl/16067/7 "2010-04-15T23:51:06Z")

</div>

Actually no :-) A 64bit system can address much more memory. However, the memory of the devices is limited, no matter how many bits the OS can address :-D I have a 64 bit system myself and these are the readings. You really should be able to allocate 32M ints, if you have a similar device!
