此为 Mathematica 8 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.2)

CUDAMemoryLoad

CUDAMemoryLoad[list]
registers list into the CUDALink memory manager.
CUDAMemoryLoad[img]
registers img into the CUDALink memory manager.
  • The CUDALink application must be loaded using Needs.
  • Possible types for are:
IntegerRealComplex
"Byte""Bit16""Integer"
"Byte[2]""Bit16[2]""Integer32[2]"
"Byte[3]""Bit16[3]""Integer32[3]"
"Byte[4]""Bit16[4]""Integer32[4]"
"UnsignedByte""UnsignedBit16""Float"
"UnsignedByte[2]""UnsignedBit16[2]""Float[2]"
"UnsignedByte[3]""UnsignedBit16[3]""Float[3]"
"UnsignedByte[4]""UnsignedBit16[4]""Float[4]"
"Double""Double[2]""Double[3]"
"Double[4]"
  • The following options can be given:
"Device"$CUDADeviceCUDA device used in computation
"TargetPrecision"Automaticprecision used in computation
First, load the CUDALink application:
This loads memory:
Information about memory can be retrieved using CUDAMemoryInformation:
Memory added must be freed with CUDAMemoryUnload:
First, load the CUDALink application:
In[1]:=
Click for copyable input
This loads memory:
In[2]:=
Click for copyable input
Out[2]=
Information about memory can be retrieved using CUDAMemoryInformation:
In[3]:=
Click for copyable input
Out[3]=
Memory added must be freed with CUDAMemoryUnload:
In[4]:=
Click for copyable input
Adding memory as Real or Complex gets the type based on whether the device supports double precision or not:
In this case, the CUDA device has double-precision support:
The behavior can be forced to change by setting the :
Memory added must be freed with CUDAMemoryUnload:
Images can be added with type :
Getting the memory returns an image with the same properties as the original. Memory is retrieved using CUDAMemoryGet:
The contains the image information:
Memory added must be freed with CUDAMemoryUnload:
Images can be added with specified type:
Getting the memory returns an image:
When adding graphics objects, the object is rasterized:
When getting the memory, an image is returned:
Memory added must be freed with CUDAMemoryUnload:
Adding memory as Real or Complex gets the type based on whether the device supports double precision or not:
This can be overridden by setting the option to either or . In this case, the machine has double-precision hardware, but a is used because the is single:
If type is always single precision, then setting the type as or may be more readable:
This adds two to an input list:
Internally, running a CUDAFunction will load and (if the input is not CUDAMemory) will unload the memory. To demonstrate, this color negates an input image:
This loads the function using CUDAFunctionLoad:
This defines input parameters:
This runs the CUDAFunction: