CUDALink`
CUDALink`

CUDAMemoryLoad

CUDAMemoryLoad[list]

registers list into the CUDALink memory manager.

CUDAMemoryLoad[img]

registers img into the CUDALink memory manager.

Details and Options

  • The CUDALink application must be loaded using Needs["CUDALink`"].
  • Possible types for CUDAMemoryLoad 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""UnsignedInteger"
    "UnsignedByte[2]""UnsignedBit16[2]""UnsignedInteger[2]"
    "UnsignedByte[3]""UnsignedBit16[3]""UnsignedInteger[3]"
    "UnsignedByte[4]""UnsignedBit16[4]""UnsignedInteger[4]"
    "Double""Float""Integer64"
    "Double[2]""Float[2]""Integer64[2]"
    "Double[3]""Float[3]""Integer64[3]"
    "Double[4]""Float[4]""Integer64[4]"
  • The following options can be given:
  • "Device"$CUDADeviceCUDA device used in computation
    "TargetPrecision" Automaticprecision used in computation

Examples

open allclose all

Basic Examples  (1)

First, load the CUDALink application:

This loads memory:

Information about memory can be retrieved using CUDAMemoryInformation:

Memory added must be freed with CUDAMemoryUnload:

Scope  (4)

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 "TargetPrecision":

Memory added must be freed with CUDAMemoryUnload:

Images can be added with type "UnsignedByte":

Getting the memory returns an image with the same properties as the original. Memory is retrieved using CUDAMemoryGet:

The "TypeInformation" 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:

Options  (1)

"TargetPrecision"  (1)

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 "TargetPrecision" option to either "Single" or "Double". In this case, the machine has double-precision hardware, but a "Float" is used because the "TargetPrecision" is single:

If type is always single precision, then setting the type as "Float" or "ComplexFloat" may be more readable:

Applications  (2)

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:

Wolfram Research (2010), CUDAMemoryLoad, Wolfram Language function, https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryLoad.html.

Text

Wolfram Research (2010), CUDAMemoryLoad, Wolfram Language function, https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryLoad.html.

CMS

Wolfram Language. 2010. "CUDAMemoryLoad." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryLoad.html.

APA

Wolfram Language. (2010). CUDAMemoryLoad. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryLoad.html

BibTeX

@misc{reference.wolfram_2024_cudamemoryload, author="Wolfram Research", title="{CUDAMemoryLoad}", year="2010", howpublished="\url{https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryLoad.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_cudamemoryload, organization={Wolfram Research}, title={CUDAMemoryLoad}, year={2010}, url={https://reference.wolfram.com/language/CUDALink/ref/CUDAMemoryLoad.html}, note=[Accessed: 22-November-2024 ]}