Error installing Apex

Open
#1,645 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, python, pytorch

Research direction

Reproduce the Apex installation with the reported Python 3.10 and PyTorch environment, then inspect csrc/fused_dense.cpp around line 159 alongside the compiler output. The work is complete when the Apex extension builds and installs without the reported compilation error.

Written by the indexing model from the issue text.

Description

bug

Describe the Bug

 csrc/fused_dense.cpp: In lambda function:
  csrc/fused_dense.cpp:159:94: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
    159 |   AT_DISPATCH_FLOATING_TYPES_AND2(at::ScalarType::Half, at::ScalarType::BFloat16, input.type(), "linear_bias_backward", [&] {
        |                                                                                              ^
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:260:39: note: in definition of macro ‘C10_EXPAND_MSVC_WORKAROUND’
    260 | #define C10_EXPAND_MSVC_WORKAROUND(x) x
        |                                       ^
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:465:9: note: in expansion of macro ‘TORCH_CHECK_MSG’
    465 |         TORCH_CHECK_MSG(cond, "", ##__VA_ARGS__)); \
        |         ^~~~~~~~~~~~~~~
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:637:32: note: in expansion of macro ‘TORCH_CHECK’
    637 |     C10_EXPAND_MSVC_WORKAROUND(TORCH_CHECK(false, ::c10::str(__VA_ARGS__))); \
        |                                ^~~~~~~~~~~
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:330:9: note: in expansion of macro ‘AT_ERROR’
    330 |         AT_ERROR(#NAME, " not implemented for '", toString(TYPE), "'");     \
        |         ^~~~~~~~
  csrc/fused_dense.cpp:159:3: note: in expansion of macro ‘AT_DISPATCH_FLOATING_TYPES_AND2’
    159 |   AT_DISPATCH_FLOATING_TYPES_AND2(at::ScalarType::Half, at::ScalarType::BFloat16, input.type(), "linear_bias_backward", [&] {
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/core/Tensor.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/DeviceGuard.h:4,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/ATen.h:11,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/extension.h:4,
                   from csrc/fused_dense.cpp:1:
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/core/TensorBody.h:213:30: note: declared here
    213 |   DeprecatedTypeProperties & type() const {
        |                              ^~~~
  In file included from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/core/Device.h:5,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/core/Allocator.h:6,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/ATen.h:7,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/extension.h:4,
                   from csrc/fused_dense.cpp:1:
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:330:51: error: ‘toString’ was not declared in this scope
    330 |         AT_ERROR(#NAME, " not implemented for '", toString(TYPE), "'");     \
        |                                                   ^~~~~~~~
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:260:39: note: in definition of macro ‘C10_EXPAND_MSVC_WORKAROUND’
    260 | #define C10_EXPAND_MSVC_WORKAROUND(x) x
        |                                       ^
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:465:9: note: in expansion of macro ‘TORCH_CHECK_MSG’
    465 |         TORCH_CHECK_MSG(cond, "", ##__VA_ARGS__)); \
        |         ^~~~~~~~~~~~~~~
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:637:32: note: in expansion of macro ‘TORCH_CHECK’
    637 |     C10_EXPAND_MSVC_WORKAROUND(TORCH_CHECK(false, ::c10::str(__VA_ARGS__))); \
        |                                ^~~~~~~~~~~
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:330:9: note: in expansion of macro ‘AT_ERROR’
    330 |         AT_ERROR(#NAME, " not implemented for '", toString(TYPE), "'");     \
        |         ^~~~~~~~
  csrc/fused_dense.cpp:159:3: note: in expansion of macro ‘AT_DISPATCH_FLOATING_TYPES_AND2’
    159 |   AT_DISPATCH_FLOATING_TYPES_AND2(at::ScalarType::Half, at::ScalarType::BFloat16, input.type(), "linear_bias_backward", [&] {
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:330:51: note: suggested alternatives:
    330 |         AT_ERROR(#NAME, " not implemented for '", toString(TYPE), "'");     \
        |                                                   ^~~~~~~~
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:260:39: note: in definition of macro ‘C10_EXPAND_MSVC_WORKAROUND’
    260 | #define C10_EXPAND_MSVC_WORKAROUND(x) x
        |                                       ^
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:465:9: note: in expansion of macro ‘TORCH_CHECK_MSG’
    465 |         TORCH_CHECK_MSG(cond, "", ##__VA_ARGS__)); \
        |         ^~~~~~~~~~~~~~~
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:637:32: note: in expansion of macro ‘TORCH_CHECK’
    637 |     C10_EXPAND_MSVC_WORKAROUND(TORCH_CHECK(false, ::c10::str(__VA_ARGS__))); \
        |                                ^~~~~~~~~~~
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:330:9: note: in expansion of macro ‘AT_ERROR’
    330 |         AT_ERROR(#NAME, " not implemented for '", toString(TYPE), "'");     \
        |         ^~~~~~~~
  csrc/fused_dense.cpp:159:3: note: in expansion of macro ‘AT_DISPATCH_FLOATING_TYPES_AND2’
    159 |   AT_DISPATCH_FLOATING_TYPES_AND2(at::ScalarType::Half, at::ScalarType::BFloat16, input.type(), "linear_bias_backward", [&] {
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/core/op_registration/infer_schema.h:8,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/library.h:61,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/extension.h:4,
                   from csrc/fused_dense.cpp:1:
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/ATen/core/function_schema.h:522:20: note:   ‘c10::toString’
    522 | inline std::string toString(const FunctionSchema& schema) {
        |                    ^~~~~~~~
  In file included from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/jit/ir/ir.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/jit/api/function_impl.h:4,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/jit/api/method.h:7,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/jit/api/object.h:6,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/jit/api/module.h:4,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/serialize/input-archive.h:7,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/serialize/archive.h:3,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers/serialize.h:4,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/samplers.h:8,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/datasets/chunk.h:7,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data/datasets.h:4,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/data.h:4,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8,
                   from /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/extension.h:4,
                   from csrc/fused_dense.cpp:1:
  /home/max410011/.conda/envs/nvidia/lib/python3.10/site-packages/torch/include/torch/csrc/jit/ir/attributes.h:35:27: note:   ‘torch::jit::toString’
     35 | static inline const char* toString(AttributeKind kind) {
        |                           ^~~~~~~~
  error: command '/usr/bin/gcc' failed with exit code 1
  error: subprocess-exited-with-error

  × Running setup.py install for apex did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

Minimal Steps/Code to Reproduce the Bug

conda create --name nvidia_apex python=3.10
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

Environment

ubuntu 20.04 LTS
python==3.10
pytorch==1.12.1
cudatoolkit=11.3.1
cuda==11.3

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/apex

All issues in NVIDIA/apex

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.