Maratyszcza / NNPACK

Acceleration package for neural networks on multi-core CPUs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ModuleNotFoundError: No module named 'peachpy.x86_64.avx'

adamjstewart opened this issue · comments

I'm writing a Spack package for NNPACK. Ideally, I would be able to link to already installed copies of these dependencies instead of having to install them multiple times.

When NNPACK tries to build its dependencies, they fail with errors like:

FAILED: src/x86_64-fma/2d-fourier-8x8.py.o 
cd /tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-build-ogzjpx3 && PYTHONPATH=/tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-src/deps/six:/tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-src/deps/peachpy /home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/python-3.8.10-owirpnfxjurir472qs6zmrfzcuj7ruiv/bin/python -m peachpy.x86_64 -mabi=sysv -g4 -mimage-format=elf -I/tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-src/src -I/tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-src/src/x86_64-fma -I/tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-src/deps/fp16/include -o /tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-build-ogzjpx3/src/x86_64-fma/2d-fourier-8x8.py.o /tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-src/src/x86_64-fma/2d-fourier-8x8.py
Traceback (most recent call last):
  File "/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/python-3.8.10-owirpnfxjurir472qs6zmrfzcuj7ruiv/lib/python3.8/runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/python-3.8.10-owirpnfxjurir472qs6zmrfzcuj7ruiv/lib/python3.8/runpy.py", line 144, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/t-astewart/spack/opt/spack/linux-ubuntu18.04-haswell/gcc-7.5.0/python-3.8.10-owirpnfxjurir472qs6zmrfzcuj7ruiv/lib/python3.8/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-src/deps/peachpy/peachpy/x86_64/__init__.py", line 25, in <module>
    from peachpy.x86_64.function import Function, LocalVariable
  File "/tmp/t-astewart/spack-stage/spack-stage-nnpack-master-ogzjpx3yaadxf3cudq6yxmxjnvzmvlzl/spack-src/deps/peachpy/peachpy/x86_64/function.py", line 16, in <module>
    import peachpy.x86_64.avx
ModuleNotFoundError: No module named 'peachpy.x86_64.avx'

P.S. Would anyone like to be listed as the official maintainer for the NNPACK package? You don't need to know much about Spack, it just gives us someone to ping when a user reports build issues or wants to modify the build recipe.

This error occurs for me on both Ubuntu 18.04 with GCC 7.5.0 and on macOS 10.15.7 with Apple Clang 12.0.0.

It looks like peachpy/x86_64/avx.py is supposed to be generated by opcodes. If I build peachpy on its own it works fine. I'm guessing there's something wrong in the CMake configuration and opcodes isn't being used.

Workaround: if I set -DNNPACK_BACKEND=psimd I can skip the peachpy dependency altogether and get NNPACK to build. I have no idea what the performance consequences of this are.

I think when PYTHON_PEACHPY_SOURCE_DIR is set, we don't run python setup.py generate. Also, I noticed that the PYTHONPATH gets overridden, so Python can't find my setuptools which is set in a different directory.

Hi I've been stacked by the same problem when building pytorch, which uses NNpack and peachpy as submodules. Do you have any idea to fix this? Thanks!

commented

Probably it could be related #202
See ... ${CMAKE_CURRENT_LIST_DIR}/src/x86_64-fma) in patch

Hi I've been stacked by the same problem when building pytorch, which uses NNpack and peachpy as submodules. Do you have any idea to fix this? Thanks!

Hello,I also encountered this issue while installing Pytorch and it has now been solved.You need to execute python setup.py generate under /pytorch/third_party/python-peachpy/ path