def LockGPU(): board = gpu_lock.obtain_lock_id() if board == -1: print 'No GPU board available.' sys.exit(1) else: cm.cuda_set_device(board) cm.cublas_init() return board
def LockGPU(max_retries=10): """ Locks a free GPU board and returns its id. """ for retry_count in range(max_retries): board = gpu_lock.obtain_lock_id() if board != -1: break sleep(1) if board == -1: print 'No GPU board available.' sys.exit(1) else: cm.cuda_set_device(board) cm.cublas_init() return board
def LockGPU(max_retries=10): """ Locks a free GPU board and returns its id. """ for retry_count in range(max_retries): board = gpu_lock.obtain_lock_id() if board != -1: break sleep(1) if board == -1: print 'No GPU board available.' sys.exit(1) else: cm.cuda_set_device(board) cm.cublas_init() return board