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

[BUG]: pip install . error: identifier "__hsub" is undefined #5929

Open
1 task done
jtmer opened this issue Jul 19, 2024 · 5 comments
Open
1 task done

[BUG]: pip install . error: identifier "__hsub" is undefined #5929

jtmer opened this issue Jul 19, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@jtmer
Copy link

jtmer commented Jul 19, 2024

Is there an existing issue for this bug?

  • I have searched the existing issues

๐Ÿ› Describe the bug

I'm downloading from source:

git clone https://github.com/hpcaitech/ColossalAI.git
cd ColossalAI

# install dependency
pip install -r requirements/requirements.txt

# install colossalai
BUILD_EXT=1 pip install .

when I run the command BUILD_EXT=1 pip install ., it failed:

building 'colossalai._C.scaled_masked_softmax_cuda' extension
      creating /path_to_colossalAI/ColossalAI/build/temp.linux-x86_64-cpython-310/path_to_colossalAI/ColossalAI/extensions/pybind/softmax
      Emitting ninja build file /path_to_colossalAI/ColossalAI/build/temp.linux-x86_64-cpython-310/build.ninja...
      Compiling objects...
      Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
      [1/2] c++ -MMD -MF /path_to_colossalAI/ColossalAI/build/temp.linux-x86_64-cpython-310/path_to_colossalAI/ColossalAI/extensions/pybind/softmax/scaled_masked_softmax.o.d -pthread -B /home/mahaoke/miniconda3/envs/colossalAI/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/mahaoke/miniconda3/envs/colossalAI/include -fPIC -O2 -isystem /home/mahaoke/miniconda3/envs/colossalAI/include -fPIC -I/path_to_colossalAI/ColossalAI/extensions/csrc/ -I/usr/local/cuda/include -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include/TH -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/mahaoke/miniconda3/envs/colossalAI/include/python3.10 -c -c /path_to_colossalAI/ColossalAI/extensions/pybind/softmax/scaled_masked_softmax.cpp -o /path_to_colossalAI/ColossalAI/build/temp.linux-x86_64-cpython-310/path_to_colossalAI/ColossalAI/extensions/pybind/softmax/scaled_masked_softmax.o -O3 -DVERSION_GE_1_1 -DVERSION_GE_1_3 -DVERSION_GE_1_5 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scaled_masked_softmax_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
      [2/2] /usr/local/cuda/bin/nvcc --generate-dependencies-with-compile --dependency-output /path_to_colossalAI/ColossalAI/build/temp.linux-x86_64-cpython-310/path_to_colossalAI/ColossalAI/extensions/csrc/kernel/cuda/scaled_masked_softmax_kernel.o.d -I/path_to_colossalAI/ColossalAI/extensions/csrc/ -I/usr/local/cuda/include -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include/TH -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/mahaoke/miniconda3/envs/colossalAI/include/python3.10 -c -c /path_to_colossalAI/ColossalAI/extensions/csrc/kernel/cuda/scaled_masked_softmax_kernel.cu -o /path_to_colossalAI/ColossalAI/build/temp.linux-x86_64-cpython-310/path_to_colossalAI/ColossalAI/extensions/csrc/kernel/cuda/scaled_masked_softmax_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 --use_fast_math -DVERSION_GE_1_1 -DVERSION_GE_1_3 -DVERSION_GE_1_5 -std=c++14 -std=c++17 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -DTHRUST_IGNORE_CUB_VERSION_CHECK -DCOLOSSAL_WITH_CUDA --threads 4 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scaled_masked_softmax_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_90,code=compute_90 -gencode=arch=compute_90,code=sm_90
      FAILED: /path_to_colossalAI/ColossalAI/build/temp.linux-x86_64-cpython-310/path_to_colossalAI/ColossalAI/extensions/csrc/kernel/cuda/scaled_masked_softmax_kernel.o
      /usr/local/cuda/bin/nvcc --generate-dependencies-with-compile --dependency-output /path_to_colossalAI/ColossalAI/build/temp.linux-x86_64-cpython-310/path_to_colossalAI/ColossalAI/extensions/csrc/kernel/cuda/scaled_masked_softmax_kernel.o.d -I/path_to_colossalAI/ColossalAI/extensions/csrc/ -I/usr/local/cuda/include -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include/TH -I/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/mahaoke/miniconda3/envs/colossalAI/include/python3.10 -c -c /path_to_colossalAI/ColossalAI/extensions/csrc/kernel/cuda/scaled_masked_softmax_kernel.cu -o /path_to_colossalAI/ColossalAI/build/temp.linux-x86_64-cpython-310/path_to_colossalAI/ColossalAI/extensions/csrc/kernel/cuda/scaled_masked_softmax_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 --use_fast_math -DVERSION_GE_1_1 -DVERSION_GE_1_3 -DVERSION_GE_1_5 -std=c++14 -std=c++17 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -DTHRUST_IGNORE_CUB_VERSION_CHECK -DCOLOSSAL_WITH_CUDA --threads 4 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scaled_masked_softmax_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_90,code=compute_90 -gencode=arch=compute_90,code=sm_90
      nvcc warning : incompatible redefinition for option 'std', the last value of this option was used
      /path_to_colossalAI/ColossalAI/extensions/csrc/funcs/binary_functor.h(59): error: identifier "__hsub" is undefined
      
      /path_to_colossalAI/ColossalAI/extensions/csrc/funcs/binary_functor.h(68): error: identifier "__hadd2" is undefined
      
      /path_to_colossalAI/ColossalAI/extensions/csrc/funcs/binary_functor.h(112): error: identifier "__hmul" is undefined
      
      /path_to_colossalAI/ColossalAI/extensions/csrc/funcs/binary_functor.h(116): error: identifier "__hmul2" is undefined
      
      4 errors detected in the compilation of "/path_to_colossalAI/ColossalAI/extensions/csrc/kernel/cuda/scaled_masked_softmax_kernel.cu".
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2107, in _run_ninja_build
          subprocess.run(
        File "/home/mahaoke/miniconda3/envs/colossalAI/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

Environment

CUDA 11.8
pytorch 2.3.0
python 3.10.14
GPU A800

@jtmer jtmer added the bug Something isn't working label Jul 19, 2024
@jtmer
Copy link
Author

jtmer commented Jul 19, 2024

In addition, pip install -r requirements/requirements.txt will download pytorch for cuda12, so I uninstalled it and installed pytorch for cuda11.8 after running this command

@jtmer jtmer changed the title [BUG]: "pip install ." error: identifier "__hsub" is undefined [BUG]: pip install . error: identifier "__hsub" is undefined Jul 19, 2024
@flybird11111
Copy link
Contributor

Hi, What is your nvcc version?

@jtmer
Copy link
Author

jtmer commented Aug 2, 2024

Hi, What is your nvcc version?

ๆˆ‘ๆŠŠ้•œๅƒๆ”นไบ†๏ผŒ้—ฎ้ข˜่งฃๅ†ณไบ†ใ€‚ไฝ†ๆ˜ฏ่งฃๅ†ณไปฅๅŽ้‡ๅˆฐไบ†ๆ–ฐ้—ฎ้ข˜,,ๆˆ‘ๆ”พๅผƒไบ†

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


Hi, What is your nvcc version?

I changed the image and the problem was solved. But after solving it, I encountered new problems, and I gave up.

@Wastoon
Copy link

Wastoon commented Dec 26, 2024

In addition, pip install -r requirements/requirements.txt will download pytorch for cuda12, so I uninstalled it and installed pytorch for cuda11.8 after running this command

I soved this bug by:
verify ColossalAI/extensions/csrc/funcs/binary_functor.h
line 58๏ผš#if defined(COLOSSAL_WITH_CUDA) && (__CUDA_ARCH__ > 520)

[Attention] Environment
CUDA 12.1
pytorch 2.4.0
python 3.9
GPU A800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants