My CUDA code stalls when I run it twice in a row

Hi,

I’m new to cuda programming, and I’m facing a peculiar problem while running my code on GPU. The code runs fine the first time. But the second time I run it (i.e. within 20-30 mins ), it stalls indefinitely. If I run it after 30 mins, it again runs fine. This occurs even when I I make no changes in the code between two runs, and even when there are no other users on the machine.

The stall occurs at a structure declaration:
cudaMalloc( (void **)&(d_cuda), sizeof(gpuVars));

The structure definition is:

typedef struct _gpuVars gpuVars;
struct _gpuVars {

int nvol;
int npts;
int nbel;

double fluid_Lx, fluid_Ly, fluid_Lz;
double fluid_nx, fluid_ny, fluid_nz;
double fluid_delta;
int fluid_wallbc;
int fluid_xzbc;
int fluid_nprop;
};

Any help will be appreciated – let me know if you need more information

Thanks in advance

Amitabh

The kernel code will help. I would guess it most likely has to do with your first kernel call than the second.
Do you have 2 GPUs?

The kernel code will help. I would guess it most likely has to do with your first kernel call than the second.
Do you have 2 GPUs?

Thanks for the response. The code stops at line #13 in gpuStruct.cu, and the subroutine is being called from main.cu. The error does not come from the GPU kernel. But yes, I am running on a machine with 2 GPUs

Thanks !

Amitabh
gpuStruct.cu (7.32 KB)
main.cu (5.15 KB)

Thanks for the response. The code stops at line #13 in gpuStruct.cu, and the subroutine is being called from main.cu. The error does not come from the GPU kernel. But yes, I am running on a machine with 2 GPUs

Thanks !

Amitabh