Maratyszcza / NNPACK

Acceleration package for neural networks on multi-core CPUs
BSD 2-Clause "Simplified" License
1.67k stars 316 forks source link

Build fails: No module named peachpy.x86_64 #169

Closed yurivict closed 5 years ago

yurivict commented 5 years ago

I'm trying to build it on FreeBSD and it fails:

[20/45] cd /usr/ports/science/nnpack/work/.build && PYTHONPATH=/usr/ports/science/nnpack/work/NNPACK-c039579/deps/six:/usr/ports/science/nnpack/work/NNPACK-c039579/deps/enum: /usr/local/bin/python2.7 -m peachpy.x86_64 -mabi=sysv -g4 -mimage-format=elf -I/usr/ports/science/nnpack/work/NNPACK-c039579/src -I/usr/ports/science/nnpack/work/NNPACK-c039579/src/x86_64-fma -I/usr/local/include -o /usr/ports/science/nnpack/work/.build/src/x86_64-fma/2d-fourier-8x8.py.o /usr/ports/science/nnpack/work/NNPACK-c039579/src/x86_64-fma/2d-fourier-8x8.py
FAILED: src/x86_64-fma/2d-fourier-8x8.py.o 
cd /usr/ports/science/nnpack/work/.build && PYTHONPATH=/usr/ports/science/nnpack/work/NNPACK-c039579/deps/six:/usr/ports/science/nnpack/work/NNPACK-c039579/deps/enum: /usr/local/bin/python2.7 -m peachpy.x86_64 -mabi=sysv -g4 -mimage-format=elf -I/usr/ports/science/nnpack/work/NNPACK-c039579/src -I/usr/ports/science/nnpack/work/NNPACK-c039579/src/x86_64-fma -I/usr/local/include -o /usr/ports/science/nnpack/work/.build/src/x86_64-fma/2d-fourier-8x8.py.o /usr/ports/science/nnpack/work/NNPACK-c039579/src/x86_64-fma/2d-fourier-8x8.py
/usr/local/bin/python2.7: No module named peachpy.x86_64
ninja: build stopped: subcommand failed.
Maratyszcza commented 5 years ago

How do you build it? Do you use CMake?

yurivict commented 5 years ago

I use cmake w/in the FreeBSD ports framework. I am trying to create a port.

Maratyszcza commented 5 years ago

NNPACK CMake file should download PeachPy and add it to PYTHONPATH, see here, but I see only PYTHONPATH=/usr/ports/science/nnpack/work/NNPACK-c039579/deps/six:/usr/ports/science/nnpack/work/NNPACK-c039579/deps/enum: in your logs. Do you pass -DPYTHON_PEACHPY_SOURCE_DIR to CMake (you shouldn't)? Please paste a complete log, including the commands you type.

yurivict commented 5 years ago

PeachPy package is pre-installed, insecure downloads aren't allowed during the package builds.

Maratyszcza commented 5 years ago

Did you follow installation instructions in PeachPy README?

yurivict commented 5 years ago

yes, setup.py does all the work there.

Maratyszcza commented 5 years ago

Try a simple test, e.g. python -c "from peachpy.x86_64 import * ; ADD(eax, 5).encode()"

Maratyszcza commented 5 years ago

Actually, /usr/local/bin/python2.7 -c "from peachpy.x86_64 import * ; ADD(eax, 5).encode()" in your case, because this is the Python CMake finds.

yurivict commented 5 years ago

py27-peachpy installs x64 and x86 architectures.

$ python2.7 -c "from peachpy.x64 import * ; ADD(eax, 5).encode()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/peachpy/x64.py", line 8939, in ADD
    origin = inspect.stack() if Function.get_current().collect_origin else None
  File "/usr/local/lib/python2.7/site-packages/peachpy/x64.py", line 625, in get_current
    raise ValueError('No function is active')
ValueError: No function is active
$ python2.7 -c "from peachpy.x86 import * ; ADD(ax, 5).encode()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/peachpy/x86.py", line 2945, in ADD
    current_function.add_instruction(ArithmeticInstruction('ADD', Operand(destination), Operand(source)))
AttributeError: 'NoneType' object has no attribute 'add_instruction'

PeachPy-0.0.1 is installed using python's distutils. PeachPy-0.0.1 is what PyPI website suggests: https://pypi.org/project/PeachPy/ It fails with python-3.6 https://bitbucket.org/MDukhan/peachpy/issues/5/fails-with-python-36 so python-2.7 is forced.

Maratyszcza commented 5 years ago

DO NOT install PeachPy from PyPI. It is an old version, incompatible with NNPACK. Follow the instructions in PeachPy README

yurivict commented 5 years ago

The new version of PeachPy fixed this, thanks!