|
SOLUTIONS
|
OpenCLMemoryLoad
OpenCLMemoryLoad[list]
loads list into OpenCLMemory manager, returning an OpenCLMemory.
![]()
loads list with specified type into OpenCLMemory manager, returning an OpenCLMemory.
DetailsDetails
- The OpenCLLink application must be loaded using Needs["OpenCLLink`"].
- Valid
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" "Float" "UnsignedByte[2]" "UnsignedBit16[2]" "Float[2]" "UnsignedByte[4]" "UnsignedBit16[4]" "Float[4]" "UnsignedByte[8]" "UnsignedBit16[8]" "Float[8]" "UnsignedByte[16]" "UnsignedBit16[16]" "Float[16]" "Double" "Double[2]" "Double[4]" "Double[8]" "Double[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
ExamplesExamplesopen allclose all
Basic Examples (5)Basic Examples (5)
First, load the OpenCLLink application:
| In[1]:= |
This registers the list ConstantArray[0, 10] into the OpenCLLink memory manager:
| In[2]:= |
| Out[2]= |
Vector types can be loaded, but they must obey the width requirement of the type (
has a width of 16, for example):
| In[1]:= |
| Out[1]= |
| In[2]:= |
| Out[2]= | ![]() |
An error is returned otherwise:
Images can be loaded as OpenCLMemory:
| In[1]:= |
| Out[1]= |
By default, images are represented as a list of integers; different types can be used, however:
| In[2]:= |
| Out[2]= |
When adding graphics objects, the object is rasterized:
| In[1]:= |
| Out[1]= |
When getting the memory, an image is returned:
| In[2]:= |
| Out[2]= |
When using the type
, whether it is a
or
is based on the OpenCL device:
| In[1]:= |
| Out[1]= |
In this case, the system supports double precision. This can be overridden using the
option:
| In[2]:= |
| Out[2]= |


