Some fixes to the code all around and make sure to initialize cublas along with the device.