Skip to content

Installation and linking problem with AdpativeCpp compiler with CUDA backend #661

Open
@CFD-Xing

Description

@CFD-Xing

Summary

When using the AdaptiveCpp compiler, I am experiencing two problems. First, during installation (compilation works fine), Cmake is unable to find the Compiler package. However, this package doesn't seem to be necessary and editing oneMathConfig.cmake as follow seems to solve the problem:

Original:

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
include(CMakeFindDependencyMacro)

# try to search for SYCLConfig first to find compiler. If it's not present, use local FindCompiler.cmake
find_package(SYCL QUIET)
if(NOT ${SYCL_FOUND})
  find_package(Compiler REQUIRED)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/oneMathTargets.cmake")

Corrected:

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
include(CMakeFindDependencyMacro)

# try to search for SYCLConfig first to find compiler. 
find_package(SYCL QUIET)

include("${CMAKE_CURRENT_LIST_DIR}/oneMathTargets.cmake")

Second, I am experiencing liking problem when using Cmake in my project as follow:

SET(ONEMATH_DEPENDS ONEMATH::onemath)

because the acpp-rt runtine can't be found. Them problem seems to be the hipSYCL namespace needing to be updated to AdaptiveCpp

Manually editing the oneMathTargets.cmake file as follow seems to fix the problem:

Original:

set_target_properties(ONEMATH::onemath_blas_cublas_obj PROPERTIES
  INTERFACE_COMPILE_FEATURES "cxx_std_11"
  INTERFACE_INCLUDE_DIRECTORIES "/home/jxing1/nektar-bis/ThirdParty/oneMath/include;/home/jxing1/nektar-bis/build-acpp-cuda/ThirdParty/oneMath/bin"
  INTERFACE_LINK_LIBRARIES "ONEMATH::SYCL::SYCL;ONEMATH::cuBLAS::cuBLAS;\$<LINK_ONLY:hipSYCL::acpp-rt>"
)

...
set_target_properties(ONEMATH::onemath_blas PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:hipSYCL::acpp-rt>"
) 

Corrected:

set_target_properties(ONEMATH::onemath_blas_cublas_obj PROPERTIES
  INTERFACE_COMPILE_FEATURES "cxx_std_11"
  INTERFACE_INCLUDE_DIRECTORIES "/home/jxing1/nektar-bis/ThirdParty/oneMath/include;/home/jxing1/nektar-bis/build-acpp-cuda/ThirdParty/oneMath/bin"
  INTERFACE_LINK_LIBRARIES "ONEMATH::SYCL::SYCL;ONEMATH::cuBLAS::cuBLAS;\$<LINK_ONLY:AdaptiveCpp::acpp-rt>"
)

...
set_target_properties(ONEMATH::onemath_blas PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:AdaptiveCpp::acpp-rt>"
) 

Version

Report oneMath version and githash.
If it is a regression, report githash for the last known good revision.

Environment

oneMath works with multiple HW and backend libraries and also depends on the
compiler and build environment. Include
the following information to help reproduce the issue:

  • HW you use
  • Backend library version
  • OS name and version
  • Compiler version
  • CMake output log

Steps to reproduce

                cmake ${TPSRC}/oneMath 
                -B ${TPBUILD}/oneMath
                -DCMAKE_CXX_COMPILER=path-to-acpp-compiler
                -DCMAKE_C_COMPILER=path-to-acpp-compiler
                -DCMAKE_CXX_FLAGS="--acpp-targets=cuda:sm_80
                -DOPENCL_INCLUDE_DIR=/apps/cuda/12.6.2
                -DhipSYCL_DIR=${TPBUILD}/AdaptiveCpp/lib/cmake/hipSYCL
                -DHIPSYCL_TARGETS=cuda:sm_80
                -DONEMATH_SYCL_IMPLEMENTATION=hipsycl
                -DENABLE_GENERIC_BLAS_BACKEND=OFF
                -DENABLE_ARMPL_BACKEND=OFF
                -DENABLE_NETLIB_BACKEND=OFF
                -DENABLE_MKLCPU_BACKEND=OFF
                -DENABLE_MKLGPU_BACKEND=OFF
                -DENABLE_CUBLAS_BACKEND=ON 
                -DENABLE_CUFFT_BACKEND=OFF 
                -DENABLE_CURAND_BACKEND=OFF 
                -DENABLE_CUSOLVER_BACKEND=OFF
                -DENABLE_CUSPARSE_BACKEND=OFF
                -DENABLE_ROCBLAS_BACKEND=OFF
                -DENABLE_ROCFFT_BACKEND=OFF
                -DENABLE_ROCRAND_BACKEND=OFF
                -DENABLE_ROCSOLVER_BACKEND=OFF
                -DENABLE_ROCSPARSE_BACKEND=OFF
                -DBUILD_FUNCTIONAL_TESTS=OFF
                -DBUILD_EXAMPLES=OFF
                -DCMAKE_INSTALL_PREFIX:PATH=${TPDIST})

Observed behavior

Problem 1:

CMake Error at build-acpp-cuda/ThirdParty/oneMath/oneMathConfig.cmake:26 (find_package):
  By not providing "FindCompiler.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Compiler",
  but CMake did not find one.

  Could not find a package configuration file provided by "Compiler" with any
  of the following names:

    CompilerConfig.cmake
    compiler-config.cmake

  Add the installation prefix of "Compiler" to CMAKE_PREFIX_PATH or set
  "Compiler_DIR" to a directory containing one of the above files.  If
  "Compiler" provides a separate development package or SDK, be sure it has
  been installed

Second problem:

CMake Error at build-acpp-cuda/ThirdParty/oneMath/oneMathTargets.cmake:68 (set_target_properties):
  The link interface of target "ONEMATH::onemath_blas" contains:

    hipSYCL::acpp-rt

  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.

Expected behavior

Document behavior you expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildA request to change/fix/improve the build systemhelp wantedTasks, issues or features that could be implemented and contributed to the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions