Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTranslate2 cmake error when trying to build the code from source with cuda support enabled on Windows. #1697

Closed
prasad-pr-20 opened this issue May 14, 2024 · 6 comments

Comments

@prasad-pr-20
Copy link

HI All,

When I try to install CTranslate2 from source on windows with CUDA, I get the below error.
I've installed Intel oneDNN, oneAPI, CUDA and CUDNN.
I'm mostly following the steps provided in prepare_build_environment_windows.sh
Is it because of the updated CMAKE support for CUDA based on Policy CMP0146. unable to proceed with building the code.
Any help or suggestions regarding this is greatly appreciated.
Thanks in advance.

Versions of Software being Used:

  • Cmake: 3.29.3
  • oneAPI: 2024.1.0
  • CUDA: V12.4
  • CUDNN: v8.8
  • oneDNN: v3.5.0

Below are the steps to reproduce:

  1. git clone --recursive https://github.com/OpenNMT/CTranslate2.git
  2. set CTRANSLATE_ROOT=C:\Users\username\Downloads\Ctranslate2
  3. mkdir build
  4. cd build
  5. cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%CTRANSLATE2_ROOT% -DCMAKE_PREFIX_PATH="C:\Program Files (x86)\intel\oneAPI;C:\Program Files (x86)\oneDNN" -DBUILD_CLI=OFF -DWITH_DNNL=ON -DWITH_CUDA=ON -DWITH_CUDNN=ON -DCCMAKE_PREFIX_PATH="C:\Program Files (x86)\intel\oneAPI" -DCUDNN=ON -DCUDA_TOOLKIT_ROOT_DIR=%CUDA_ROOT% -DCUDA_DYNAMIC_LOADING=ON -DCUDA_NVCC_FLAGS="-Xfatbin=-compress-all" -DCUDA_ARCH_LIST=" Common" -DCUDNN_LIBRARY="%CUDA_PATH%\lib" -DCUDNN_INCLUDE_DIR="%CUDA_PATH%\include" -DCUDNN_LIBRARIES="%CUDA_PATH%\lib" ..

CTRANSLATE2_error

@panosk
Copy link
Contributor

panosk commented May 14, 2024

Hi,

There is an extra blank space in front of Common here:

-DCUDA_ARCH_LIST=" Common"

Remove it and try again.

@prasad-pr-20
Copy link
Author

prasad-pr-20 commented May 14, 2024

HI @panosk,
Thanks for the quick reply.
Upon fixing the space in the flag DCUDA_ARCH_LIST param, the cmake works, but the cmake build kind of goes into infinite loop and the build never completes.
I mostly observe these warnings such as Command line warning D9025: overriding '/W3' with '/W4' [CTranslate2\build\ctranslate 2.vcxproj]
Command used for build is cmake --build . --target install --config Release --parallel 6
Any suggestions. Thanks again.

@panosk
Copy link
Contributor

panosk commented May 14, 2024

Ignore these warnings, that's not the problem. Check carefully your variables. I see you are setting

set CTRANSLATE_ROOT=C:\Users\username\Downloads\Ctranslate2

but in the CMake command you are defining

-DCMAKE_INSTALL_PREFIX=%CTRANSLATE2_ROOT%

Also, try one step at a time, try to only build without install:

cmake --build . --config Release --parallel 6

@prasad-pr-20
Copy link
Author

prasad-pr-20 commented May 14, 2024

Thanks @panosk for pointing it out. I did as suggested. Yet when I perform a fresh cmake, I do get this warning
CMake Warning at CMakeLists.txt:641 (target_link_libraries): Target "ctranslate2" requests linking to directory "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/lib". Targets may link only to libraries. CMake is dropping the item..

And I'm still facing the same situation where the build never completes. Any thoughts on the same.

@panosk
Copy link
Contributor

panosk commented May 14, 2024

The message is self-explanatory as you are defining -DCUDNN_LIBRARY="%CUDA_PATH%\lib" as a library but it's a directory. Try to simplify your CMake command. If you have installed everything properly (oneAPI, CUDA, etc), then all paths should already be set in your system and you don't have to set them again in the CMake command. Try this for example (make sure to first set CTRANSLATE2_ROOT correctly as the installation directory):

cmake -DCMAKE_INSTALL_PREFIX=%CTRANSLATE2_ROOT% -DBUILD_CLI=OFF -DWITH_DNNL=ON -DWITH_CUDA=ON -DWITH_CUDNN=ON -DCUDA_DYNAMIC_LOADING=ON ..

@prasad-pr-20
Copy link
Author

Thank you @panosk. Reducing the number of flags being passed helped in fixing the issue. Also, I wasn't using CUDA. So removing those flags also helped.

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

No branches or pull requests

2 participants