CUDALink allows the Wolfram Language to use the CUDA parallel computing architecture on Graphical Processing Units (GPUs). It contains functions that use CUDA-enabled GPUs to boost performance in a number of areas, such as linear algebra, financial simulation, and image processing. CUDALink also integrates CUDA with existing Wolfram Language development tools, allowing a high degree of automation and control.
This section summarizes the functionality.
Wolfram Language Functions
This describes the Wolfram Language functions provided by CUDALink.
|CUDAQ||determine whether CUDALink is supported|
|CUDAInformation||enumerate all device information|
|CUDADriverVersion||give video driver version|
|$CUDADeviceCount||number of devices on system|
|$CUDALinkPath||path to the CUDALink application|
|$CUDADevice||device used in CUDALink computation|
Functions for querying the setup of CUDALink.
|CUDAResourcesInstall||install the CUDA resources|
|CUDAResourcesInformation||give information on installed CUDA resources|
|CUDAResourcesUninstall||uninstall the CUDA resources|
Functions for installing and uninstalling CUDALink resources.
|CUDAImageConvolve||convolve images with specified kernel|
|CUDABoxFilter||apply the box filter on images|
Filtering functions for image processing using CUDA.
|CUDADilation||apply morphological dilation on images|
|CUDAErosion||apply morphological erosion on images|
|CUDAClosing||apply morphological closing on images|
|CUDAOpening||apply morphological opening on images|
Morphological functions for image processing using CUDA.
|CUDAImageAdd||add two images|
|CUDAImageSubtract||subtract two images|
|CUDAImageMultiply||multiply two images|
|CUDAImageDivide||divide two images|
|CUDAClamp||clamp values of an image between a specified range|
|CUDAColorNegate||invert an image|
Binary operations for image processing using CUDA.
|CUDAFourier||find the Fourier transform|
|CUDAInverseFourier||find the inverse Fourier transform|
Fourier transform operations using CUDA.
|CUDADot||give product of vectors and matrices|
|CUDATranspose||tranpose input matrix|
|CUDAArgMaxList||give the index with maximum absolute element|
|CUDAArgMinList||give the index with minimum absolute element|
|CUDATotal||give the total of the absolute values of a vector|
Linear algebra functions using CUDA.
|CUDAFunction||handle to CUDA function loaded using CUDAFunctionLoad|
|CUDAFunctionLoad||load CUDAFunction into the Wolfram Language|
|CUDAFunctionInformation||get CUDAFunction information|
|NVCCCompiler||compile code using the NVIDIA CUDA compiler|
|CUDACCompilers||give list of supported C compilers installed on system|
|SymbolicCUDAFunction||symbolic representation of a CUDA function|
|SymbolicCUDABlockIndex||symbolic representation of a block index CUDA call|
|SymbolicCUDAThreadIndex||symbolic representation of a thread index CUDA call|
|SymbolicCUDABlockDimension||symbolic representation of a block dimension CUDA call|
|SymbolicCUDACalculateKernelIndex||symbolic representation of a CUDA index calculation|
|SymbolicCUDADeclareIndexBlock||symbolic representation of a CUDA index declaration|
Symbolic representations of CUDA programs.
|CUDAMemory||handle to CUDA memory registered using CUDAMemoryLoad or CUDAMemoryAllocate|
|CUDAMemoryLoad||load Wolfram Language memory into CUDALink returning CUDAMemory|
|CUDAMemoryAllocate||allocate memory for CUDALink returning CUDAMemory|
|CUDAMemoryGet||copy CUDAMemory to the Wolfram Language|
|CUDAMemoryUnload||unload and delete a CUDAMemory handle|
|CUDAMemoryInformation||get CUDAMemory handle information|
|CUDAMemoryCopyToHost||copy CUDAMemory from GPU to CPU|
|CUDAMemoryCopyToDevice||copy CUDAMemory from CPU to GPU|
Functions for working with memory in CUDA.
|CUDAFinancialDerivative||financial option valuation|
|CUDAMap||apply a function to each element on an input list|
|CUDASort||sort input elements|
|CUDAFold||fold input elements|
|CUDAFoldList||fold input elements into a list|
|CUDAVolumetricDataRead||read raw volumetric data to be rendered|
|CUDAVolumetricRender||render volumetric data read|
|CUDAFluidDynamics||compute and render a fluid dynamics simulation|
Example applications of CUDALink.
CUDAQ and CUDAInformation
CUDAInformation gives user information on the hardware. To use, first load the CUDALink application.
This gets information on the CUDA devices on the system.
Similar to other Wolfram Language Q functions, CUDAQ will not return an error on failure. Running CUDAInformation will give an error describing why CUDA failed.
If CUDALink fails, it will return one of the following errors.
|insys||CUDALink is not supported on the system; only "Linux", "Linux-x86-64", "Windows", "Windows-x86-64", "MacOSX-x86", and "MacOSX-x86-64" are supported|
|invdevnm||based on the video card name, the video card is not supported by CUDALink|
|invdirv||an NVIDIA driver library was not found, and CUDALink was not able to determine the NVIDIA driver library path|
|invdrivp||an NVIDIA driver was not found in the NVIDIA library path|
|invdrivver||an NVIDIA driver was found, but the version information cannot be determined|
|invdrivverv||an NVIDIA driver was found, but the version is unsupported|
|invdrivverd||an NVIDIA driver was found, but the version directory cannot be determined|
|syslibfld||loading the CUDA runtime libraries failed|
|initlib||loading the CUDALink library failed|
|init||CUDALink libraries were loaded, but initialization failed|
|nodev||CUDALink was unable to find a device that is CUDA compatible|
CUDALink detection failure error codes.
There are three main reasons for getting False from CUDAQ:
- Unsupported operating system — CUDA is not supported on SUN's Solaris or versions of Apple's OS X earlier than 10.6.3.
CUDALink requires a compatible operating system, hardware, and driver software. This section describes what these are and how to confirm them.
CUDALink is supported on Linux, Linux-x86-64, Windows, Windows-x86-64, Mac OS X-x86, and Mac OS X-x86-64. Mac OS X users need at least Mac OS X 10.6.3.
On Linux, CUDALink requires the system to be run in a runlevel that will load the video drivers. Usually this is default level 5, but on some servers the administrator may need to configure it manually.
CUDALink is supported on all hardware that has CUDA support. If you are not sure of the name of your graphics card, you can see the section on Graphics Card Information.
List of supported devices may be found on the NVIDIA CUDA-Enabled Products page.
Users with ATI or Intel graphics processors will not be able to use CUDA, but might be able to use OpenCL using OpenCLLink.
Graphics Card Information
Detailed information on your graphics can be found in the "Devices" section of SystemInformation, as shown below.
This gives information on the graphics card installed on the system.
If you have trouble finding this, then checking the graphics card is done by either checking the system documentation or going to one of the following:
Checking the NVIDIA Driver
CUDALink has a driver version detection mechanism that is accessible using CUDADriverVersion.
An alternative to this driver detection method is operating-system specific. The following details how to get the driver version on Windows, Linux, and Mac OS X.
If the NVIDIA driver is installed, then the NVIDIA control panel should be in the system's control panel and will give you information. The NVIDIA control panel can be accessed by clicking Start ▶ Control Panel.
Inside the control panel you will see the NVIDIA control panel.
Clicking on that will open windows that allow you to edit the hardware setup.
Clicking System Information in the bottom-left corner will give you the following window.
This tells you the driver version, which is 257.21 on this machine.
If the NVIDIA driver is installed, then running nvidia-settings from the command line will give version information. The following screen capture shows the system running the 256.53 version of the NVIDIA driver, which can be seen in the "NVIDIA Driver Version" system information.
If X is not available, then the following command will tell you the driver version installed.
[abduld@abduldlx ~]$ ls /usr/lib/libnvidia-tls.so.*
The above tells you a non-supported NVIDIA driver 256.53.15 is installed on abduldlx. Note that on some versions of Linux the drivers are installed in /usr/lib64 or in another nondefault location.
Mac OS X
To find the version information on OS X, open the Finder window and go into Applications.
Opening System Preferences will show a CUDA button if the CUDA driver is installed.
Clicking on the CUDA button will show both the CUDA driver and GPU driver versions.