0

I am trying to launch a 2D grid with dimensions (65535x1000) but cudaDeviceSynchronize returns code error 6 . My device should support up to 65535 block in y dimension so I don't understand what is happening.Here is my code

#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>

cudaError_t addWithCuda();

__global__ void kernel()
{
    int i = blockIdx.x*blockIdx.y;
}

int main()

{

cudaError_t cudaStatus;

// Choose which GPU to run on, change this on a multi-GPU system.
cudaStatus = cudaSetDevice(0);
if (cudaStatus != cudaSuccess) {
    fprintf(stderr, "cudaSetDevice failed!  Do you have a CUDA-capable GPU installed?");
}


// Launch a kernel on the GPU 
dim3 grid(65535,1000) ;
kernel<<<grid, 1024>>>();

// Check for any errors launching the kernel
cudaStatus = cudaGetLastError();
if (cudaStatus != cudaSuccess) {
    fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
}

// cudaDeviceSynchronize waits for the kernel to finish, and returns
// any errors encountered during the launch.
cudaStatus = cudaDeviceSynchronize();

if (cudaStatus != cudaSuccess) {
    fprintf(stderr, "cudaDeviceSynchronize returned error code %d after launching Kernel!\n", cudaStatus);
}

// cudaDeviceReset must be called before exiting in order for profiling and
// tracing tools such as Nsight and Visual Profiler to show complete traces.
cudaStatus = cudaDeviceReset();
if (cudaStatus != cudaSuccess) {
    fprintf(stderr, "cudaDeviceReset failed!");
    return 1;
}
system("pause");
return 0;

}

Youssef Emad
  • 319
  • 2
  • 13
  • 1
    What is your device? Which CUDA version? What is the actual error output string? What happens if you run the CUDA deviceQuery sample on your system? Are you running on windows? – Robert Crovella Sep 27 '15 at 22:12
  • ... and have you already tried small numbers instead of 65535x1000 to check that that is actually related to the problem? –  Sep 27 '15 at 22:14
  • Error 6 is a launch timeout. This code will take a while to run the kernel, probably several seconds or more if you are running a debug project. You are running into a WDDM timeout. – Robert Crovella Sep 28 '15 at 03:25
  • @RobertCrovella My device is Geforce 840m , the cuda_status returned equals 6 and I am running on windows. What is a WDDM timeout ? and how can I avoid this ? – Youssef Emad Sep 28 '15 at 03:42
  • @Hurkyl yes It works fine with smaller numbers – Youssef Emad Sep 28 '15 at 03:42
  • See [this article](https://msdn.microsoft.com/en-us/Library/Windows/Hardware/ff570088(v=vs.85).aspx). There are many questions like this one on the cuda tag as well. – Robert Crovella Sep 28 '15 at 03:45
  • @RobertCrovella I have the other question. It's the same as mine, Thank you – Youssef Emad Sep 28 '15 at 03:56

0 Answers0