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

Libtorch build for ROCM error: “aten/src/THH” not exist #126640

Open
Fovini opened this issue May 19, 2024 · 2 comments
Open

Libtorch build for ROCM error: “aten/src/THH” not exist #126640

Fovini opened this issue May 19, 2024 · 2 comments
Labels
actionable module: abi libtorch C++ ABI related problems module: build Build system issues module: rocm AMD GPU support for Pytorch triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@Fovini
Copy link

Fovini commented May 19, 2024

Issue description

I want to build libtorch for rocm from source and followed the instructions from here:Building libtorch using CMake. It occured this error:

CMake Error at aten/CMakeLists.txt:82 (add_subdirectory):
  add_subdirectory given source "src/THH" which is not an existing directory.
ROCm is enabled.

Directory “pytorch/aten/src/THH” does’t exist but it should be. According to pytorch/aten/CMakeLists.txt:

if(USE_ROCM)
  # TODO: AT_HIP_ENABLED (change this once we represent HIP as HIP in
  # ATen proper)
  set(AT_CUDA_ENABLED 1)
  add_subdirectory(src/THH)
  message("ROCm is enabled.")
elseif(USE_CUDA)
  set(AT_CUDA_ENABLED 1)
  add_subdirectory(src/THC)

If build for cuda, there exists the directory “pytorch/aten/src/THC”, but for rocm, the corresponding directory “THH” does not exist. I‘ve searched several versions pytorch source code, none of them have this directory.
So can someone tell me where can get this lost directory? Or have I missed something to install? I would appreciate for your help with this problem.

  • How you installed PyTorch (conda, pip, source): source
  • Build command you used (if compiling from source):
    cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release -DPYTHON_EXECUTABLE:PATH=which python3 -D CMAKE_PREFIX_PATH=/opt/rocm-6.1.0 -DCMAKE_INSTALL_PREFIX:PATH=../pytorch-install ../pytorch
  • OS: Fedora 37 6.5.12-100.fc37.x86_64
  • PyTorch version: 2.3
  • Python version: 3.11.6
  • ROCM version: 6.1.0
  • GCC version (if compiling from source): 12.3.1
  • CMake version: 3.27.7

cc @malfet @seemethere @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo @hongxiayang

@pytorch-bot pytorch-bot bot added the module: rocm AMD GPU support for Pytorch label May 19, 2024
@drisspg drisspg added module: build Build system issues module: abi libtorch C++ ABI related problems triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels May 20, 2024
@jeffdaily
Copy link
Collaborator

Looks like the doc you followed doesn't have the ROCm caveat for building from source, and that is you need to generate some of the sources before running the build. There is an extra step of converting the CUDA sources into HIP sources.

# hipify sources
python tools/amd_build/build_amd.py

@hongxiayang
Copy link
Collaborator

Thanks for @Fovini reporting the issue and thanks for @jeffdaily for the tips. Sounds like we should do an exercise of building libtorch from source successfully, and then update the documentation for ROCm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable module: abi libtorch C++ ABI related problems module: build Build system issues module: rocm AMD GPU support for Pytorch triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
Status: Todo
Development

No branches or pull requests

4 participants