Skip to content

Compiling AMGX with NVHPC 25.5 #344

@nibblelab

Description

@nibblelab

Hi,

When trying to compile AMGX with the last release of NVHPC, cmake acuses a problem with "CUDA::nvToolsExt" preventing the process.

I've found a way to bypass this by changing the CMakeLists.txt file from

IF (WIN32)
  target_link_libraries(amgx CUDA::cublas CUDA::cusparse CUDA::cusolver)
  target_link_libraries(amgxsh CUDA::cublas CUDA::cusparse CUDA::cusolver)
ELSE (WIN32)
  target_link_libraries(amgx CUDA::cublas CUDA::cusparse CUDA::cusolver CUDA::nvToolsExt m pthread)
  target_link_libraries(amgxsh CUDA::cublas CUDA::cusparse CUDA::cusolver CUDA::nvToolsExt m pthread)
ENDIF(WIN32)

to

IF (WIN32)
  target_link_libraries(amgx CUDA::cublas CUDA::cusparse CUDA::cusolver)
  target_link_libraries(amgxsh CUDA::cublas CUDA::cusparse CUDA::cusolver)
ELSE (WIN32)
  target_link_libraries(amgx CUDA::cublas CUDA::cusparse CUDA::cusolver m pthread)
  target_link_libraries(amgxsh CUDA::cublas CUDA::cusparse CUDA::cusolver m pthread)
ENDIF(WIN32)

and the file "amgx_timer.h" from

#ifdef NVTX_RANGES
#include "nvToolsExt.h"
#endif

to

#ifdef NVTX_RANGES
#include "nvtx3/nvToolsExt.h"
#endif

With this I've managed to compile AMGX, but I don't know if this is the correct fix. Is this right or am I missing something?

Environment information:

  • OS: Ubuntu 24.04 LTS
  • Compiler version: gcc 14.3.0
  • CMake version: 4.0.2
  • CUDA used for AMGX compilation: CUDA 12.9 - NVHPC 25.5
  • AMGX version or commit hash: v2.4.0

Compilation information

cmake .. -Wno-dev -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release
make

Issue information

The error was happening when running the cmake:

CMake Error at CMakeLists.txt:272 (target_link_libraries):
  Target "amgx" links to:

    CUDA::nvToolsExt

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.



CMake Error at CMakeLists.txt:273 (target_link_libraries):
  Target "amgxsh" links to:

    CUDA::nvToolsExt

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions