[GH-ISSUE #54] Add a instruction for configuring CUDA_HOME and CUDA_PATH to the install section of README.md. #30

Closed
opened 2026-10-29 14:32:48 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @hyx1999 on GitHub (Aug 27, 2024).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/54

I tried to compile kTransformers based on the source code, but the compilation failed.

ninja: error: '/lib64/libcudart.so', needed by '/home/xxx/projects/ktransformers/build/lib.linux-x86_64-cpython-311/cpuinfer_ext.cpython-311-x86_64-linux-gnu.so', missing and no known rule to make it

This error is caused by line 226 in ktransformers/ktransforms_ext/CMakeLists.txt, which links libcudart.so from CUDA_HOME by default. However, in my environment, I configured CUDA through PATH and LD_LIBRRY_PATH.

pybind11_add_module(${PROJECT_NAME} MODULE ${ALL_SOURCES})
target_link_libraries(${PROJECT_NAME} PRIVATE llama)
if(WIN32)
    target_link_libraries(${PROJECT_NAME} PRIVATE "$ENV{CUDA_PATH}/lib/x64/cudart.lib")
elseif(UNIX)
    target_link_libraries(${PROJECT_NAME} PRIVATE "$ENV{CUDA_HOME}/lib64/libcudart.so") # this line cause ERROR
endif()

After setting CUDA_HOME, I successfully compiled the project. Therefore, the configuration instructions for CUDA_HOME are preferred to be added to README.md.

And, can I propose a PR to add these configuration instructions?

Originally created by @hyx1999 on GitHub (Aug 27, 2024). Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/54 I tried to compile kTransformers based on the source code, but the compilation failed. ``` ninja: error: '/lib64/libcudart.so', needed by '/home/xxx/projects/ktransformers/build/lib.linux-x86_64-cpython-311/cpuinfer_ext.cpython-311-x86_64-linux-gnu.so', missing and no known rule to make it ``` This error is caused by line 226 in ktransformers/ktransforms_ext/CMakeLists.txt, which links libcudart.so from CUDA_HOME by default. However, in my environment, I configured CUDA through PATH and LD_LIBRRY_PATH. ```cmake pybind11_add_module(${PROJECT_NAME} MODULE ${ALL_SOURCES}) target_link_libraries(${PROJECT_NAME} PRIVATE llama) if(WIN32) target_link_libraries(${PROJECT_NAME} PRIVATE "$ENV{CUDA_PATH}/lib/x64/cudart.lib") elseif(UNIX) target_link_libraries(${PROJECT_NAME} PRIVATE "$ENV{CUDA_HOME}/lib64/libcudart.so") # this line cause ERROR endif() ``` After setting CUDA_HOME, I successfully compiled the project. Therefore, the configuration instructions for CUDA_HOME are preferred to be added to README.md. And, can I propose a PR to add these configuration instructions?
Author
Owner

@UnicornChan commented on GitHub (Aug 28, 2024):

Thank you very much. We welcome PR to improve our project. about the README here, could you please set the reminder in the README to the "Quick Start" section under "Install CUDA"?
At the same time, We will also improve our CMakeLists file.

<!-- gh-comment-id:2313930829 --> @UnicornChan commented on GitHub (Aug 28, 2024): Thank you very much. We welcome PR to improve our project. about the README here, could you please set the reminder in the README to the "Quick Start" section under "Install CUDA"? At the same time, We will also improve our CMakeLists file.
Author
Owner

@hyx1999 commented on GitHub (Aug 28, 2024):

Thank you for your reply! I have submitted a PR request to add a reminder to set CUDA_HOME and CUDA_PATH.

<!-- gh-comment-id:2314220226 --> @hyx1999 commented on GitHub (Aug 28, 2024): Thank you for your reply! I have submitted a PR request to add a reminder to set CUDA_HOME and CUDA_PATH.
Author
Owner

@GavinZhang0228 commented on GitHub (Feb 18, 2025):

碰到了一些类似的问题,在安装使用install.sh 的时候 因为CUDA_HOME的存在 导致CUDA_PATH和PATH不生效了,因为我的CUDA_HOME指向了一个已经卸载的老版本CUDA,于是报错No such file or directory (但是其实我好像已经删除了这个环境变量 但是不知道为什么还生效)在重新写了一个CUDA_HOME的变量覆盖路径之后解决了

<!-- gh-comment-id:2666735287 --> @GavinZhang0228 commented on GitHub (Feb 18, 2025): 碰到了一些类似的问题,在安装使用install.sh 的时候 因为CUDA_HOME的存在 导致CUDA_PATH和PATH不生效了,因为我的CUDA_HOME指向了一个已经卸载的老版本CUDA,于是报错No such file or directory (但是其实我好像已经删除了这个环境变量 但是不知道为什么还生效)在重新写了一个CUDA_HOME的变量覆盖路径之后解决了
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/ktransformers#30
No description provided.