GPU simple matrix multiplication

12 ビュー (過去 30 日間)
Mike
Mike 2013 年 12 月 23 日
コメント済み: Liutong 2016 年 12 月 24 日
Hi, I have a problem carrying out the most basic matrix multiplication on the GPU. It works fine the 1st time but fails on every successive attempt. On the 2nd attempt the screen goes black for a second or two and then it comes back with the errors shown below. I tried reset(gpuDevice) figuring I need to clear out the data from the last calculation but that just gives additional errors. Any idea how to fix this?
%%%the gpu_mat_mul.m code %%%
tic;
A = gpuArray(Ah);
B = gpuArray(Bh);
C = A * B;
toc
%%%the Matlab output on 1st and 2nd attempt %%%
>> Ah = rand(5000,5000);
>> Bh = rand(5000,5000);
>> run('C:\Users\mschmidt\Documents\MATLAB\gpu_mat_mul.m')
Elapsed time is 0.641242 seconds.
>> Ah = rand(5000,5000);
>> Bh = rand(5000,5000);
>> run('C:\Users\mschmidt\Documents\MATLAB\gpu_mat_mul.m')
Error using gpuArray
An unexpected error occurred during CUDA execution. The CUDA error was:
unknown error
Error in gpu_mat_mul (line 4)
A = gpuArray(Ah);
Error in run (line 63)
evalin('caller', [script ';']);
%%%gpuDevice output %%%
>> gpuDevice
ans =
CUDADevice with properties:
Name: 'GeForce GTX 460'
Index: 1
ComputeCapability: '2.1'
SupportsDouble: 1
DriverVersion: 6
ToolkitVersion: 5
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [65535 65535 65535]
SIMDWidth: 32
TotalMemory: 1.0737e+09
MultiprocessorCount: 7
ClockRateKHz: 1526000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceSelected: 1
  3 件のコメント
Aravind Harikumar
Aravind Harikumar 2016 年 11 月 17 日
編集済み: Aravind Harikumar 2016 年 11 月 17 日
Ah = rand(5000,5000); Bh = rand(5000,5000);
A = gpuArray(Ah); B = gpuArray(Bh); C = A * B;
I was trying to do the above matrix mutiplication in GPU. It runs the first time without any problem, however, the second time I run it, I get the following error.
Error using gpuArray An unexpected error occurred during CUDA execution. The CUDA error was: CUDA_ERROR_LAUNCH_FAILED
So, I tried the following commands: 1) gpuDevice([]) and gpuDevice(0) 2) reset(0)
Now, the new error is:
Error using gpuArray An unexpected error occurred during CUDA execution. The CUDA error was: all CUDA-capable devices are busy or unavailable.
None of them seems o release the lock on the GPU.
Could you please help me?
Liutong
Liutong 2016 年 12 月 24 日
same issue with me

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGPU Computing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by