예제 #1
0
파일: gpu.py 프로젝트: jakesnell/myshkin
def get_board():
    board_id = gg.obtain_lock_id()
    if board_id < 0:
        time.sleep(10)
        board_id = gg.obtain_lock_id() # try again
        if board_id < 0:
            raise Exception("could not obtain lock")
        else:
            return board_id
    else:
        return board_id
예제 #2
0
def LockGPU(max_retries=10, board=-1):
    retry_count = 0
    while board == -1 and retry_count < max_retries:
        board = gpu_lock.obtain_lock_id()
        if board == -1:
            sleep(1)
            retry_count += 1
    if board == -1:
        print 'No GPU board available.'
        sys.exit(1)
    else:
        cm.cuda_set_device(board)
        cm.cublas_init()
    return board
예제 #3
0
파일: util.py 프로젝트: Luna86/RNN-DDCRP
def LockGPU(max_retries=10, board=-1):
  retry_count = 0
  while board == -1 and retry_count < max_retries:
    board = gpu_lock.obtain_lock_id()
    if board == -1:
      sleep(1)
      retry_count += 1
  if board == -1:
    print 'No GPU board available.'
    sys.exit(1)
  else:
    cm.cuda_set_device(board)
    cm.cublas_init()
  return board