GPU simple matrix multiplication

조회 수: 14 (최근 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 CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by