execute GPU kernel from CPU threads "unspecified launch failure"


In my program, I need to set data to the card (global memory) once, at program init. Then I called a kernel in a loop to process the data. That works fine. But now I need to call the kernel from a thread and it seems I cannot acces the global variables anymore. Is anyone has an idea ?

CUDATriangle* gTriangles;

// Called from the program

extern "C" void cudaSetTriangleList(const void* pTrianglesPtr, int pNbTriangles)


    CUDA_SAFE_CALL(cudaMalloc((void**)&gTriangles, sizeof(CUDATriangle)*pNbTriangles));

    CUDA_SAFE_CALL(cudaMemcpy(gTriangles, pTrianglesPtr, pNbTriangles*sizeof(CUDATriangle), cudaMemcpyHostToDevice));


// Called frome the program

extern "C" void executeKernel()


    kernel<<< grid, threads>>>(gTriangles); //works fine


// Thread

static CUT_THREADPROC solverThread(CUDAParameters* pParam)


    kernel<<< grid, threads>>>(gTriangles); //unspecified launch failure




Search the programming guide and the reference manual for “context”. I’m currently investigating this myself.