Skip to content

Attempt to build M1/M2/M3 images from source fails miserably #16

@dolfs

Description

@dolfs

Due to the absence of "linux-aarch64" docke images, I set off to attempt to build them myself. Naively I started with the docker base image. I had to do quite some modifications to the script to make it work on MacOS/Apple Silicon, but finally got it to build with opencv, but of course CUDA disabled. For now I would be satisfied with CPU only operations, but I was going to look later for ways to use Apple's latest tech to allow its neural engine and GPUs to be used as well. But ...
I found out this image is not even being used when I next tried to build the layer image.

CORRECTION: This image is being used by log hi-tooling and I was able to build that, based on that image, although there were test errors, causing the overall to fail.

Building that failed, initially, to misunderstanding what directory needed to be in the argument, but once I figured that you, copying the source failed due to a -T argument in a cp command, which is not supported on MacOS. Once I worked around that, things started, but I ended up with the errors below.

The first problem appears to be with CUDA missing. This is logical, but it should be possible to create an image that does not rely on CUDA so that the GPU=0 flag can be used in the pipeline script.

So, at this point I have been "stung" by too many problems and I am just reporting this in the hopes that authors will consider generating ARM images and/or fixing up these scripts.

173.6 Successfully built detectron2 panopticapi fvcore antlr4-python3-runtime
173.6 Failed to build MultiScaleDeformableAttention
173.6 Pip subprocess error:
173.6   Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/detectron2.git /tmp/pip-req-build-2ne647iv
173.6   Running command git clone --filter=blob:none --quiet https://github.com/cocodataset/panopticapi.git /tmp/pip-req-build-xn4q0jdm
173.6   error: subprocess-exited-with-error
173.6   
173.6   × python setup.py bdist_wheel did not run successfully.
173.6   │ exit code: 1
173.6   ╰─> [146 lines of output]
173.6       No CUDA runtime is found, using CUDA_HOME='/opt/conda/envs/laypa'
173.6       running bdist_wheel
173.6       running build
173.6       running build_py
173.6       creating build
173.6       creating build/lib.linux-aarch64-cpython-311
173.6       creating build/lib.linux-aarch64-cpython-311/functions
173.6       copying functions/__init__.py -> build/lib.linux-aarch64-cpython-311/functions
173.6       copying functions/ms_deform_attn_func.py -> build/lib.linux-aarch64-cpython-311/functions
173.6       creating build/lib.linux-aarch64-cpython-311/modules
173.6       copying modules/__init__.py -> build/lib.linux-aarch64-cpython-311/modules
173.6       copying modules/ms_deform_attn.py -> build/lib.linux-aarch64-cpython-311/modules
173.6       running build_ext
173.6       building 'MultiScaleDeformableAttention' extension
173.6       creating /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311
173.6       creating /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src
173.6       creating /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa
173.6       creating /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models
173.6       creating /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder
173.6       creating /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops
173.6       creating /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops/src
173.6       creating /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops/src/cpu
173.6       Emitting ninja build file /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/build.ninja...
173.6       Compiling objects...
173.6       Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
173.6       [1/2] c++ -MMD -MF /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops/src/cpu/ms_deform_attn_cpu.o.d -pthread -B /opt/conda/envs/laypa/compiler_compat -Wsign-compare -DNDEBUG -fwrapv -O3 -Wall -fPIC -O3 -isystem /opt/conda/envs/laypa/include -fPIC -O3 -isystem /opt/conda/envs/laypa/include -fPIC -I/src/laypa/models/pixel_decoder/ops/src -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/TH -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/THC -I/opt/conda/envs/laypa/include/python3.11 -c -c /src/laypa/models/pixel_decoder/ops/src/cpu/ms_deform_attn_cpu.cpp -o /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops/src/cpu/ms_deform_attn_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1017"' -DTORCH_EXTENSION_NAME=MultiScaleDeformableAttention -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++17
173.6       FAILED: /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops/src/cpu/ms_deform_attn_cpu.o
173.6       c++ -MMD -MF /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops/src/cpu/ms_deform_attn_cpu.o.d -pthread -B /opt/conda/envs/laypa/compiler_compat -Wsign-compare -DNDEBUG -fwrapv -O3 -Wall -fPIC -O3 -isystem /opt/conda/envs/laypa/include -fPIC -O3 -isystem /opt/conda/envs/laypa/include -fPIC -I/src/laypa/models/pixel_decoder/ops/src -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/TH -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/THC -I/opt/conda/envs/laypa/include/python3.11 -c -c /src/laypa/models/pixel_decoder/ops/src/cpu/ms_deform_attn_cpu.cpp -o /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops/src/cpu/ms_deform_attn_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1017"' -DTORCH_EXTENSION_NAME=MultiScaleDeformableAttention -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++17
173.6       In file included from /opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/c10/cuda/CUDADeviceAssertionHost.h:3,
173.6                        from /opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAException.h:3,
173.6                        from /opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAFunctions.h:12,
173.6                        from /opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAStream.h:10,
173.6                        from /opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/ATen/cuda/CUDAContext.h:19,
173.6                        from /src/laypa/models/pixel_decoder/ops/src/cpu/ms_deform_attn_cpu.cpp:19:
173.6       /opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/c10/cuda/CUDAMacros.h:8:10: fatal error: c10/cuda/impl/cuda_cmake_macros.h: No such file or directory
173.6           8 | #include <c10/cuda/impl/cuda_cmake_macros.h>
173.6             |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173.6       compilation terminated.
173.6       [2/2] c++ -MMD -MF /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops/src/vision.o.d -pthread -B /opt/conda/envs/laypa/compiler_compat -Wsign-compare -DNDEBUG -fwrapv -O3 -Wall -fPIC -O3 -isystem /opt/conda/envs/laypa/include -fPIC -O3 -isystem /opt/conda/envs/laypa/include -fPIC -I/src/laypa/models/pixel_decoder/ops/src -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/TH -I/opt/conda/envs/laypa/lib/python3.11/site-packages/torch/include/THC -I/opt/conda/envs/laypa/include/python3.11 -c -c /src/laypa/models/pixel_decoder/ops/src/vision.cpp -o /src/laypa/models/pixel_decoder/ops/build/temp.linux-aarch64-cpython-311/src/laypa/models/pixel_decoder/ops/src/vision.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1017"' -DTORCH_EXTENSION_NAME=MultiScaleDeformableAttention -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++17
173.6       In file included from /src/laypa/models/pixel_decoder/ops/src/vision.cpp:16:
173.6       /src/laypa/models/pixel_decoder/ops/src/ms_deform_attn.h: In function ‘at::Tensor ms_deform_attn_forward(const at::Tensor&, const at::Tensor&, const at::Tensor&, const at::Tensor&, const at::Tensor&, int)’:
173.6       /src/laypa/models/pixel_decoder/ops/src/ms_deform_attn.h:34:20: 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]
173.6          34 |     if (value.type().is_cuda())
173.6             |                    ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions