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:
-
Integer Real Complex "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" $CUDADevice CUDA device used in computation "TargetPrecision" Automatic precision used in computation
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
First, load the CUDALink application:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-9h8a50
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-gx5ylq
Information about memory can be retrieved using CUDAMemoryInformation:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-b5djh4
Memory added must be freed with CUDAMemoryUnload:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-v6awl
Scope (4)Survey of the scope of standard use cases
Adding memory as Real or Complex gets the type based on whether the device supports double precision or not:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-i3s3n
In this case, the CUDA device has double-precision support:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-bw94si
The behavior can be forced to change by setting the "TargetPrecision":
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-dy3zea
Memory added must be freed with CUDAMemoryUnload:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-g0x787
Images can be added with type "UnsignedByte":
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-bdni9a
Getting the memory returns an image with the same properties as the original. Memory is retrieved using CUDAMemoryGet:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-f6m7ff
The "TypeInformation" contains the image information:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-wgp1p
Memory added must be freed with CUDAMemoryUnload:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-kbiqbh
Images can be added with specified type:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-c7g9v2
Getting the memory returns an image:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-ydrs4
When adding graphics objects, the object is rasterized:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-nkjny0
When getting the memory, an image is returned:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-19qj3
Memory added must be freed with CUDAMemoryUnload:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-o1f700
Options (1)Common values & functionality for each option
"TargetPrecision" (1)
Adding memory as Real or Complex gets the type based on whether the device supports double precision or not:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-cicc8x
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:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-g51ig2
If type is always single precision, then setting the type as "Float" or "ComplexFloat" may be more readable:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-mf33a5
Applications (2)Sample problems that can be solved with this function
This adds two to an input list:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-k8h4l
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-ce6n09
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-jhy32g
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-b107nh
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-lgkbk1
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:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-lva4m5
This loads the function using CUDAFunctionLoad:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-eoy5m3
This defines input parameters:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-ipmruc
This runs the CUDAFunction:
https://wolfram.com/xid/07981s5bs56fzzudyfmhb3a66-e0a8rs
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.
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.
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
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: 10-January-2025
]}
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: 10-January-2025
]}