필터 지우기
필터 지우기

CUDA_ERROR_LAUNCH_FAILED when using "gather" function

조회 수: 1 (최근 30일)
Gabriel
Gabriel 2014년 6월 2일
편집: Joss Knight 2014년 6월 16일
Dear all,
I created two cuda functions, each one in a separated .cuh file, that are called from my main .cu program. I am trying to call then inside my Matlab code and everything seems to work fine, until I call the "gather" function, in order to get the variable back to the cpu. It gives me the following error message:
Error using gpuArray/gather An unexpected error occurred during CUDA execution. The CUDA error was: CUDA_ERROR_LAUNCH_FAILED
And this is the only message that Matlab returns to me. The strange thing is that if I call just one function, it works fine. The problem arises if I call the two functions sequentially and try to gather the resulting vector from the graphics card. Here is my example file:
clear all; clc;
kernelK = parallel.gpu.CUDAKernel('femCuda.ptx', 'fem.cuh', 'setK');
kernelKGlobal = parallel.gpu.CUDAKernel('femCuda.ptx', 'fem2.cuh', 'assemblyGlobalStiffness');
nEl = 2;
ndofs = 2;
nNodes = 4;
x = [0. 1. 1. 0.];
y = [0. 0. 1. 1.];
vecE = [1.];
vecNu = [0.];
conect = int32([0 0 1 3 0 1 2 3]);
x = gpuArray(x);
y = gpuArray(y);
conect = gpuArray(conect);
vecE = gpuArray(vecE);
vecNu = gpuArray(vecNu);
K = gpuArray.zeros(36*nEl, 1);
Kglobal = gpuArray.zeros((nNodes*ndofs)*(nNodes*ndofs), 1);
K = feval(kernelK, x, y, conect, vecE, vecNu, nNodes, nEl, nEl, K);
Kglobal = feval(kernelKGlobal, K, nEl, nNodes, conect, nNodes, Kglobal);
If I just use K = feval(kernelK, x, y, conect, vecE, vecNu, nNodes, nEl, nEl, K);, everything works fine. The problem is when I call the two kernels. What can possibly be wrong?
Thank you in advance,
  댓글 수: 1
Joss Knight
Joss Knight 2014년 6월 16일
편집: Joss Knight 2014년 6월 16일
Can you confirm that the second kernel also works in isolation?
If you put wait(gpuDevice) between your two calls, does it start working?
Can you provide your CUDA code, or a minimal version which reproduces the error?

댓글을 달려면 로그인하십시오.

답변 (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