Skip to content

Commit

Permalink
fix --cuda-device arg for AMD/HIP devices (comfyanonymous#5586)
Browse files Browse the repository at this point in the history
* fix --cuda-device arg for AMD/HIP devices

CUDA_VISIBLE_DEVICES is ignored for HIP devices/backend. Instead it uses HIP_VISIBLE_DEVICES. Setting this environment variable has no side effect for CUDA/NVIDIA so it can safely be set in any case and vice versa.

* deleted accidental if
  • Loading branch information
Bratzmeister authored and tiangles committed Nov 29, 2024
1 parent 1f4c49d commit 9a1c191
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def execute_script(script_path):
if __name__ == "__main__":
if args.cuda_device is not None:
os.environ['CUDA_VISIBLE_DEVICES'] = str(args.cuda_device)
os.environ['HIP_VISIBLE_DEVICES'] = str(args.cuda_device)
logging.info("Set cuda device to: {}".format(args.cuda_device))

if args.deterministic:
Expand Down

0 comments on commit 9a1c191

Please sign in to comment.