We already have gpu/cpu from id, so use that. Likely the current convoluted code is wrong and leading to segfaults!