refactor out all device code into svm_device.cu