Move Cuda initialization code into one place for reuse by other projects