pointer arithmetic on host

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;

			}

		}

		// ...

	}

I have never had any problems doing pointer arithmetic for indexing into an allocation of linear device memory. It is impossible to say whether you are doing anything wrong based on that code - there far too much indirection in that code to comment on its workings. To paraphrase an old maxim “All problems in computer science can be solved by another level of indirection… except for the problem of too much indirection”.

Pointer arithmetic on the host is supported (I already detected the bug).