tom:

ctypes.c_void_p


Thank you so much to both of you for the quick answers!
With both of the fixes it’s running properly now.
Also thanks for the tip to check the pointer going across the ctypes boundary, that made it really obvious:
Ap 0x7fd311400000 Ac tensor([1., 1., 1.], device='cuda:0') Ac.shape torch.Size([3])
Got A pointer 0x11400000 n 3 threads 4