Skip to content

Conversation

lcy-seso
Copy link
Contributor

@lcy-seso lcy-seso commented Jan 15, 2025

Added a CMake variable USER_CUDA_ARCH_LIST to allow users to specify CUDA architectures manually.

If this variable is not set, CMake will automatically detect the CUDA architecture of the underlying machine and build the dynamic library accordingly.

Set the TORCH_CUDA_ARCH_LIST environment variable to the desired architecture. CMake will automatically read this value from the environment.

for example:

dynamic library is built for sm_75 and sm_80:

export TORCH_CUDA_ARCH_LIST="7.5 8.0"
python3 setup.py develop 2>&1 | tee build.log

dynamic library is built for local GPU:

python3 setup.py develop 2>&1 | tee build.log

@lcy-seso lcy-seso force-pushed the fix_build branch 2 times, most recently from 68ac37e to 0de76e6 Compare January 15, 2025 03:05
@lcy-seso lcy-seso marked this pull request as draft January 15, 2025 03:23
@lcy-seso lcy-seso force-pushed the fix_build branch 3 times, most recently from 85429fe to 51cea95 Compare January 15, 2025 05:17
@lcy-seso lcy-seso marked this pull request as ready for review January 15, 2025 05:51
@lcy-seso lcy-seso requested a review from YangWang92 January 15, 2025 05:55
@YangWang92
Copy link
Contributor

Added a CMake variable USER_CUDA_ARCH_LIST to allow users to specify CUDA architectures manually.

If this variable is not set, CMake will automatically detect the CUDA architecture of the underlying machine and build the dynamic library accordingly.

Set the TORCH_CUDA_ARCH_LIST environment variable to the desired architecture. CMake will automatically read this value from the environment.

for example:

dynamic library is built for sm_75 and sm_80:

export TORCH_CUDA_ARCH_LIST="7.5 80"
python3 setup.py develop 2>&1 | tee build.log

dynamic library is built for local GPU:

python3 setup.py develop 2>&1 | tee build.log

Should I update export TORCH_CUDA_ARCH_LIST="7.5 80" as export TORCH_CUDA_ARCH_LIST="7.5 8.0" to aviod error?

@lcy-seso
Copy link
Contributor Author

Added a CMake variable USER_CUDA_ARCH_LIST to allow users to specify CUDA architectures manually.
If this variable is not set, CMake will automatically detect the CUDA architecture of the underlying machine and build the dynamic library accordingly.
Set the TORCH_CUDA_ARCH_LIST environment variable to the desired architecture. CMake will automatically read this value from the environment.
for example:
dynamic library is built for sm_75 and sm_80:

export TORCH_CUDA_ARCH_LIST="7.5 80"
python3 setup.py develop 2>&1 | tee build.log

dynamic library is built for local GPU:

python3 setup.py develop 2>&1 | tee build.log

Should I update export TORCH_CUDA_ARCH_LIST="7.5 80" as export TORCH_CUDA_ARCH_LIST="7.5 8.0" to aviod error?

my typo. It should be "export TORCH_CUDA_ARCH_LIST="7.5 8.0" required by cuda_select_nvcc_arch_flags

@YangWang92 YangWang92 changed the title fix(cmake): building dynamic library for specified GPU architectures. fix(cmake): building dynamic library for specified GPU architectures and support multi threads compile Jan 16, 2025
@YangWang92
Copy link
Contributor

Thanks for your help!

@YangWang92 YangWang92 merged commit 5eda679 into microsoft:main Jan 16, 2025
7 checks passed
@lcy-seso lcy-seso deleted the fix_build branch January 16, 2025 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants