MATLAB 帮助中心
本页采用了机器翻译。点击此处可查看最新英文版本。
重置 GPU 设备并清除其内存
reset(gpudev)
reset(gpudev) 重置 GPU 设备并清除其内存中的 gpuArray 和 CUDAKernel 数据。由 gpudev 识别出的 GPU 设备仍然是选定的设备,但 MATLAB® 中代表该设备上的数据的所有 gpuArray 和 CUDAKernel 对象均无效。设备的 CachePolicy 属性被重置为默认值。有关详细信息,请参阅 gpuDevice。
gpudev
gpuArray
CUDAKernel
CachePolicy
gpuDevice
示例
全部折叠
选择 GPU 设备并创建 gpuArray。
D = gpuDevice; M = eye(4,"gpuArray")
M = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
重置设备。
reset(D);
表明该设备仍然被选中。
D
D = CUDADevice with properties: Name: 'NVIDIA RTX A5000' Index: 1 (of 2) ComputeCapability: '8.6' DriverModel: 'TCC' TotalMemory: 25544294400 (25.54 GB) AvailableMemory: 23952556032 (23.95 GB) DeviceAvailable: true DeviceSelected: true Show all properties.
表明 gpuArray 变量名仍在 MATLAB 工作区中。
whos
Name Size Bytes Class Attributes D 1x1 8 parallel.gpu.CUDADevice M 4x4 0 gpuArray
尝试显示 gpuArray。
M
M = Data no longer exists on the GPU.
清除变量。
clear M
GPU 设备,指定为 GPUDevice 对象,代表当前选定的设备
GPUDevice
重置 GPU 设备后,设备上代表数组或内核的任何变量均无效;您应该清除或重新定义它们。
全部展开
backgroundPool
ThreadPool
该函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
在 R2012a 中推出
gpuDevice | gpuArray | CUDAKernel
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处