OpenCLMemoryLoad
OpenCLMemoryLoad[list]
loads list into OpenCLMemory manager, returning an OpenCLMemory.
OpenCLMemoryLoad[list,type]
loads list with specified type into OpenCLMemory manager, returning an OpenCLMemory.
Details and Options
- The OpenCLLink application must be loaded using Needs["OpenCLLink`"].
- Valid OpenCLMemoryLoad types are:
-
Integer Real Complex "Byte" "Bit16" "Integer" "Byte[2]" "Bit16[2]" "Integer32[2]" "Byte[4]" "Bit16[4]" "Integer32[4]" "Byte[8]" "Bit16[8]" "Integer32[8]" "Byte[16]" "Bit16[16]" "Integer32[16]" "UnsignedByte" "UnsignedBit16" "UnsignedInteger" "UnsignedByte[2]" "UnsignedBit16[2]" "UnsignedInteger[2]" "UnsignedByte[4]" "UnsignedBit16[4]" "UnsignedInteger[4]" "UnsignedByte[8]" "UnsignedBit16[8]" "UnsignedInteger[8]" "UnsignedByte[16]" "UnsignedBit16[16]" "UnsignedInteger[16]" "Double" "Float" "Integer64" "Double[2]" "Float[2]" "Integer64[2]" "Double[4]" "Float[4]" "Integer64[4]" "Double[8]" "Float[8]" "Integer64[8]" "Double[16]" "Float[16]" "Integer64[16]" - OpenCLMemory can be queried using OpenCLMemoryInformation.
- OpenCLMemory is retrieved using OpenCLMemoryGet.
- OpenCLMemory is unloaded using OpenCLMemoryUnload.
- OpenCLMemoryAllocate is used when memory needs to be allocated to be written to, such as output memory.
- The following options can be given:
-
"Device" Automatic OpenCL device used in computation "Platform" Automatic OpenCL platform used in computation "TargetPrecision" Automatic precision used in computation
Examples
open allclose allBasic Examples (5)Summary of the most common use cases
First, load the OpenCLLink application:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-crcp6r
This registers the list ConstantArray[0,10] into the OpenCLLink memory manager:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-ghbd1f

Vector types can be loaded, but they must obey the width requirement of the type ("Byte[16]" has a width of 16, for example):

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-c8o5ao


https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-fo53h7

An error is returned otherwise:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-g8gobn



Images can be loaded as OpenCLMemory:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-gv09

By default, images are represented as a list of integers; different types can be used, however:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-dfe1wh

When adding graphics objects, the object is rasterized:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-nkjny0

When getting the memory, an image is returned:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-19qj3

When using the type Real, whether it is a "Float" or "Double" is based on the OpenCL device:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-m1c8

In this case, the system supports double precision. This can be overridden using the "TargetPrecision" option:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-cd15h

Options (3)Common values & functionality for each option
"Device" (1)
"Platform" (1)
"TargetPrecision" (1)
The target precision can be used to tell OpenCLLink how to interpret the Real type. By default, it is determined by detecting whether the system has double-precision support:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-ecx7wk

This system has double-precision support:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-i0jmn1

The Real type is interpreted as a "Double". To force the use of "Float", one sets the "TargetPrecision" to "Single":

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-xnm96

Applications (2)Sample problems that can be solved with this function
This adds two to an input list:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-k8h4l

This loads the function using OpenCLFunctionLoad:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-ce6n09

This runs OpenCLFunction:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-jhy32g

This gets the memory using OpenCLMemoryGet:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-b107nh

This unloads the memory using OpenCLMemoryUnload:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-lgkbk1
Internally, OpenCLMemoryLoad is used to load memory behind the scenes. This color negates an input image:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-lva4m5
This loads the function using OpenCLFunctionLoad:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-eoy5m3

This defines input parameters:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-ipmruc
This runs OpenCLFunction:

https://wolfram.com/xid/0cewhkl4xs6a84rqsmphy8c4i-e0a8rs

Wolfram Research (2010), OpenCLMemoryLoad, Wolfram Language function, https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMemoryLoad.html.
Text
Wolfram Research (2010), OpenCLMemoryLoad, Wolfram Language function, https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMemoryLoad.html.
Wolfram Research (2010), OpenCLMemoryLoad, Wolfram Language function, https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMemoryLoad.html.
CMS
Wolfram Language. 2010. "OpenCLMemoryLoad." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMemoryLoad.html.
Wolfram Language. 2010. "OpenCLMemoryLoad." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMemoryLoad.html.
APA
Wolfram Language. (2010). OpenCLMemoryLoad. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMemoryLoad.html
Wolfram Language. (2010). OpenCLMemoryLoad. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMemoryLoad.html
BibTeX
@misc{reference.wolfram_2025_openclmemoryload, author="Wolfram Research", title="{OpenCLMemoryLoad}", year="2010", howpublished="\url{https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMemoryLoad.html}", note=[Accessed: 23-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_openclmemoryload, organization={Wolfram Research}, title={OpenCLMemoryLoad}, year={2010}, url={https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMemoryLoad.html}, note=[Accessed: 23-May-2025
]}