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

Extend tch::Device to support check for/using Apple M1 MPS GPU? #501

Open
brandonros opened this issue Jun 23, 2022 · 5 comments
Open

Extend tch::Device to support check for/using Apple M1 MPS GPU? #501

brandonros opened this issue Jun 23, 2022 · 5 comments

Comments

@brandonros
Copy link

brandonros commented Jun 23, 2022

https://docs.rs/tch/0.7.2/tch/enum.Device.html#method.is_cuda

https://github.com/pytorch/pytorch/pull/77767/files

https://github.com/pytorch/pytorch/blob/master/docs/source/notes/mps.rst

@brandonros brandonros changed the title Extend tch::Device to support check for Apple M1 MPS GPU? Extend tch::Device to support check for/using Apple M1 MPS GPU? Jun 23, 2022
@brandonros
Copy link
Author

brandonros commented Jun 23, 2022

fn main() {
  println!("{:?}", tch::Device::cuda_if_available());
}
 $ cargo run
   Compiling quant v0.1.0 (/Users/brandonros/Desktop/quant)
    Finished dev [unoptimized + debuginfo] target(s) in 0.26s
     Running `target/debug/quant`
Cpu

looks like

brew install libtorch
export LIBTORCH=/opt/homebrew/Cellar/libtorch/1.11.0_1
export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
cargo run

does not yield a solution that automatically uses the Apple M1 GPU at the moment

@brandonros
Copy link
Author

option 1. libtorch from brew does not come with MPS support from what I can tell, despite offering arm64 binary

option 2. https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip is x86_64, not arm64

option 3. pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu

Brandons-MacBook-Air:quant brandonros 2022-06-23 10:56:56 $ cargo run
   Compiling torch-sys v0.7.2
The following warnings were emitted during compilation:

warning: clang: warning: -Wl,-rpath=/opt/homebrew/lib/python3.9/site-packages/torch/lib: 'linker' input unused [-Wunused-command-line-argument]
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:308:29: error: no member named '_cat' in namespace 'torch'; did you mean 'cat'?
warning:     auto outputs__ = torch::_cat(of_carray_tensor(tensors_data, tensors_len), dim);
warning:                      ~~~~~~~^~~~
warning:                             cat
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/cat.h:26:29: note: 'cat' declared here
warning: TORCH_API inline at::Tensor cat(at::TensorList tensors, int64_t dim=0) {
warning:                             ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:315:29: error: no member named '_cat_out' in namespace 'torch'; did you mean 'cat_out'?
warning:     auto outputs__ = torch::_cat_out(*out, of_carray_tensor(tensors_data, tensors_len), dim);
warning:                      ~~~~~~~^~~~~~~~
warning:                             cat_out
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/cat.h:31:31: note: 'cat_out' declared here
warning: TORCH_API inline at::Tensor & cat_out(at::Tensor & out, at::TensorList tensors, int64_t dim=0) {
warning:                               ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:812:29: error: no member named '_index_copy_' in namespace 'torch'; did you mean 'index_copy'?
warning:     auto outputs__ = torch::_index_copy_(*self, dim, *index, *source);
warning:                      ~~~~~~~^~~~~~~~~~~~
warning:                             index_copy
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/index_copy.h:36:29: note: 'index_copy' declared here
warning: TORCH_API inline at::Tensor index_copy(const at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & source) {
warning:                             ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:853:29: error: no member named '_linalg_qr_helper' in namespace 'torch'
warning:     auto outputs__ = torch::_linalg_qr_helper(*self, std::string(mode_ptr, mode_len));
warning:                      ~~~~~~~^
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:986:29: error: no member named '_native_multi_head_self_attention' in namespace 'torch'
warning:     auto outputs__ = torch::_native_multi_head_self_attention(*query, *qkv_weight, *qkv_bias, *proj_weight, *proj_bias, (mask ? *mask : torch::Tensor()));
warning:                      ~~~~~~~^
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:1094:29: error: no member named '_s_where' in namespace 'torch'
warning:     auto outputs__ = torch::_s_where(*condition, *self, *other);
warning:                      ~~~~~~~^
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:1115:154: error: reference to type 'const c10::optional<at::Tensor>' could not bind to an lvalue of type 'int64_t' (aka 'long long')
warning:     auto outputs__ = torch::_segment_reduce_backward(*grad, *output, *data, std::string(reduce_ptr, reduce_len), (lengths ? *lengths : torch::Tensor()), axis);
warning:                                                                                                                                                          ^~~~
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/_segment_reduce_backward.h:26:236: note: passing argument to parameter 'offsets' here
warning: TORCH_API inline at::Tensor _segment_reduce_backward(const at::Tensor & grad, const at::Tensor & output, const at::Tensor & data, c10::string_view reduce, const c10::optional<at::Tensor> & lengths={}, const c10::optional<at::Tensor> & offsets={}, int64_t axis=0, const c10::optional<at::Scalar> & initial=c10::nullopt) {
warning:                                                                                                                                                                                                                                            ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:1195:29: error: no member named '_solve_helper' in namespace 'torch'
warning:     auto outputs__ = torch::_solve_helper(*self, *A);
warning:                      ~~~~~~~^
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:1752:29: error: no member named '_weight_norm_cuda_interface' in namespace 'torch'; did you mean '_weight_norm_interface'?
warning:     auto outputs__ = torch::_weight_norm_cuda_interface(*v, *g, dim);
warning:                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
warning:                             _weight_norm_interface
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/_weight_norm_interface.h:26:54: note: '_weight_norm_interface' declared here
warning: TORCH_API inline ::std::tuple<at::Tensor,at::Tensor> _weight_norm_interface(const at::Tensor & v, const at::Tensor & g, int64_t dim=0) {
warning:                                                      ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:1760:29: error: no member named '_weight_norm_cuda_interface_backward' in namespace 'torch'; did you mean '_weight_norm_interface_backward'?
warning:     auto outputs__ = torch::_weight_norm_cuda_interface_backward(*grad_w, *saved_v, *saved_g, *saved_norms, dim);
warning:                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning:                             _weight_norm_interface_backward
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/_weight_norm_interface_backward.h:26:54: note: '_weight_norm_interface_backward' declared here
warning: TORCH_API inline ::std::tuple<at::Tensor,at::Tensor> _weight_norm_interface_backward(const at::Tensor & grad_w, const at::Tensor & saved_v, const at::Tensor & saved_g, const at::Tensor & saved_norms, int64_t dim) {
warning:                                                      ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:2906:22: error: call to 'bernoulli_out' is ambiguous
warning:     auto outputs__ = torch::bernoulli_out(*out, *self);
warning:                      ^~~~~~~~~~~~~~~~~~~~
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/bernoulli.h:31:31: note: candidate function
warning: TORCH_API inline at::Tensor & bernoulli_out(at::Tensor & out, const at::Tensor & self, c10::optional<at::Generator> generator=c10::nullopt) {
warning:                               ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/bernoulli.h:61:31: note: candidate function
warning: TORCH_API inline at::Tensor & bernoulli_out(at::Tensor & out, const at::Tensor & self, double p=0.5, c10::optional<at::Generator> generator=c10::nullopt) {
warning:                               ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:2962:29: error: no member named 'binary_cross_entropy_with_logits_backward' in namespace 'torch'
warning:     auto outputs__ = torch::binary_cross_entropy_with_logits_backward(*grad_output, *self, *target, (weight ? *weight : torch::Tensor()), (pos_weight ? *pos_weight : torch::Tensor()), reduction);
warning:                      ~~~~~~~^
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:6103:136: error: too few arguments to function call, expected 7, have 6
warning:     auto outputs__ = torch::grid_sampler_3d_backward(*grad_output, *input, *grid, interpolation_mode, padding_mode, (bool)align_corners);
warning:                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                   ^
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/grid_sampler_3d_backward.h:26:54: note: 'grid_sampler_3d_backward' declared here
warning: TORCH_API inline ::std::tuple<at::Tensor,at::Tensor> grid_sampler_3d_backward(const at::Tensor & grad_output, const at::Tensor & input, const at::Tensor & grid, int64_t interpolation_mode, int64_t padding_mode, bool align_corners, ::std::array<bool,2> output_mask) {
warning:                                                      ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:7069:29: error: no member named 'l1_loss_backward' in namespace 'torch'; did you mean 'mse_loss_backward'?
warning:     auto outputs__ = torch::l1_loss_backward(*grad_output, *self, *target, reduction);
warning:                      ~~~~~~~^~~~~~~~~~~~~~~~
warning:                             mse_loss_backward
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/mse_loss_backward.h:36:29: note: 'mse_loss_backward' declared here
warning: TORCH_API inline at::Tensor mse_loss_backward(const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, int64_t reduction) {
warning:                             ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:7076:29: error: no member named 'l1_loss_backward_out' in namespace 'torch'; did you mean 'mse_loss_backward_out'?
warning:     auto outputs__ = torch::l1_loss_backward_out(*grad_input, *grad_output, *self, *target, reduction);
warning:                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~
warning:                             mse_loss_backward_out
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/mse_loss_backward.h:26:31: note: 'mse_loss_backward_out' declared here
warning: TORCH_API inline at::Tensor & mse_loss_backward_out(at::Tensor & grad_input, const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, int64_t reduction) {
warning:                               ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:7083:29: error: no member named 'l1_loss_out' in namespace 'torch'; did you mean 'mse_loss_out'?
warning:     auto outputs__ = torch::l1_loss_out(*out, *self, *target, reduction);
warning:                      ~~~~~~~^~~~~~~~~~~
warning:                             mse_loss_out
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: /opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/mse_loss.h:26:31: note: 'mse_loss_out' declared here
warning: TORCH_API inline at::Tensor & mse_loss_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & target, int64_t reduction=at::Reduction::Mean) {
warning:                               ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:8655:29: error: no member named 'max_unpool2d_backward' in namespace 'torch'
warning:     auto outputs__ = torch::max_unpool2d_backward(*grad_output, *self, *indices, torch::IntArrayRef(output_size_data, output_size_len));
warning:                      ~~~~~~~^
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:8662:29: error: no member named 'max_unpool2d_backward_out' in namespace 'torch'
warning:     auto outputs__ = torch::max_unpool2d_backward_out(*grad_input, *grad_output, *self, *indices, torch::IntArrayRef(output_size_data, output_size_len));
warning:                      ~~~~~~~^
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: In file included from libtch/torch_api.cpp:1426:
warning: libtch/torch_api_generated.cpp.h:8683:29: error: no member named 'max_unpool3d_backward' in namespace 'torch'
warning:     auto outputs__ = torch::max_unpool3d_backward(*grad_output, *self, *indices, torch::IntArrayRef(output_size_data, output_size_len), torch::IntArrayRef(stride_data, stride_len), torch::IntArrayRef(padding_data, padding_len));
warning:                      ~~~~~~~^
warning: libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
warning:     x \
warning:     ^
warning: fatal error: too many errors emitted, stopping now [-ferror-limit=]
warning: 20 errors generated.

error: failed to run custom build command for `torch-sys v0.7.2`

Caused by:
  process didn't exit successfully: `/Users/brandonros/Desktop/quant/target/debug/build/torch-sys-9541fb47d72ab990/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=TORCH_CUDA_VERSION
  cargo:rerun-if-env-changed=LIBTORCH
  cargo:rustc-link-search=native=/opt/homebrew/lib/python3.9/site-packages/torch/lib
  cargo:rerun-if-changed=libtch/torch_api.cpp
  cargo:rerun-if-changed=libtch/torch_api.h
  cargo:rerun-if-changed=libtch/torch_api_generated.cpp.h
  cargo:rerun-if-changed=libtch/torch_api_generated.h
  cargo:rerun-if-changed=libtch/stb_image_write.h
  cargo:rerun-if-changed=libtch/stb_image_resize.h
  cargo:rerun-if-changed=libtch/stb_image.h
  cargo:rerun-if-env-changed=LIBTORCH_CXX11_ABI
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("0")
  HOST = Some("aarch64-apple-darwin")
  CXX_aarch64-apple-darwin = None
  CXX_aarch64_apple_darwin = None
  HOST_CXX = None
  CXX = None
  CXXFLAGS_aarch64-apple-darwin = None
  CXXFLAGS_aarch64_apple_darwin = None
  HOST_CXXFLAGS = None
  CXXFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh")
  running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-I" "/opt/homebrew/lib/python3.9/site-packages/torch/include" "-I" "/opt/homebrew/lib/python3.9/site-packages/torch/include/torch/csrc/api/include" "-Wl,-rpath=/opt/homebrew/lib/python3.9/site-packages/torch/lib" "-std=c++14" "-D_GLIBCXX_USE_CXX11_ABI=1" "-o" "/Users/brandonros/Desktop/quant/target/debug/build/torch-sys-7c94b7b2979661c3/out/libtch/torch_api.o" "-c" "libtch/torch_api.cpp"
  cargo:warning=clang: warning: -Wl,-rpath=/opt/homebrew/lib/python3.9/site-packages/torch/lib: 'linker' input unused [-Wunused-command-line-argument]
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:308:29: error: no member named '_cat' in namespace 'torch'; did you mean 'cat'?
  cargo:warning=    auto outputs__ = torch::_cat(of_carray_tensor(tensors_data, tensors_len), dim);
  cargo:warning=                     ~~~~~~~^~~~
  cargo:warning=                            cat
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/cat.h:26:29: note: 'cat' declared here
  cargo:warning=TORCH_API inline at::Tensor cat(at::TensorList tensors, int64_t dim=0) {
  cargo:warning=                            ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:315:29: error: no member named '_cat_out' in namespace 'torch'; did you mean 'cat_out'?
  cargo:warning=    auto outputs__ = torch::_cat_out(*out, of_carray_tensor(tensors_data, tensors_len), dim);
  cargo:warning=                     ~~~~~~~^~~~~~~~
  cargo:warning=                            cat_out
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/cat.h:31:31: note: 'cat_out' declared here
  cargo:warning=TORCH_API inline at::Tensor & cat_out(at::Tensor & out, at::TensorList tensors, int64_t dim=0) {
  cargo:warning=                              ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:812:29: error: no member named '_index_copy_' in namespace 'torch'; did you mean 'index_copy'?
  cargo:warning=    auto outputs__ = torch::_index_copy_(*self, dim, *index, *source);
  cargo:warning=                     ~~~~~~~^~~~~~~~~~~~
  cargo:warning=                            index_copy
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/index_copy.h:36:29: note: 'index_copy' declared here
  cargo:warning=TORCH_API inline at::Tensor index_copy(const at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & source) {
  cargo:warning=                            ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:853:29: error: no member named '_linalg_qr_helper' in namespace 'torch'
  cargo:warning=    auto outputs__ = torch::_linalg_qr_helper(*self, std::string(mode_ptr, mode_len));
  cargo:warning=                     ~~~~~~~^
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:986:29: error: no member named '_native_multi_head_self_attention' in namespace 'torch'
  cargo:warning=    auto outputs__ = torch::_native_multi_head_self_attention(*query, *qkv_weight, *qkv_bias, *proj_weight, *proj_bias, (mask ? *mask : torch::Tensor()));
  cargo:warning=                     ~~~~~~~^
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:1094:29: error: no member named '_s_where' in namespace 'torch'
  cargo:warning=    auto outputs__ = torch::_s_where(*condition, *self, *other);
  cargo:warning=                     ~~~~~~~^
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:1115:154: error: reference to type 'const c10::optional<at::Tensor>' could not bind to an lvalue of type 'int64_t' (aka 'long long')
  cargo:warning=    auto outputs__ = torch::_segment_reduce_backward(*grad, *output, *data, std::string(reduce_ptr, reduce_len), (lengths ? *lengths : torch::Tensor()), axis);
  cargo:warning=                                                                                                                                                         ^~~~
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/_segment_reduce_backward.h:26:236: note: passing argument to parameter 'offsets' here
  cargo:warning=TORCH_API inline at::Tensor _segment_reduce_backward(const at::Tensor & grad, const at::Tensor & output, const at::Tensor & data, c10::string_view reduce, const c10::optional<at::Tensor> & lengths={}, const c10::optional<at::Tensor> & offsets={}, int64_t axis=0, const c10::optional<at::Scalar> & initial=c10::nullopt) {
  cargo:warning=                                                                                                                                                                                                                                           ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:1195:29: error: no member named '_solve_helper' in namespace 'torch'
  cargo:warning=    auto outputs__ = torch::_solve_helper(*self, *A);
  cargo:warning=                     ~~~~~~~^
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:1752:29: error: no member named '_weight_norm_cuda_interface' in namespace 'torch'; did you mean '_weight_norm_interface'?
  cargo:warning=    auto outputs__ = torch::_weight_norm_cuda_interface(*v, *g, dim);
  cargo:warning=                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=                            _weight_norm_interface
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/_weight_norm_interface.h:26:54: note: '_weight_norm_interface' declared here
  cargo:warning=TORCH_API inline ::std::tuple<at::Tensor,at::Tensor> _weight_norm_interface(const at::Tensor & v, const at::Tensor & g, int64_t dim=0) {
  cargo:warning=                                                     ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:1760:29: error: no member named '_weight_norm_cuda_interface_backward' in namespace 'torch'; did you mean '_weight_norm_interface_backward'?
  cargo:warning=    auto outputs__ = torch::_weight_norm_cuda_interface_backward(*grad_w, *saved_v, *saved_g, *saved_norms, dim);
  cargo:warning=                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=                            _weight_norm_interface_backward
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/_weight_norm_interface_backward.h:26:54: note: '_weight_norm_interface_backward' declared here
  cargo:warning=TORCH_API inline ::std::tuple<at::Tensor,at::Tensor> _weight_norm_interface_backward(const at::Tensor & grad_w, const at::Tensor & saved_v, const at::Tensor & saved_g, const at::Tensor & saved_norms, int64_t dim) {
  cargo:warning=                                                     ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:2906:22: error: call to 'bernoulli_out' is ambiguous
  cargo:warning=    auto outputs__ = torch::bernoulli_out(*out, *self);
  cargo:warning=                     ^~~~~~~~~~~~~~~~~~~~
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/bernoulli.h:31:31: note: candidate function
  cargo:warning=TORCH_API inline at::Tensor & bernoulli_out(at::Tensor & out, const at::Tensor & self, c10::optional<at::Generator> generator=c10::nullopt) {
  cargo:warning=                              ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/bernoulli.h:61:31: note: candidate function
  cargo:warning=TORCH_API inline at::Tensor & bernoulli_out(at::Tensor & out, const at::Tensor & self, double p=0.5, c10::optional<at::Generator> generator=c10::nullopt) {
  cargo:warning=                              ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:2962:29: error: no member named 'binary_cross_entropy_with_logits_backward' in namespace 'torch'
  cargo:warning=    auto outputs__ = torch::binary_cross_entropy_with_logits_backward(*grad_output, *self, *target, (weight ? *weight : torch::Tensor()), (pos_weight ? *pos_weight : torch::Tensor()), reduction);
  cargo:warning=                     ~~~~~~~^
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:6103:136: error: too few arguments to function call, expected 7, have 6
  cargo:warning=    auto outputs__ = torch::grid_sampler_3d_backward(*grad_output, *input, *grid, interpolation_mode, padding_mode, (bool)align_corners);
  cargo:warning=                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                   ^
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/grid_sampler_3d_backward.h:26:54: note: 'grid_sampler_3d_backward' declared here
  cargo:warning=TORCH_API inline ::std::tuple<at::Tensor,at::Tensor> grid_sampler_3d_backward(const at::Tensor & grad_output, const at::Tensor & input, const at::Tensor & grid, int64_t interpolation_mode, int64_t padding_mode, bool align_corners, ::std::array<bool,2> output_mask) {
  cargo:warning=                                                     ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:7069:29: error: no member named 'l1_loss_backward' in namespace 'torch'; did you mean 'mse_loss_backward'?
  cargo:warning=    auto outputs__ = torch::l1_loss_backward(*grad_output, *self, *target, reduction);
  cargo:warning=                     ~~~~~~~^~~~~~~~~~~~~~~~
  cargo:warning=                            mse_loss_backward
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/mse_loss_backward.h:36:29: note: 'mse_loss_backward' declared here
  cargo:warning=TORCH_API inline at::Tensor mse_loss_backward(const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, int64_t reduction) {
  cargo:warning=                            ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:7076:29: error: no member named 'l1_loss_backward_out' in namespace 'torch'; did you mean 'mse_loss_backward_out'?
  cargo:warning=    auto outputs__ = torch::l1_loss_backward_out(*grad_input, *grad_output, *self, *target, reduction);
  cargo:warning=                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~
  cargo:warning=                            mse_loss_backward_out
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/mse_loss_backward.h:26:31: note: 'mse_loss_backward_out' declared here
  cargo:warning=TORCH_API inline at::Tensor & mse_loss_backward_out(at::Tensor & grad_input, const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, int64_t reduction) {
  cargo:warning=                              ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:7083:29: error: no member named 'l1_loss_out' in namespace 'torch'; did you mean 'mse_loss_out'?
  cargo:warning=    auto outputs__ = torch::l1_loss_out(*out, *self, *target, reduction);
  cargo:warning=                     ~~~~~~~^~~~~~~~~~~
  cargo:warning=                            mse_loss_out
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=/opt/homebrew/lib/python3.9/site-packages/torch/include/ATen/ops/mse_loss.h:26:31: note: 'mse_loss_out' declared here
  cargo:warning=TORCH_API inline at::Tensor & mse_loss_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & target, int64_t reduction=at::Reduction::Mean) {
  cargo:warning=                              ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:8655:29: error: no member named 'max_unpool2d_backward' in namespace 'torch'
  cargo:warning=    auto outputs__ = torch::max_unpool2d_backward(*grad_output, *self, *indices, torch::IntArrayRef(output_size_data, output_size_len));
  cargo:warning=                     ~~~~~~~^
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:8662:29: error: no member named 'max_unpool2d_backward_out' in namespace 'torch'
  cargo:warning=    auto outputs__ = torch::max_unpool2d_backward_out(*grad_input, *grad_output, *self, *indices, torch::IntArrayRef(output_size_data, output_size_len));
  cargo:warning=                     ~~~~~~~^
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=In file included from libtch/torch_api.cpp:1426:
  cargo:warning=libtch/torch_api_generated.cpp.h:8683:29: error: no member named 'max_unpool3d_backward' in namespace 'torch'
  cargo:warning=    auto outputs__ = torch::max_unpool3d_backward(*grad_output, *self, *indices, torch::IntArrayRef(output_size_data, output_size_len), torch::IntArrayRef(stride_data, stride_len), torch::IntArrayRef(padding_data, padding_len));
  cargo:warning=                     ~~~~~~~^
  cargo:warning=libtch/torch_api.h:16:5: note: expanded from macro 'PROTECT'
  cargo:warning=    x \
  cargo:warning=    ^
  cargo:warning=fatal error: too many errors emitted, stopping now [-ferror-limit=]
  cargo:warning=20 errors generated.
  exit status: 1

  --- stderr


  error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-I" "/opt/homebrew/lib/python3.9/site-packages/torch/include" "-I" "/opt/homebrew/lib/python3.9/site-packages/torch/include/torch/csrc/api/include" "-Wl,-rpath=/opt/homebrew/lib/python3.9/site-packages/torch/lib" "-std=c++14" "-D_GLIBCXX_USE_CXX11_ABI=1" "-o" "/Users/brandonros/Desktop/quant/target/debug/build/torch-sys-7c94b7b2979661c3/out/libtch/torch_api.o" "-c" "libtch/torch_api.cpp" with args "c++" did not execute successfully (status code exit status: 1).

@brandonros
Copy link
Author

 $ pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/nightly/cpu
Collecting torch
  Using cached https://download.pytorch.org/whl/nightly/cpu/torch-1.13.0.dev20220623-cp39-none-macosx_11_0_arm64.whl (49.5 MB)
Collecting torchvision
  Downloading https://download.pytorch.org/whl/nightly/cpu/torchvision-0.14.0.dev20220623-cp39-cp39-macosx_11_0_arm64.whl (1.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 935.9 kB/s eta 0:00:00
Collecting torchaudio
  Downloading https://download.pytorch.org/whl/nightly/cpu/torchaudio-0.14.0.dev20220603-cp39-cp39-macosx_11_0_arm64.whl (2.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.7/2.7 MB 1.1 MB/s eta 0:00:00
Collecting typing-extensions
  Downloading typing_extensions-4.2.0-py3-none-any.whl (24 kB)
Collecting requests
  Downloading requests-2.28.0-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 916.1 kB/s eta 0:00:00
Collecting pillow!=8.3.*,>=5.3.0
  Downloading Pillow-9.1.1-cp39-cp39-macosx_11_0_arm64.whl (2.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 6.5 MB/s eta 0:00:00
Collecting numpy
  Downloading numpy-1.23.0-cp39-cp39-macosx_11_0_arm64.whl (13.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.3/13.3 MB 13.9 MB/s eta 0:00:00
Collecting charset-normalizer~=2.0.0
  Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.6.15-py3-none-any.whl (160 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 139.0/139.0 kB 5.0 MB/s eta 0:00:00
Installing collected packages: urllib3, typing-extensions, pillow, numpy, idna, charset-normalizer, certifi, torch, requests, torchvision, torchaudio
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Successfully installed certifi-2022.6.15 charset-normalizer-2.0.12 idna-3.3 numpy-1.23.0 pillow-9.1.1 requests-2.28.0 torch-1.13.0.dev20220623 torchaudio-0.14.0.dev20220603 torchvision-0.14.0.dev20220623 typing-extensions-4.2.0 urllib3-1.26.9

$ python3 --version
Python 3.9.13

$ pip3 --version
pip 22.1.2 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9)

@brandonros
Copy link
Author

pytorch/pytorch#68625 (comment)

Looks like max_unpool2d_backward was removed?

@brandonros
Copy link
Author

probably a separate issue of trying to use __version__ = '1.13.0.dev20220623' libtorch and this library only support v1.11.0?

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

1 participant