File tree 2 files changed +18
-0
lines changed 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,24 @@ def use_debug_mode():
79
79
_get_cuda_arch_flags ,
80
80
)
81
81
82
+ # =====================================================================================
83
+ # CUDA Architecture Settings
84
+ # =====================================================================================
85
+ # If TORCH_CUDA_ARCH_LIST is not set during compilation, PyTorch tries to automatically
86
+ # detect architectures from available GPUs. This can fail when:
87
+ # 1. No GPU is visible to PyTorch
88
+ # 2. CUDA is available but no device is detected
89
+ #
90
+ # To resolve this, you can manually set CUDA architecture targets:
91
+ # export TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6+PTX"
92
+ #
93
+ # Adding "+PTX" to the last architecture enables JIT compilation for future GPUs.
94
+ # =====================================================================================
95
+ if "TORCH_CUDA_ARCH_LIST" not in os .environ and torch .version .cuda :
96
+ # Set to common architectures for CUDA 12.x compatibility
97
+ os .environ ["TORCH_CUDA_ARCH_LIST" ] = "7.0;7.5;8.0;8.6;8.9;9.0,10.0+PTX"
98
+ print (f"Setting default TORCH_CUDA_ARCH_LIST={ os .environ ['TORCH_CUDA_ARCH_LIST' ]} " )
99
+
82
100
IS_ROCM = (torch .version .hip is not None ) and (ROCM_HOME is not None )
83
101
84
102
You can’t perform that action at this time.
0 commit comments