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

clangrt builtins lib not found #336

Closed
jinz2014 opened this issue Jun 26, 2023 · 9 comments · Fixed by #532
Closed

clangrt builtins lib not found #336

jinz2014 opened this issue Jun 26, 2023 · 9 comments · Fixed by #532
Labels
documentation A request to change/fix/improve the documentation

Comments

@jinz2014
Copy link
Contributor

Do users need to install additional library for building rocblas with DPC++ ?

-- CMAKE_BUILD_TYPE: None, set to Release by default
-- C compiler: icx was not found in PATH, using clang instead
-- The CXX compiler identification is Clang 17.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /path/to/dpcpp/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TARGET_DOMAINS: blas
-- Looking for dpc++
-- Performing Test is_dpcpp
-- Performing Test is_dpcpp - Success
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS - Failed
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- hip::amdhip64 is SHARED_LIBRARY
CMake Error at /opt/rocm/hip/lib/cmake/hip/hip-config.cmake:331 (message):
clangrt builtins lib not found
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
/opt/rocm/lib/cmake/rocblas/rocblas-config.cmake:90 (find_dependency)
cmake/FindrocBLAS.cmake:36 (find_package)
src/blas/backends/rocblas/CMakeLists.txt:24 (find_package)

@jinz2014 jinz2014 added the documentation A request to change/fix/improve the documentation label Jun 26, 2023
@JackAKirk
Copy link
Contributor

What was the resolution to this? I've encountered the same issue.

@hjabird
Copy link
Contributor

hjabird commented Jul 27, 2023

I think this issue is normally encountered when using clang++ instead of icpx. I'm not sure what the fix is if you need clang++.

@JackAKirk
Copy link
Contributor

I think this issue is normally encountered when using clang++ instead of icpx. I'm not sure what the fix is if you need clang++.

OK guess it is my job to find out then

@jinz2014
Copy link
Contributor Author

Sorry, I closed the issue because there was no response.

@JackAKirk
Copy link
Contributor

The additional steps required when using open source intel/llvm are:

After configuring as normal, e.g.

python configure.py --hip

go to the generated build folder and adjust your CMakeCache.txt:

  • set LLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON
//Build compiler-rt as an external project.
LLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON
  • add compiler-rt to LLVM_ENABLE_PROJECTS:STRING e.g. :
LLVM_ENABLE_PROJECTS:STRING=...;libclc;compiler-rt

Then build intel/llvm as normal. then when building oneMKL compiler-rt should be found.

@muhammad-tanvir-1211
Copy link
Contributor

A fix that worked for me was either:

  • export LIBRARY_PATH=/path/to/rocm-$rocm-version$/llvm/lib/clang/$clang-version$/lib/linux/:$LIBRARY_PATH
    or
  • directly modifying the CLANGRT_BUILTINS variable in your CmakeCache.txt file to point to the libclang_rt.builtins-x86_64.a file on your machine e.g.
    CLANGRT_BUILTINS:FILEPATH=/path/to/rocm-$rocm-version$/llvm/lib/clang/$clang-version$/lib/linux/libclang_rt.builtins-x86_64.a

Let me know if either of these work for you. Thanks.

@abagusetty
Copy link

A fix that worked for me was either:

* `export LIBRARY_PATH=/path/to/rocm-$rocm-version$/llvm/lib/clang/$clang-version$/lib/linux/:$LIBRARY_PATH`
  or

* directly modifying the `CLANGRT_BUILTINS` variable in your `CmakeCache.txt` file to point to the `libclang_rt.builtins-x86_64.a` file on your machine e.g.
  `CLANGRT_BUILTINS:FILEPATH=/path/to/rocm-$rocm-version$/llvm/lib/clang/$clang-version$/lib/linux/libclang_rt.builtins-x86_64.a`

Let me know if either of these work for you. Thanks.

@muhammad-tanvir-1211 Neither of the above steps worked resulting in the error. Where as explicitly building the compiler-rt external component worked though.

make[2]: *** No rule to make target '/lustre/orion/gen243/scratch/abagusetty/llvm/build/install/lib/clang/18/lib/linux/libclang_rt.builtins-x86_64.a', needed by 'lib/libonemkl_rng_rocrand.so.0'.  Stop.

@lfmeadow
Copy link

lfmeadow commented Sep 1, 2023

I tried a bunch of these tricks. I tried to build LLVM on ORNL Crusher but either I had the wrong banch or the wrong C++ compiler or something, but I gave up after a couple of hours.
I did get Muhammad's CLANGRT_BUILTINS (to the oneMKL CMakeCache.txt file) hack to work.
I also had to build lapack from https://github.com/Reference-LAPACK/lapack using FC=gfortran in order to get MKL to build, even though the documentation suggests you need it only if you want to test. It's tricky to get lapack to build on Cray system, definitely can't use their wrappers. Fortunately the performance didn't matter.

@jinz2014
Copy link
Contributor Author

Thank you for your solutions to the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation A request to change/fix/improve the documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants