CUDA - Maple Programming Help

Home : Support : Online Help : System : CUDA Package : CUDA/Enable

CUDA

 Enable
 turn on or turn off CUDA(R) acceleration

 Calling Sequence Enable( bool )

Parameters

 bool - ( truefalse ) turn on or turn off CUDA acceleration

Description

 • The Enable function turns Compute Unified Device Architecture (CUDA) acceleration on and off. By default, CUDA acceleration is turned off.
 • Note: The Enable function returns the previous setting for CUDA acceleration. For example, if you run the CUDA:-Enable(true) function when CUDA acceleration is turned off, CUDA acceleration will then be turned on, but the function will return a value of  false because CUDA acceleration was previously turned off. See the examples below.
 • If your computer does not support CUDA, an error will be displayed. For more information about supported hardware, see Supported Hardware for CUDA Acceleration.

Examples

Run these examples on a computer that supports CUDA.

 > $n≔4000:$
 > $\mathrm{M1}≔\mathrm{LinearAlgebra}:-\mathrm{RandomMatrix}\left(n,n,\mathrm{datatype}=\mathrm{float}[4]\right):$
 > $\mathrm{M2}≔\mathrm{LinearAlgebra}:-\mathrm{RandomMatrix}\left(n,n,\mathrm{datatype}=\mathrm{float}[4]\right):$
 > $\mathrm{CUDA}:-\mathrm{IsEnabled}\left(\right)$
 ${\mathrm{false}}$ (1)
 > $\mathrm{tNoCUDA}≔\mathrm{time}[\mathrm{real}]\left(\mathrm{M1}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{M2}\right)$
 ${\mathrm{tNoCUDA}}{≔}{13.823}$ (2)
 > $\mathrm{CUDA}:-\mathrm{Enable}\left(\mathrm{true}\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{CUDA}:-\mathrm{IsEnabled}\left(\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{tCUDA}≔\mathrm{time}[\mathrm{real}]\left(\mathrm{M1}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{M2}\right)$
 ${\mathrm{tCUDA}}{≔}{1.163}$ (5)
 > $\mathrm{evalf}\left(\frac{\mathrm{tNoCUDA}}{\mathrm{tCUDA}}\right)$
 ${11.88564058}$ (6)
 > $\mathrm{CUDA}:-\mathrm{Enable}\left(\mathrm{false}\right)$
 ${\mathrm{true}}$ (7)
 > $\mathrm{CUDA}:-\mathrm{IsEnabled}\left(\right)$
 ${\mathrm{false}}$ (8)