def initialize_gpu(): from cudamat import cudamat as cm global cm # this class wraps matrix operations so that you can switch between numpy and cuda operations cm.cuda_set_device(0) cm.init()