I’m have a bug on my application which I think might have to do with pointer arithmetic.
So my question is: Is (device) pointer arithmetic on the host supported?
I’m also copying the source code here, because maybe I’m doing something wrong (I’m doing pointer arithmetic on m and lgSpaceNet):
// ...
// CUDA_FLOATING_TYPE is defined as float
CUDA_FLOATING_TYPE * m = (neuronsWithSelectiveActivation == NULL) ? NULL : outputLayerSpaceNetwork->outputs.Pointer();
CUDA_FLOATING_TYPE * lgSpaceNet = (neuronsWithSelectiveActivation == NULL) ? NULL : outputLayerSpaceNetwork->localGradient.Pointer();
// ...
for (int ln = 1; (l = nextLayer) != NULL; ln++) {
// ...
CUDA_FLOATING_TYPE * ml = NULL;
CUDA_FLOATING_TYPE * lgSpaceNetl = NULL;
if (m != NULL) {
int numberNeuronsWithSelectiveActivation = neuronsWithSelectiveActivation[ln];
if(numberNeuronsWithSelectiveActivation > 0) {
ml = m;
lgSpaceNetl = lgSpaceNet;
// POINTER ARITHMETIC HERE (m and lgSpaceNet are device pointers)
m += numberNeuronsWithSelectiveActivation;
lgSpaceNet += numberNeuronsWithSelectiveActivation;
}
}
// ...
}