rocm_sdk_builder icon indicating copy to clipboard operation
rocm_sdk_builder copied to clipboard

build failed: pytorch_audio

Open mluckau opened this issue 9 months ago • 8 comments

Hello,

I am using manjaro and after several hours of compiling I get this error.

...
copying src/torio/lib/__init__.py -> build/lib.linux-x86_64-cpython-311/torio/lib
creating build/lib.linux-x86_64-cpython-311/torio/utils
copying src/torio/utils/__init__.py -> build/lib.linux-x86_64-cpython-311/torio/utils
copying src/torio/utils/ffmpeg_utils.py -> build/lib.linux-x86_64-cpython-311/torio/utils
running build_ext
-- The C compiler identification is Clang 17.0.0
-- The CXX compiler identification is Clang 17.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/rocm_sdk_612/bin/hipcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rocm_sdk_612/bin/hipcc - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS - Success
HIP VERSION: 6.1.40093

***** ROCm version from /opt/rocm_sdk_612/.info/version-dev ****

ROCM_VERSION_DEV: 6.1.2
ROCM_VERSION_DEV_MAJOR: 6
ROCM_VERSION_DEV_MINOR: 1
ROCM_VERSION_DEV_PATCH: 2

***** Library versions from dpkg *****


***** Library versions from cmake find_package *****

hip VERSION: 6.1.40093
hsa-runtime64 VERSION: 1.14.60302
amd_comgr VERSION: 2.8.0
CMake Error at cmake/LoadHIP.cmake:138 (find_package):
  By not providing "Findrocrand.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "rocrand", but
  CMake did not find one.

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

    rocrandConfig.cmake
    rocrand-config.cmake

  Add the installation prefix of "rocrand" to CMAKE_PREFIX_PATH or set
  "rocrand_DIR" to a directory containing one of the above files.  If
  "rocrand" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  cmake/LoadHIP.cmake:197 (find_package_and_print_version)
  CMakeLists.txt:75 (include)


-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
  File "/home/michael/AI/rocm_sdk_builder/src_projects/pytorch_audio/setup.py", line 143, in <module>
    _main()
  File "/home/michael/AI/rocm_sdk_builder/src_projects/pytorch_audio/setup.py", line 99, in _main
    setup(
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
    self.run_command(cmd)
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/wheel/_bdist_wheel.py", line 387, in run
    self.run_command("build")
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
    self.distribution.run_command(command)
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 132, in run
    self.run_command(cmd_name)
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
    self.distribution.run_command(command)
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/home/michael/AI/rocm_sdk_builder/src_projects/pytorch_audio/tools/setup_helpers/extension.py", line 101, in run
    super().run()
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
    _build_ext.run(self)
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
    self.build_extensions()
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions
    self._build_extensions_serial()
  File "/opt/rocm_sdk_612/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/michael/AI/rocm_sdk_builder/src_projects/pytorch_audio/tools/setup_helpers/extension.py", line 184, in build_extension
    subprocess.check_call(["cmake", str(_ROOT_DIR)] + cmake_args, cwd=self.build_temp)
  File "/opt/rocm_sdk_612/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/home/michael/AI/rocm_sdk_builder/src_projects/pytorch_audio', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_PREFIX_PATH=/opt/rocm_sdk_612/lib/python3.11/site-packages/torch/share/cmake', '-DCMAKE_INSTALL_PREFIX=/home/michael/AI/rocm_sdk_builder/src_projects/pytorch_audio/build/lib.linux-x86_64-cpython-311/', '-DCMAKE_VERBOSE_MAKEFILE=ON', '-DPython_INCLUDE_DIR=/opt/rocm_sdk_612/include/python3.11', '-DBUILD_CPP_TEST=OFF', '-DBUILD_SOX:BOOL=ON', '-DBUILD_RIR:BOOL=ON', '-DBUILD_RNNT:BOOL=ON', '-DBUILD_ALIGN:BOOL=ON', '-DBUILD_CUDA_CTC_DECODER:BOOL=OFF', '-DBUILD_TORCHAUDIO_PYTHON_EXTENSION:BOOL=ON', '-DBUILD_TORIO_PYTHON_EXTENSION:BOOL=ON', '-DUSE_ROCM:BOOL=ON', '-DUSE_CUDA:BOOL=OFF', '-DUSE_OPENMP:BOOL=ON', '-DUSE_FFMPEG:BOOL=ON', '-GNinja']' returned non-zero exit status 1.
build failed: pytorch_audio
  error in build cmd: ./build_rocm.sh /opt/rocm_sdk_612

mluckau avatar Mar 27 '25 10:03 mluckau

Can you verify that you have this file?

/opt/rocm_sdk_612/rocrand/lib64/cmake/rocrand-config.cmake

I believe that the Manjaro can not find the rocrand-config.cmake file until we fix one search path in the pytoch_audio's cmake/LoadHIP.cmake file. There seems to be a lot of distro specific differences how exactly the search paths needs to be specified. Apparently manjaro's cmake does not automatically search both the lib and lib64.

So the fix is most likely that you need to change in file

src_projects/pytorch_audio/cmake/LoadHIP.cmake the line 182

from set(rocrand_DIR ${ROCRAND_PATH}/lib/cmake/rocrand) to set(rocrand_DIR ${ROCRAND_PATH}/lib64/cmake/rocrand)

Similar lib to lib64 change may also be needed for couple of other libs below it. (hiprand, rocblas, miopen, rocfft, hipfft)

and then call the ./babs.sh -b again.

If you can verify if this helps, I can make a patch for fix it later for all. After pytorch-audio there is only a couple of more packages left to build, so you are almost there :-)

Mika

lamikr avatar Mar 27 '25 21:03 lamikr

Hello, thank you very much for your reply.

Yes, I have rocrand-config.cmake in the path. See screenshot.

Image

I have customized src_projects/pytorch_audio/cmake/LoadHIP.cmake according to your instructions, but I still get the same error when I run ./babs.sh -b

File src_projects/pytorch_audio/cmake/LoadHIP.cmake

...
message("\n***** Library versions from cmake find_package *****\n")

  set(CMAKE_HCC_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
  set(CMAKE_HCC_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
  ### Remove setting of Flags when FindHIP.CMake PR #558 is accepted.###

  set(hip_DIR ${HIP_PATH}/lib/cmake/hip)
  set(hsa-runtime64_DIR ${ROCM_PATH}/lib/cmake/hsa-runtime64)
  set(AMDDeviceLibs_DIR ${ROCM_PATH}/lib/cmake/AMDDeviceLibs)
  set(amd_comgr_DIR ${ROCM_PATH}/lib/cmake/amd_comgr)
  set(rocrand_DIR ${ROCRAND_PATH}/lib64/cmake/rocrand)
  set(hiprand_DIR ${HIPRAND_PATH}/lib64/cmake/hiprand)
  set(rocblas_DIR ${ROCBLAS_PATH}/lib64/cmake/rocblas)
  set(miopen_DIR ${MIOPEN_PATH}/lib64/cmake/miopen)
  set(rocfft_DIR ${ROCFFT_PATH}/lib64/cmake/rocfft)
  set(hipfft_DIR ${HIPFFT_PATH}/lib64/cmake/hipfft)
  set(hipsparse_DIR ${HIPSPARSE_PATH}/lib/cmake/hipsparse)
  set(rccl_DIR ${RCCL_PATH}/lib/cmake/rccl)
  set(rocprim_DIR ${ROCPRIM_PATH}/lib/cmake/rocprim)
  set(hipcub_DIR ${HIPCUB_PATH}/lib/cmake/hipcub)
  set(rocthrust_DIR ${ROCTHRUST_PATH}/lib/cmake/rocthrust)

  find_package_and_print_version(hip REQUIRED)
  find_package_and_print_version(hsa-runtime64 REQUIRED)
...

mluckau avatar Mar 27 '25 23:03 mluckau

Thanks for testing. How about if you add

set(CMAKE_MODULE_PATH ${ROCM_PATH}/rocrand/lib64/cmake ${CMAKE_MODULE_PATH})

under this line: set(CMAKE_MODULE_PATH ${HIP_PATH}/cmake ${CMAKE_MODULE_PATH})

And if that does not work, then maybe copying the lib64 dir to lib for rocrand as a workaround...

cp -ax /opt/rocm_sdk_612/rocrand/lib64 /opt/rocm_sdk_612/rocrand/lib
cp -ax /opt/rocm_sdk_612/lib64/cmake/rocrand/ /opt/rocm_sdk_612/lib/cmake/

lamikr avatar Mar 28 '25 10:03 lamikr

@mluckau I installed on yesterday the Manjaro-gnome Linux and updated it to latest version with "pacman -Syu" command. As an additional packages I only installed the ssh-server, geany, net-tools and vim before starting to build the rocm_sdk 6.1.2 from the master branch.

I noticed that couple of dependencies were missing (bison and patch) and onnxruntime needed also one patch for fixing the unused variable error that occurred on Manjaro. Unfortunately did not see the same error that occurred for you when I build the pytorch-audio.

Can you try to run the

sudo pacman -Syu ./babs.sh -up ./install_debs.sh ./babs.sh -rs binfo/core/039_04_pytorch_audio.binfo ./babs.sh -b

to check if that could fix your problem on manjaro?

lamikr avatar Mar 30 '25 20:03 lamikr

Im getting the same error on cachyos

Thanks for testing. How about if you add

set(CMAKE_MODULE_PATH ${ROCM_PATH}/rocrand/lib64/cmake ${CMAKE_MODULE_PATH})

under this line: set(CMAKE_MODULE_PATH ${HIP_PATH}/cmake ${CMAKE_MODULE_PATH})

And if that does not work, then maybe copying the lib64 dir to lib for rocrand as a workaround...

cp -ax /opt/rocm_sdk_612/rocrand/lib64 /opt/rocm_sdk_612/rocrand/lib
cp -ax /opt/rocm_sdk_612/lib64/cmake/rocrand/ /opt/rocm_sdk_612/lib/cmake/

Ive tried this and the fix above and nothing changed.

oldschoola avatar Apr 08 '25 23:04 oldschoola

`CMake Error at cmake/LoadHIP.cmake:139 (find_package): By not providing "Findmiopen.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "miopen", but CMake did not find one.

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

miopenConfig.cmake
miopen-config.cmake

Add the installation prefix of "miopen" to CMAKE_PREFIX_PATH or set "miopen_DIR" to a directory containing one of the above files. If "miopen" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): cmake/LoadHIP.cmake:201 (find_package_and_print_version) CMakeLists.txt:75 (include) `

oldschoola avatar Apr 08 '25 23:04 oldschoola

i ran paru -S hiprand paru -S hipsparse paru -S miopen paru -S rocfft and it got around the issue

oldschoola avatar Apr 09 '25 00:04 oldschoola

alright so for anyone who has the same issue the problem was not only the lib64 dir name it was also that the last dir did not exist so that part becomes like this

set(hip_DIR ${HIP_PATH}/lib/cmake/hip)
set(hsa-runtime64_DIR ${ROCM_PATH}/lib/cmake/hsa-runtime64)
set(AMDDeviceLibs_DIR ${ROCM_PATH}/lib/cmake/AMDDeviceLibs)
set(amd_comgr_DIR ${ROCM_PATH}/lib/cmake/amd_comgr)
set(rocrand_DIR ${ROCRAND_PATH}/lib64/cmake)
set(hiprand_DIR ${HIPRAND_PATH}/lib64/cmake)
set(rocblas_DIR ${ROCBLAS_PATH}/lib64/cmake)
set(miopen_DIR ${MIOPEN_PATH}/lib64/cmake)
set(rocfft_DIR ${ROCFFT_PATH}/lib64/cmake)
set(hipfft_DIR ${HIPFFT_PATH}/lib64/cmake)
set(hipsparse_DIR ${HIPSPARSE_PATH}/lib64/cmake)
set(rccl_DIR ${RCCL_PATH}/lib64/cmake)
set(rocprim_DIR ${ROCPRIM_PATH}/lib64/cmake)
set(hipcub_DIR ${HIPCUB_PATH}/lib/cmake/hipcub)
set(rocthrust_DIR ${ROCTHRUST_PATH}/lib/cmake/rocthrust)

I am also on cachyos with the latest cmake version 4.0.1

running4ever avatar Apr 23 '25 18:04 running4ever