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

Unable to compile with ZFP_WITH_CUDA=TRUE on Windows #244

Open
kminemur opened this issue Nov 14, 2024 · 8 comments
Open

Unable to compile with ZFP_WITH_CUDA=TRUE on Windows #244

kminemur opened this issue Nov 14, 2024 · 8 comments

Comments

@kminemur
Copy link

kminemur commented Nov 14, 2024

Hi team,

I'm trying to compiler zfp with CUDA on Windows system, however I'm getting link error of "LINK : fatal error LNK1104: cannot open file 'stdc++.lib'". I could compiler it on Ubuntu22.04 environemt.

Does zfp with CUDA only support Linux environment?

Steps
install CUDA Toolkit 12.5
git clone zfp
cd zfp; mkdir zfp; cd zfp
cmake .. -DZFP_WITH_CUDA=TRUE
cmake --build .

@lindstro
Copy link
Member

There's no reason I'm aware of why zfp cannot be built with CUDA support on Windows. We unfortunately do not have a CUDA-capable Windows machine that would allow us to reproduce the issue, but it seems unlikely that the issue is related to zfp.

Perhaps you can include the full CMake output to see if it gives any other hints? Also, what version of CMake are you using? What host compiler and version? Is the compiler compatible with CUDA 12.5? See https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html for requirements. Can you successfully build any of the CUDA code samples?

@kminemur
Copy link
Author

kminemur commented Nov 15, 2024

cmake out log is as follows:

cmake --version
cmake version 3.29.5-msvc4

cmake .. -DZFP_WITH_CUDA=TRUE --log-level=VERBOSE
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.42.34433.0
-- The CXX compiler identification is MSVC 19.42.34433.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.42.34433/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/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Compiling with C standard: 90
-- Compiling with C++ standard: 98
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0") found components: C
CMake Warning (dev) at CMakeLists.txt:205 (find_package):
Policy CMP0146 is not set: The FindCUDA module is removed. Run "cmake
--help-policy CMP0146" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

This warning is for project developers. Use -Wno-dev to suppress it.

-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.5 (found version "12.5")
-- Performing Test HAVE_MATH
-- Performing Test HAVE_MATH - Success
-- Configuring done (18.2s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/MTL/kazuki/zfp/build

@lindstro
Copy link
Member

So the CMake warning is related to #232, which we will fix in the next release. Still, CUDA is found, so presumably that's not the cause.

From NVIDIA docs, your compiler should be compatible with CUDA 12.5. But please do attempt to build one or more of the CUDA code samples to verify that this is not a zfp specific issue. It would also be instructive to test if zfp builds with CUDA disabled (-DZFP_WITH_CUDA=OFF).

@kminemur
Copy link
Author

kminemur commented Nov 25, 2024

Hi, sorry for late response.

CUDA code samples can be compiled without any issue on my env.
zfp builds with CUDA disabled also can be build on my env.

thank you for sharing #232, I will keep an eye on it.

Thanks.

@lindstro
Copy link
Member

I just noticed this CMake line:

zfp/src/CMakeLists.txt

Lines 44 to 46 in a46fa8b

if(ZFP_WITH_CUDA)
target_link_libraries(zfp PRIVATE ${CUDA_CUDART_LIBRARY} stdc++)
endif()

What happens if you comment this out?

@kminemur
Copy link
Author

kminemur commented Nov 26, 2024

Not working, got linking error.

e.g. error LNK2019: unresolved external symbol cudaGetLastError referenced in function "bool __cdecl cuZFP::is_gpu_ptr(void const *)" (?is_gpu_ptr@cuZFP@@YA_NPEBX@Z)

Btw, I think you can check it on your windows system by just installing CUDA Toolkits.

@lindstro
Copy link
Member

cudaGetLastError is quite clearly part of the CUDA API, so there's something more fundamental going on here. It may be useful to make VERBOSE=1 (not sure what the Windows equivalent is) to capture the compiler flags being used with zfp and the CUDA examples to see how they differ.

If that reveals nothing, perhaps we just need to wait for #232 to be merged and see if that resolves the issue. However, we're not at a very good point to merge that PR (see discussion there).

Btw, I think you can check it on your windows system by just installing CUDA Toolkits.

We don't have access to a Windows machine with an NVIDIA GPU, so that is unfortunately not an option.

@kminemur
Copy link
Author

kminemur commented Nov 26, 2024

I mean just compiling without NVIDA GPU. Issue here is code generation.
I will wait the fix then.

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