Environment setup error when loading cpuadam.
to reproduce:
I used DS_BUILD_OPS=0 pip install deepspeed because it was solution for similar issue: by @jeffra in #1846 (comment)_ and @stas00
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
DS_BUILD_OPS=0 pip install deepspeed
pip install git+https://github.com/huggingface/transformers
The compiler of the gpu is not accessed. So when I run the run_classification_w.py script, the output gives error that just loading the cpu adam with deepspeed has issues. See the highlighted parts:
1. run_classification_w.py:
import logging
import os
import sys
import warnings
from dataclasses import dataclass, field
from random import randint
from typing import Optional
import datasets
import evaluate
import numpy as np
from datasets import DatasetDict, load_dataset
import transformers
from transformers import (
AutoConfig,
AutoFeatureExtractor,
AutoModelForAudioClassification,
HfArgumentParser,
Trainer,
TrainingArguments,
set_seed,
)
from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version
logger = logging.getLogger(name)
from huggingface_hub import login
login(token="...")
import deepspeed
deepspeed.ops.op_builder.CPUAdamBuilder().load()
**error is raised at line: **: deepspeed.ops.op_builder.CPUAdamBuilder().load()
- output:
…
[2023-07-06 17:55:36,866] [INFO] [real_accelerator.py:110:get_accelerator] Setting ds_accelerator to cuda (auto detect)
[2023-07-06 17:55:37,457] [WARNING] [runner.py:196:fetch_hostfile] Unable to find hostfile, will proceed with training with local resources only.
Detected CUDA_VISIBLE_DEVICES=0: setting --include=localhost:0
[2023-07-06 17:55:39,112] [INFO] [real_accelerator.py:110:get_accelerator] Setting ds_accelerator to cuda (auto detect)
[2023-07-06 17:55:39,673] [INFO] [launch.py:145:main] WORLD INFO DICT: {'localhost': [0]}
[2023-07-06 17:55:39,673] [INFO] [launch.py:151:main] nnodes=1, num_local_procs=1, node_rank=0
[2023-07-06 17:55:39,673] [INFO] [launch.py:162:main] global_rank_mapping=defaultdict(<class 'list'>, {'localhost': [0]})
[2023-07-06 17:55:39,673] [INFO] [launch.py:163:main] dist_world_size=1
[2023-07-06 17:55:39,673] [INFO] [launch.py:165:main] Setting CUDA_VISIBLE_DEVICES=0
Token will not been saved to git credential helper. Pass add_to_git_credential=True if you want to set the git credential as well.
Token is valid (permission: write).
[2023-07-06 17:55:44,585] [INFO] [real_accelerator.py:110:get_accelerator] Setting ds_accelerator to cuda (auto detect)
Using /home/flckv/.cache/torch_extensions/py311_cu118 as PyTorch extensions root...
Creating extension directory /home/flckv/.cache/torch_extensions/py311_cu118/cpu_adam...
Detected CUDA files, patching ldflags
Emitting ninja build file /home/flckv/.cache/torch_extensions/py311_cu118/cpu_adam/build.ninja...
…
Building extension module cpu_adam...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/3] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=cpu_adam -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -I/home/flckv/.conda/envs/w/lib/python3.11/site-packages/deepspeed/ops/csrc/includes -I/usr/include -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include/TH -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include/THC -isystem /home/flckv/.conda/envs/w/include/python3.11 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS -D__CUDA_NO_BFLOAT16_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_80,code=compute_80 -gencode=arch=compute_80,code=sm_80 --compiler-options '-fPIC' -O3 --use_fast_math -std=c++17 -U__CUDA_NO_HALF_OPERATORS_ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_80,code=compute_80 -DBF16_AVAILABLE -c /home/flckv/.conda/envs/_w/lib/python3.11/site-packages/deepspeed/ops/csrc/common/custom_cuda_kernel.cu -o custom_cuda_kernel.cuda.o
FAILED: custom_cuda_kernel.cuda.o
…
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=cpu_adam -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -I/home/flckv/.conda/envs/w/lib/python3.11/site-packages/deepspeed/ops/csrc/includes -I/usr/include -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include/TH -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include/THC -isystem /home/flckv/.conda/envs/w/include/python3.11 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS -D__CUDA_NO_BFLOAT16_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_80,code=compute_80 -gencode=arch=compute_80,code=sm_80 --compiler-options '-fPIC' -O3 --use_fast_math -std=c++17 -U__CUDA_NO_HALF_OPERATORS_ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_80,code=compute_80 -DBF16_AVAILABLE -c /home/flckv/.conda/envs/_w/lib/python3.11/site-packages/deepspeed/ops/csrc/common/custom_cuda_kernel.cu -o custom_cuda_kernel.cuda.o
ERROR: No supported gcc/g++ host compiler found.
Use 'nvcc -ccbin <compiler>' to specify a host compiler.
…
[2/3] c++ -MMD -MF cpu_adam.o.d -DTORCH_EXTENSION_NAME=cpu_adam -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -I/home/flckv/.conda/envs/_w/lib/python3.11/site-packages/deepspeed/ops/csrc/includes -I/usr/include -isystem /home/flckv/.conda/envs/_w/lib/python3.11/site-packages/torch/include -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include/TH -isystem /home/flckv/.conda/envs/w/lib/python3.11/site-packages/torch/include/THC -isystem /home/flckv/.conda/envs/w/include/python3.11 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -O3 -std=c++17 -g -Wno-reorder -L/usr/lib64 -lcudart -lcublas -g -march=native -fopenmp -D__AVX256 -D__ENABLE_CUDA -DBF16_AVAILABLE -c /home/flckv/.conda/envs/_w/lib/python3.11/site-packages/deepspeed/ops/csrc/adam/cpu_adam.cpp -o cpu_adam.o
ninja: build stopped: subcommand failed.
cpp_extension.py error:
Traceback (most recent call last):
File "/home/flckv/.conda/envs/_w/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 1893, in _run_ninja_build
subprocess.run(
File "/home/flckv/.conda/envs/_w/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/flckv/transformers/examples/pytorch/audio-classification/run_audio_classification_w.py", line 51, in
deepspeed.ops.op_builder.CPUAdamBuilder().load()
File "/home/flckv/.conda/envs/_w/lib/python3.11/site-packages/deepspeed/ops/op_builder/builder.py", line 454, in load
return self.jit_load(verbose)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/flckv/.conda/envs/_w/lib/python3.11/site-packages/deepspeed/ops/op_builder/builder.py", line 497, in jit_load
op_module = load(name=self.name,
^^^^^^^^^^^^^^^^^^^^
File "/home/flckv/.conda/envs/_w/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 1284, in load
return _jit_compile(
^^^^^^^^^^^^^
File "/home/flckv/.conda/envs/_w/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 1509, in _jit_compile
_write_ninja_file_and_build_library(
File "/home/flckv/.conda/envs/_w/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 1624, in _write_ninja_file_and_build_library
_run_ninja_build(
File "/home/flckv/.conda/envs/_w/lib/python3.11/site-packages/torch/utils/cpp_extension.py", line 1909, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'cpu_adam'
transformers version: 4.31.0.dev0
- Platform: Linux-5.4.204-ql-generic-12.0-19-x86_64-with-glibc2.31
- Python version: 3.11.4
- Huggingface_hub version: 0.16.2
- Safetensors version: 0.3.1
- PyTorch version (GPU?): 2.0.1 (True)
# DEEPSPEED DS_REPORT:
[2023-07-06 15:42:37,686] [INFO] [real_accelerator.py:110:get_accelerator] Setting ds_accelerator to cuda (auto detect)
--------------------------------------------------
DeepSpeed C++/CUDA extension op report
--------------------------------------------------
NOTE: Ops not installed will be just-in-time (JIT) compiled at
runtime if needed. Op compatibility means that your system
meet the required dependencies to JIT install the op.
--------------------------------------------------
JIT compiled ops requires ninja
ninja .................. �[92m[OKAY]�[0m
--------------------------------------------------
op name ................ installed .. compatible
--------------------------------------------------
�[93m [WARNING] �[0m async_io requires the dev libaio .so object and headers but these were not found.
�[93m [WARNING] �[0m async_io: please install the libaio-dev package with apt
�[93m [WARNING] �[0m If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found.
async_io ............... �[93m[NO]�[0m ....... �[93m[NO]�[0m
cpu_adagrad ............ �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
cpu_adam ............... �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
fused_adam ............. �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
fused_lamb ............. �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
quantizer .............. �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
random_ltd ............. �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
�[93m [WARNING] �[0m sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.0
�[93m [WARNING] �[0m using untested triton version (2.0.0), only 1.0.0 is known to be compatible
sparse_attn ............ �[93m[NO]�[0m ....... �[93m[NO]�[0m
spatial_inference ...... �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
transformer ............ �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
stochastic_transformer . �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
transformer_inference .. �[93m[NO]�[0m ....... �[92m[OKAY]�[0m
--------------------------------------------------
DeepSpeed general environment info:
torch install path ............... ['/home/flck/.conda/envs/w_/lib/python3.11/site-packages/torch']
torch version .................... 2.0.1
deepspeed install path ........... ['/home/flck/.conda/envs/w_/lib/python3.11/site-packages/deepspeed']
deepspeed info ................... 0.10.0+cc3a7c9c, cc3a7c9c, master
torch cuda version ............... 11.8
torch hip version ................ None
nvcc version ..................... 11.8
deepspeed wheel compiled w. ...... torch 2.0, cuda 11.8
# NVCC and GCC:
**nvcc**: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
Using built-in specs.
**COLLECT_GCC**=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
Environment setup error when loading cpuadam.
to reproduce:
I used
DS_BUILD_OPS=0 pip install deepspeedbecause it was solution for similar issue: by @jeffra in #1846 (comment)_ and @stas00The compiler of the gpu is not accessed. So when I run the run_classification_w.py script, the output gives error that just loading the cpu adam with deepspeed has issues. See the highlighted parts:
1. run_classification_w.py:
**error is raised at line: **:
deepspeed.ops.op_builder.CPUAdamBuilder().load()…
Emitting ninja build file /home/flckv/.cache/torch_extensions/py311_cu118/cpu_adam/build.ninja...…
FAILED: custom_cuda_kernel.cuda.o…
…
cpp_extension.py error:
RuntimeError: Error building extension 'cpu_adam'transformersversion: 4.31.0.dev0