ROCm / rocBLAS

Next generation BLAS implementation for ROCm platform
https://rocm.docs.amd.com/projects/rocBLAS/en/latest/
Other
336 stars 157 forks source link

[Bug]: Issue with CMake Configuration for ROCm BLAS #1379

Closed GGKOP closed 8 months ago

GGKOP commented 8 months ago

Description:

I am encountering an issue while configuring ROCm BLAS using CMake. The error message indicates a problem with the HIP C++ compiler (/opt/rocm/bin/hipcc). The specific error is: `-- The CXX compiler identification is unknown -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: /opt/rocm/bin/hipcc -- Check for working CXX compiler: /opt/rocm/bin/hipcc - broken CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message): The C++ compiler

"/opt/rocm/bin/hipcc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/ricky/rocBLAS/build/release/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_b319f/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_b319f.dir/build.make CMakeFiles/cmTC_b319f.dir/build
gmake[1]: Entering directory '/home/ricky/rocBLAS/build/release/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_b319f.dir/testCXXCompiler.cxx.o
/opt/rocm/bin/hipcc    -o CMakeFiles/cmTC_b319f.dir/testCXXCompiler.cxx.o -c /home/ricky/rocBLAS/build/release/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
In file included from <built-in>:1:
In file included from /opt/rocm-6.0.0/lib/llvm/lib/clang/17.0.0/include/__clang_hip_runtime_wrapper.h:50:
/opt/rocm-6.0.0/lib/llvm/lib/clang/17.0.0/include/cuda_wrappers/cmath:27:15: fatal error: 'cmath' file not found
#include_next <cmath>
              ^~~~~~~
1 error generated when compiling for gfx1030.
gmake[1]: *** [CMakeFiles/cmTC_b319f.dir/build.make:78: CMakeFiles/cmTC_b319f.dir/testCXXCompiler.cxx.o] Error 1
gmake[1]: Leaving directory '/home/ricky/rocBLAS/build/release/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_b319f/fast] Error 2

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:35 (project)

-- Configuring incomplete, errors occurred! See also "/home/ricky/rocBLAS/build/release/CMakeFiles/CMakeOutput.log". See also "/home/ricky/rocBLAS/build/release/CMakeFiles/CMakeError.log". Traceback (most recent call last): File "/home/ricky/rocBLAS/./rmake.py", line 517, in main() File "/home/ricky/rocBLAS/./rmake.py", line 505, in main if run_cmd(exe, opts): File "/home/ricky/rocBLAS/./rmake.py", line 473, in run_cmd proc = subprocess.run(program, check=True, stderr=subprocess.STDOUT, shell=True) File "/home/ricky/miniforge3/lib/python3.10/subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command 'cmake -DCMAKE_TOOLCHAIN_FILE=toolchain-linux.cmake -DROCM_DIR:PATH=/opt/rocm -DCPACK_PACKAGING_INSTALL_PREFIX=/opt/rocm -DCMAKE_INSTALL_PREFIX="rocblas-install" -DROCM_PATH=/opt/rocm -DCMAKE_PREFIX_PATH:PATH=/opt/rocm -DCPACK_SET_DESTDIR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_CLIENTS_TESTS=ON -DBUILD_CLIENTS_BENCHMARKS=ON -DBUILD_CLIENTS_SAMPLES=ON -DBUILD_DIR=/home/ricky/rocBLAS/build -DLINK_BLIS=ON -DAMDGPU_TARGETS="all" -DTensile_CODE_OBJECT_VERSION=default -DTensile_LOGIC=asm_full -DTensile_SEPARATE_ARCHITECTURES=ON -DTensile_LAZY_LIBRARY_LOADING=ON -DTensile_LIBRARY_FORMAT=msgpack -DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF /home/ricky/rocBLAS' returned non-zero exit status 1.

Steps to Reproduce:

Clone the ROCm BLAS repository.
 ./install.sh -dc

Additional Information:

Verify that /opt/rocm/bin/hipcc is present and has the correct permissions.

what can I do?

mahmoodw commented 8 months ago

Hello @GGKOP, our team has seen this sort of issue before and it is most commonly caused by a slight version mismatch. Specifically, if gcc-12 is detected but g++12 is not installed, hipcc goes into a fail condition. Please try the following and let us know if you are still facing this issue.

sudo apt install g++-12

GGKOP commented 8 months ago

Your guidance was helpful, and I truly appreciate the support.

I have a couple of additional questions regarding ROCm BLAS, and I was wondering if you could provide some insights: I'm interested in benchmarking with ROCm BLAS. Could you please guide me on the steps or any resources available for performing benchmarks using this library? Additionally, I'd like to delve into the details of convolutions using the ROCm BLAS library. Could you provide some direction or resources on how to use ROCm BLAS to gain insights into convolutional operations?

mahmoodw commented 8 months ago

I am glad to hear that this solution worked for you. I can certainly shine some light and hopefully guide you to the appropriate resources.

As a part of building the rocBLAS library clients (flags -c, --clients), our benchmarking tool rocblas-bench is included. You may use this tool to gather performance on any of our BLAS functions. To start, here is the documentation for the tool:

https://rocm.docs.amd.com/projects/rocBLAS/en/latest/Programmers_Guide.html#rocblas-bench

In terms of convolutions, could you clarify more specifically what application you are referring to? BLAS libraries include L3 functions such as GEMM. These functions can be used by other libraries like MIOpen for arithmetic in the convolutional layers of a neural network. Alternatively, rocFFT would address convolutions by using Fourier transforms. You may need to get in touch with a different team for further insight on your use case.

If this issue has been resolved could you please close this ticket.