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

CT_HIPBLAS=1 fails to build on Arch (Could not build wheels for ctransformers) #135

Closed
CrashTD opened this issue Sep 17, 2023 · 2 comments
Closed

Comments

@CrashTD
Copy link

CrashTD commented Sep 17, 2023

$ CT_HIPBLAS=1 pip install ctransformers --no-binary ctransformers
Collecting ctransformers
  Using cached ctransformers-0.2.27.tar.gz (376 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: huggingface-hub in /home/mk/Daten/textgen/lib/python3.10/site-packages (from ctransformers) (0.17.1)
Collecting py-cpuinfo<10.0.0,>=9.0.0 (from ctransformers)
  Using cached py_cpuinfo-9.0.0-py3-none-any.whl (22 kB)
Requirement already satisfied: filelock in /home/mk/Daten/textgen/lib/python3.10/site-packages (from huggingface-hub->ctransformers) (3.9.0)
Requirement already satisfied: fsspec in /home/mk/Daten/textgen/lib/python3.10/site-packages (from huggingface-hub->ctransformers) (2023.6.0)
Requirement already satisfied: requests in /home/mk/Daten/textgen/lib/python3.10/site-packages (from huggingface-hub->ctransformers) (2.28.1)
Requirement already satisfied: tqdm>=4.42.1 in /home/mk/Daten/textgen/lib/python3.10/site-packages (from huggingface-hub->ctransformers) (4.66.1)
Requirement already satisfied: pyyaml>=5.1 in /home/mk/.local/lib/python3.10/site-packages (from huggingface-hub->ctransformers) (5.4.1)
Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/mk/Daten/textgen/lib/python3.10/site-packages (from huggingface-hub->ctransformers) (4.7.1)
Requirement already satisfied: packaging>=20.9 in /home/mk/Daten/textgen/lib/python3.10/site-packages (from huggingface-hub->ctransformers) (23.1)
Requirement already satisfied: charset-normalizer<3,>=2 in /home/mk/Daten/textgen/lib/python3.10/site-packages (from requests->huggingface-hub->ctransformers) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in /home/mk/Daten/textgen/lib/python3.10/site-packages (from requests->huggingface-hub->ctransformers) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/mk/Daten/textgen/lib/python3.10/site-packages (from requests->huggingface-hub->ctransformers) (1.26.13)
Requirement already satisfied: certifi>=2017.4.17 in /home/mk/Daten/textgen/lib/python3.10/site-packages (from requests->huggingface-hub->ctransformers) (2022.12.7)
Building wheels for collected packages: ctransformers
  Building wheel for ctransformers (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for ctransformers (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [167 lines of output]
      
      
      --------------------------------------------------------------------------------
      -- Trying 'Ninja' generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.
      
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
      
      Not searching for unused variables given on the command line.
      
      -- The C compiler identification is GNU 13.2.1
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- The CXX compiler identification is GNU 13.2.1
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Configuring done (0.3s)
      -- Generating done (0.0s)
      -- Build files have been written to: /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/_cmake_test_compile/build
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying 'Ninja' generator - success
      --------------------------------------------------------------------------------
      
      Configuring Project
        Working directory:
          /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/_skbuild/linux-x86_64-3.10/cmake-build
        Command:
          /tmp/pip-build-env-okkq56f0/overlay/lib/python3.10/site-packages/cmake/data/bin/cmake /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88 -G Ninja -DCMAKE_MAKE_PROGRAM:FILEPATH=/tmp/pip-build-env-okkq56f0/overlay/lib/python3.10/site-packages/ninja/data/bin/ninja --no-warn-unused-cli -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/_skbuild/linux-x86_64-3.10/cmake-install -DPYTHON_VERSION_STRING:STRING=3.10.9 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-okkq56f0/overlay/lib/python3.10/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/home/mk/Daten/textgen/bin/python -DPYTHON_INCLUDE_DIR:PATH=/home/mk/Daten/textgen/include/python3.10 -DPYTHON_LIBRARY:PATH=/home/mk/Daten/textgen/lib/libpython3.10.so -DPython_EXECUTABLE:PATH=/home/mk/Daten/textgen/bin/python -DPython_ROOT_DIR:PATH=/home/mk/Daten/textgen -DPython_FIND_REGISTRY:STRING=NEVER -DPython_INCLUDE_DIR:PATH=/home/mk/Daten/textgen/include/python3.10 -DPython3_EXECUTABLE:PATH=/home/mk/Daten/textgen/bin/python -DPython3_ROOT_DIR:PATH=/home/mk/Daten/textgen -DPython3_FIND_REGISTRY:STRING=NEVER -DPython3_INCLUDE_DIR:PATH=/home/mk/Daten/textgen/include/python3.10 -DCMAKE_MAKE_PROGRAM:FILEPATH=/tmp/pip-build-env-okkq56f0/overlay/lib/python3.10/site-packages/ninja/data/bin/ninja -DCT_HIPBLAS=1 -DCMAKE_BUILD_TYPE:STRING=Release
      
      Not searching for unused variables given on the command line.
      -- The C compiler identification is GNU 13.2.1
      -- The CXX compiler identification is GNU 13.2.1
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - 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: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- CT_INSTRUCTIONS: avx2
      -- CT_CUBLAS: OFF
      -- CT_HIPBLAS: 1
      -- CT_METAL: OFF
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
      -- Found Threads: TRUE
      -- x86 detected
      CMake Warning at CMakeLists.txt:171 (message):
        Only LLVM is supported for HIP, hint: CC=/opt/rocm/llvm/bin/clang
      
      
      CMake Warning at CMakeLists.txt:174 (message):
        Only LLVM is supported for HIP, hint: CXX=/opt/rocm/llvm/bin/clang++
      
      
      CMake Deprecation Warning at /opt/rocm/lib/cmake/hip/hip-config.cmake:20 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.
      
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
      Call Stack (most recent call first):
        CMakeLists.txt:177 (find_package)
      
      
      -- hip::amdhip64 is SHARED_LIBRARY
      c++: error: unrecognized command-line option ‘--rtlib=compiler-rt’
      CMake Deprecation Warning at /opt/rocm/lib/cmake/hip/hip-config.cmake:20 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.
      
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
      Call Stack (most recent call first):
        /tmp/pip-build-env-okkq56f0/overlay/lib/python3.10/site-packages/cmake/data/share/cmake-3.27/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
        /opt/rocm/lib/cmake/hipblas/hipblas-config.cmake:90 (find_dependency)
        CMakeLists.txt:178 (find_package)
      
      
      -- hip::amdhip64 is SHARED_LIBRARY
      c++: error: unrecognized command-line option ‘--rtlib=compiler-rt’
      -- HIP and hipBLAS found
      -- Configuring done (0.3s)
      -- Generating done (0.0s)
      -- Build files have been written to: /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/_skbuild/linux-x86_64-3.10/cmake-build
      [1/8] Building CXX object CMakeFiles/ctransformers.dir/models/llm.cc.o
      FAILED: CMakeFiles/ctransformers.dir/models/llm.cc.o
      /usr/bin/c++ -DCC_TURING=1000000000 -DGGML_CUDA_DMMV_X=32 -DGGML_CUDA_MMQ_Y=64 -DGGML_CUDA_MMV_Y=1 -DGGML_USE_CUBLAS -DGGML_USE_HIPBLAS -DGGML_USE_K_QUANTS -DK_QUANTS_PER_ITERATION=2 -D__HIP_PLATFORM_AMD__=1 -D__HIP_PLATFORM_HCC__=1 -Dctransformers_EXPORTS -I/tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models -isystem /opt/rocm/include -O3 -DNDEBUG -std=gnu++11 -fPIC -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -mfma -mavx2 -mf16c -mavx -x hip --offload-arch=gfx900 --offload-arch=gfx906 --offload-arch=gfx908 --offload-arch=gfx90a --offload-arch=gfx1030 -MD -MT CMakeFiles/ctransformers.dir/models/llm.cc.o -MF CMakeFiles/ctransformers.dir/models/llm.cc.o.d -o CMakeFiles/ctransformers.dir/models/llm.cc.o -c /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models/llm.cc
      c++: error: unrecognized command-line option ‘--offload-arch=gfx900’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx906’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx908’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx90a’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx1030’
      [2/8] Building CXX object CMakeFiles/ctransformers.dir/models/ggml/cmpnct_unicode.cpp.o
      FAILED: CMakeFiles/ctransformers.dir/models/ggml/cmpnct_unicode.cpp.o
      /usr/bin/c++ -DCC_TURING=1000000000 -DGGML_CUDA_DMMV_X=32 -DGGML_CUDA_MMQ_Y=64 -DGGML_CUDA_MMV_Y=1 -DGGML_USE_CUBLAS -DGGML_USE_HIPBLAS -DGGML_USE_K_QUANTS -DK_QUANTS_PER_ITERATION=2 -D__HIP_PLATFORM_AMD__=1 -D__HIP_PLATFORM_HCC__=1 -Dctransformers_EXPORTS -I/tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models -isystem /opt/rocm/include -O3 -DNDEBUG -std=gnu++11 -fPIC -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -mfma -mavx2 -mf16c -mavx -x hip --offload-arch=gfx900 --offload-arch=gfx906 --offload-arch=gfx908 --offload-arch=gfx90a --offload-arch=gfx1030 -MD -MT CMakeFiles/ctransformers.dir/models/ggml/cmpnct_unicode.cpp.o -MF CMakeFiles/ctransformers.dir/models/ggml/cmpnct_unicode.cpp.o.d -o CMakeFiles/ctransformers.dir/models/ggml/cmpnct_unicode.cpp.o -c /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models/ggml/cmpnct_unicode.cpp
      c++: error: unrecognized command-line option ‘--offload-arch=gfx900’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx906’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx908’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx90a’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx1030’
      [3/8] Building CXX object CMakeFiles/ctransformers.dir/models/ggml/ggml-cuda.cu.o
      FAILED: CMakeFiles/ctransformers.dir/models/ggml/ggml-cuda.cu.o
      /usr/bin/c++ -DCC_TURING=1000000000 -DGGML_CUDA_DMMV_X=32 -DGGML_CUDA_MMQ_Y=64 -DGGML_CUDA_MMV_Y=1 -DGGML_USE_CUBLAS -DGGML_USE_HIPBLAS -DGGML_USE_K_QUANTS -DK_QUANTS_PER_ITERATION=2 -D__HIP_PLATFORM_AMD__=1 -D__HIP_PLATFORM_HCC__=1 -Dctransformers_EXPORTS -I/tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models -isystem /opt/rocm/include -O3 -DNDEBUG -std=gnu++11 -fPIC -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -mfma -mavx2 -mf16c -mavx -x hip --offload-arch=gfx900 --offload-arch=gfx906 --offload-arch=gfx908 --offload-arch=gfx90a --offload-arch=gfx1030 -MD -MT CMakeFiles/ctransformers.dir/models/ggml/ggml-cuda.cu.o -MF CMakeFiles/ctransformers.dir/models/ggml/ggml-cuda.cu.o.d -o CMakeFiles/ctransformers.dir/models/ggml/ggml-cuda.cu.o -c /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models/ggml/ggml-cuda.cu
      c++: error: unrecognized command-line option ‘--offload-arch=gfx900’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx906’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx908’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx90a’
      c++: error: unrecognized command-line option ‘--offload-arch=gfx1030’
      [4/8] Building C object CMakeFiles/ctransformers.dir/models/ggml/ggml-alloc.c.o
      [5/8] Building C object CMakeFiles/ctransformers.dir/models/ggml/ggml.c.o
      FAILED: CMakeFiles/ctransformers.dir/models/ggml/ggml.c.o
      /usr/bin/cc -DCC_TURING=1000000000 -DGGML_CUDA_DMMV_X=32 -DGGML_CUDA_MMQ_Y=64 -DGGML_CUDA_MMV_Y=1 -DGGML_USE_CUBLAS -DGGML_USE_HIPBLAS -DGGML_USE_K_QUANTS -DK_QUANTS_PER_ITERATION=2 -D__HIP_PLATFORM_AMD__=1 -D__HIP_PLATFORM_HCC__=1 -Dctransformers_EXPORTS -I/tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models -isystem /opt/rocm/include -O3 -DNDEBUG -std=gnu11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -mfma -mavx2 -mf16c -mavx -MD -MT CMakeFiles/ctransformers.dir/models/ggml/ggml.c.o -MF CMakeFiles/ctransformers.dir/models/ggml/ggml.c.o.d -o CMakeFiles/ctransformers.dir/models/ggml/ggml.c.o -c /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models/ggml/ggml.c
      In file included from /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models/ggml/ggml-cuda.h:46,
                       from /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models/ggml/ggml.c:252:
      /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models/ggml/ggml-cuda-ggllm.h:15:25: error: array type has incomplete element type ‘struct cudaDeviceProp’
         15 |   struct cudaDeviceProp device_props[GGML_CUDA_MAX_DEVICES];
            |                         ^~~~~~~~~~~~
      [6/8] Building C object CMakeFiles/ctransformers.dir/models/ggml/k_quants.c.o
      /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/models/ggml/k_quants.c:182:14: warning: ‘make_qkx1_quants’ defined but not used [-Wunused-function]
        182 | static float make_qkx1_quants(int n, int nmax, const float * restrict x, uint8_t * restrict L, float * restrict the_min,
            |              ^~~~~~~~~~~~~~~~
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/tmp/pip-build-env-okkq56f0/overlay/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 674, in setup
          cmkr.make(make_args, install_target=cmake_install_target, env=env)
        File "/tmp/pip-build-env-okkq56f0/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 697, in make
          self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
        File "/tmp/pip-build-env-okkq56f0/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 742, in make_impl
          raise SKBuildError(msg)
      
      An error occurred while building with CMake.
        Command:
          /tmp/pip-build-env-okkq56f0/overlay/lib/python3.10/site-packages/cmake/data/bin/cmake --build . --target install --config Release --
        Install target:
          install
        Source directory:
          /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88
        Working directory:
          /tmp/pip-install-1y741w5f/ctransformers_98afd0719b734d8a8b0cf83a8f0c6c88/_skbuild/linux-x86_64-3.10/cmake-build
      Please check the install target is valid and see CMake's output for more information.
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ctransformers
Failed to build ctransformers
ERROR: Could not build wheels for ctransformers, which is required to install pyproject.toml-based projects
$ 

@muaiyadh
Copy link

Perhaps setting HSA_OVERRIDE_GFX_VERSION=your version might help with the gfx errors?
Or try $ export CXX=hipcc
These two have caused me some issues if unset when compiling other software.

@CrashTD
Copy link
Author

CrashTD commented Sep 19, 2023

Fixed by #136 and #1724203853

@CrashTD CrashTD closed this as completed Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants