Skip to content

Instantly share code, notes, and snippets.

@e96031413
Created August 27, 2020 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e96031413/1ce462b7ad4e456a43f8e17e58d3f4da to your computer and use it in GitHub Desktop.
Save e96031413/1ce462b7ad4e456a43f8e17e58d3f4da to your computer and use it in GitHub Desktop.
兩個指定使用哪一顆GPU的方法
# CLI
! CUDA_VISIBLE_DEVICES=1 python train.py
# Inside train.py
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
# 執行時,會出現GPU的編號,此編號並非實際GPU序號,而是把第1張GPU當成第0張使用
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment