LLNL / LEAP

comprehensive library of 3D transmission Computed Tomography (CT) algorithms with Python API and fully integrated with PyTorch
https://leapct.readthedocs.io
MIT License
74 stars 8 forks source link

Compile error No cuda toolset found #26

Closed stefenmax closed 3 months ago

stefenmax commented 3 months ago

Hi, thanks for your work. Based on the instruction I already installed cmake 3.29 and visual studio 2019, CUDA version is as follows, but I ran into the compile issue, could you please instruct me how to fix this? And how to use the precompile file? Just put the two file into cmake file folder? libleap.dll libleap.so (leap) PS D:\ssh_down\test_code\recons_code\LEAP> nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Tue_Aug_15_22:09:35_Pacific_Daylight_Time_2023 Cuda compilation tools, release 12.2, V12

(leap) PS D:\ssh_down\test_code\recons_code\LEAP> pip install -v . Using pip 23.3.1 from C:\Users\Shuo_Han\AppData\Local\anaconda3\envs\leap\lib\site-packages\pip (python 3.10) Processing d:\ssh_down\test_code\recons_code\leap Running command python setup.py egg_info

D:\ssh_down\test_code\recons_code\LEAP>rd /s /q win_build

D:\ssh_down\test_code\recons_code\LEAP>mkdir win_build

D:\ssh_down\test_code\recons_code\LEAP>cd win_build

D:\ssh_down\test_code\recons_code\LEAP\win_build>cmake .. -G "Visual Studio 16" -DDEV_MODE=1 CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake.

Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.

-- The C compiler identification is MSVC 19.29.30154.0 -- The CXX compiler identification is MSVC 19.29.30154.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at D:/code/ct recons/cmake-3.29.0-windows-x86_64/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:563 (message): No CUDA toolset found. Call Stack (most recent call first): D:/code/ct recons/cmake-3.29.0-windows-x86_64/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD) D:/code/ct recons/cmake-3.29.0-windows-x86_64/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test) D:/code/ct recons/cmake-3.29.0-windows-x86_64/share/cmake-3.29/Modules/CMakeDetermineCUDACompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID) src/CMakeLists.txt:9 (project)

-- Configuring incomplete, errors occurred!

D:\ssh_down\test_code\recons_code\LEAP\win_build>cmake --build . --config Release Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1009: Project file does not exist. Switch: ALL_BUILD.vcxproj Failed to compile! Preparing metadata (setup.py) ... done ERROR: No .egg-info directory found in C:\Users\Shuo_Han\AppData\Local\Temp\pip-pip-egg-info-8d_p5qgr

stefenmax commented 3 months ago

Another inconvinence for me is that when I run the code in the demo_leaptorch will raise the error ModuleNotFoundError: No module named 'leaptorch' Only when I copy the leaptorch.py and leapctype.py can solve this problem.

kylechampley commented 3 months ago

Thanks for sending the error messages. Unfortunately, I don't understand what went wrong. My best guess is that VS is not working properly.

My co-author is working on making the build process easier. Until then, yes, you can use the precompiled library files. Since you are on Windows, you just need the dll (the libleap.so file is for Linux). Thus to make this work, just copy libleap.dll, leaptorch.py, and leapctype.py into the same folder and add this folder to your Python path. If you want these installed into your Python packages library, you can also just copy them there. Copying them into this folder will make it so that you don't need to add anything to your Python path. You can find the path of this folder with the following commands: import site print(site.getsitepackages()[1])

Note that you always need both leaptorch.py and leapctype.py. The leaptorch.py file only contains the PyTorch wrapper, but all the tomography stuff is in leapctype.py.

Let me know if you have any further questions.

stefenmax commented 3 months ago

Thanks for your help! Hope the build process will be easier in the future.