memory access

Hey there,

I keep having these unspecified launch failures when accessing data from a kernel from a pointer.

What am I doing wrong?

struct KcFeatureArray

{

  int count;

  float* x;

  float* y;

  float* val;

  int* prev;

};

__global__ void RepairFeatureArray(KcFeatureArray* res, int size)

{

  res->count = size;

  res->x = (float*)(res + 1);

  res->y = (float*)(res->x + res->count);

  res->val = (float*)(res->y + res->count);

  res->prev = (int*)(res->val + res->count);

}

...

KcFeatureArray* devFeatures;

cudaMalloc((void**)&devFeatures, sizeof(KcFeatureArray) + (3 * sizeof(float) + sizeof(int)) * 100);

RepairFeatureArray <<< 1, 1 >>>(devFeatures, 100);

someOtherKernel <<< .... >>>(...);

When I access any of the devFeatures pointers in the other kernel, unspecified launch failure occurs.

I know that it occurs when accessing unallocated memory or memory not belonging to the application

but I can’t seem to fix it.

Thanks for the help

What does this line do:

res->x = (float*)(res + 1);

?

I’m a little confused by what your kernel’s purpose is. Why is every thread working on the same struct?

I rewrote the whole thing and it is now ok. I probably assigned a wrong pointer or something like that