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

Error in building ITK by enabling RTK #4406

Closed
navami123nair opened this issue Jan 17, 2024 · 13 comments
Closed

Error in building ITK by enabling RTK #4406

navami123nair opened this issue Jan 17, 2024 · 13 comments

Comments

@navami123nair
Copy link

Hi,
I am new in using ITK-RTK for image reconstruction. I wanted to run the example code in RTK using CPU and GPU, so initially I configured ITK V5.3.0 for CPU and it was successful. But now I am trying to run the CUDA based example code in RTK for which I have configured ITK_USE_GPU as well as RTK_USE_CUDA. But unfortunately the build fails.

MY ITK version was 5.3.0 and then I tried to configure using Version 5.1.0 and my CUDA version was V12.3, then I tried to configure with V11.8, but still build fails. The error is "Texture is not a Template". Now when I tried to build ITK only with ITK_USE_GPU enabled, the following build error occurred.

 "810>itkGPUDemonsRegistrationFilterTest.obj : error LNK2019: unresolved external symbol "public: static char const * __cdecl itk::GPUDenseFiniteDifferenceImageFilterKernel::GetOpenCLSource(void)" (?GetOpenCLSource@GPUDenseFiniteDifferenceImageFilterKernel@itk@@SAPEBDXZ) referenced in function "public: static char const * __cdecl itk::GPUDenseFiniteDifferenceImageFilter<class itk::GPUImage<class itk::Vector<float,2>,2>,class itk::GPUImage<class itk::Vector<float,2>,2>,class itk::DemonsRegistrationFilter<class itk::GPUImage<float,2>,class itk::GPUImage<float,2>,class itk::GPUImage<class itk::Vector<float,2>,2> > >::GetOpenCLSource(void)" (?GetOpenCLSource@?$GPUDenseFiniteDifferenceImageFilter@V?$GPUImage@V?$Vector@M$01@itk@@$01@itk@@V12@V?$DemonsRegistrationFilter@V?$GPUImage@M$01@itk@@V12@V?$GPUImage@V?$Vector@M$01@itk@@$01@2@@2@@itk@@SAPEBDXZ)
810>itkGPUDemonsRegistrationFilterTest2.obj : error LNK2001: unresolved external symbol "public: static char const * __cdecl itk::GPUDenseFiniteDifferenceImageFilterKernel::GetOpenCLSource(void)" (?GetOpenCLSource@GPUDenseFiniteDifferenceImageFilterKernel@itk@@SAPEBDXZ)" 

This is just two of the error messages shown. Please help me with a solution. Thanks in advance.

Copy link

Thank you for contributing an issue! 🙏

Welcome to the ITK community! 🤗👋☀️

We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜
Also, please check existing open issues and consider discussion on the ITK Discourse. 📖

This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it.

@SimonRit
Copy link

The issue title is surprising since the reported error is not related to RTK. RTK is not compatible with Cuda 12 yet, see RTKConsortium/RTK#549. RTK is only compatible with the latest ITK release and ITK master at the time of the release.

@navami123nair
Copy link
Author

navami123nair commented Jan 17, 2024

Yes I have read this https://discourse.itk.org/t/about-gpu-version-compilation-of-rtk/5905/9 So I have configured using CUDA version 11.8, but still the same error persists.

@SimonRit
Copy link

Do you mean the one reported above? As you point out, it's here without RTK and I suggest renaming the issue

@navami123nair navami123nair changed the title Error in ITK -Not able to build RTK Error in building ITK by enabling RTK Jan 17, 2024
@navami123nair
Copy link
Author

Actually I did not understand what you said. I need to do a project using RTK for which I am trying to study it by executing the example codes. Since I used ITK v5.3.0 and you suggest to use the latest version, I am going to try with the same.

@navami123nair
Copy link
Author

While configuring ITK in cmake, should I enable Module_CudaCommon.

@navami123nair
Copy link
Author

navami123nair commented Jan 17, 2024

With the latest ITK version I am not able to configure RTK_USE_CUDA. The error coming are


CMake Error at 753 (message):  Compiling the CUDA compiler identification source file
  "CMakeCUDACompilerId.cu" failed.  Build flags: 
   Id flags: --keep;--keep-dir;tmp -v
 
 
 
   The output was:
 
   1
 
   MSBuild version 17.7.2+d6990bcfa for .NET Framework
 
   Build started 1/17/2024 2:45:03 PM. Project on
   node 1 (default targets).
 
   PrepareForBuild: Creating directory "Debug\".
     Creating directory "Debug\CompilerIdCUDA.tlog\".
 
   InitializeBuildStatus: Creating "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
     Touching "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild". error : The CUDA Toolkit v12.3 directory does not exist.  Please
   verify the CUDA Toolkit is installed properly or define the CudaToolkitDir
   property to resolve this error.  Build FAILED.(ValidateCudaBuild target) -> error : The CUDA Toolkit v12.3 directory does not exist.  Please verify the CUDA Toolkit is installed properly or define the CudaToolkitDir property to resolve this error.  0 Warning(s)
       1 Error(s)
 
  
 
   Time Elapsed 00:00:00.17
 
 Call Stack (most recent call first): 8 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
 53 (__determine_compiler_id_test)
 307 (CMAKE_DETERMINE_COMPILER_ID)
 29 (enable_language)
 374 (include)
   CMakeLists.txt:583 (include)
 
 
 Configuring incomplete, errors occurred!

How to resolve this issue.

@SimonRit
Copy link

There seems to be a problem with your Cuda installation?
CudaCommon is automatically enabled by RTK.

@navami123nair
Copy link
Author

I once again installed CUDA V11.8, and tried to configure ITK-Master but at the initial stage itself it failed to configure. So next I tried with ITK V5.4. Now Module_RTK and ITK_USE_GPU were configured and build, but moving on to build RTK_USE_CUDA it fails. What should I do now?

@SimonRit
Copy link

The error you posted above suggests that CMake cannot find Cuda. This should be reproducible with a simple CMakeLists.txt file such as

cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
project(CudaTest)
find_package(CUDAToolkit REQUIRED)

Can you check if you can configure this project with cmake? Which version of cmake are you using BTW?

@navami123nair
Copy link
Author

navami123nair commented Jan 19, 2024

My Cmake version is 3.27.8.

@navami123nair
Copy link
Author

The
cmake_minimum_required(VERSION 3.17 FATAL_ERROR) project(CudaTest) find_package(CUDAToolkit REQUIRED)
is configuring without any issue. In ITK configuration issue is persisting when RTK_USE_CUDA is enabled.

@navami123nair
Copy link
Author

Hi,
The issue was resolved. I had CUDA v12.3 as well as v11.8 in my system, due to which the CUDA issue occurred. I have uninstalled CUDA v12.3 and then again configured ITK using CMake and now I am able to configure and build RTK_USE_CUDA and was able to run the GPU example program in RTK.

Thank you for all the support. Since the problem is resolved, I am closing this issue.

Regards,
Navami S Nair.

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