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

AArch64 architecture support #9

Closed
gaiar opened this issue Apr 25, 2019 · 38 comments · Fixed by #44
Closed

AArch64 architecture support #9

gaiar opened this issue Apr 25, 2019 · 38 comments · Fixed by #44

Comments

@gaiar
Copy link
Contributor

gaiar commented Apr 25, 2019

Problem when trying to build on ARM64 machine, similar to #6

/root/archiconda3/envs/spacy/compiler_compat/ld: warning: library search path "/usr/lib/gcc/aarch64-linux-gnu/7" is unsafe for cross-compilation
/root/archiconda3/envs/spacy/compiler_compat/ld: warning: library search path "/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu" is unsafe for cross-compilation
/root/archiconda3/envs/spacy/compiler_compat/ld: warning: library search path "/usr/lib/gcc/aarch64-linux-gnu/7/../../../../lib" is unsafe for cross-compilation
/root/archiconda3/envs/spacy/compiler_compat/ld: warning: library search path "/lib/aarch64-linux-gnu" is unsafe for cross-compilation
/root/archiconda3/envs/spacy/compiler_compat/ld: warning: library search path "/lib/../lib" is unsafe for cross-compilation
/root/archiconda3/envs/spacy/compiler_compat/ld: warning: library search path "/usr/lib/aarch64-linux-gnu" is unsafe for cross-compilation
/root/archiconda3/envs/spacy/compiler_compat/ld: warning: library search path "/usr/lib/../lib" is unsafe for cross-compilation
/root/archiconda3/envs/spacy/compiler_compat/ld: warning: library search path "/usr/lib/gcc/aarch64-linux-gnu/7/../../.." is unsafe for cross-compilation
/root/archiconda3/envs/spacy/bin/python: Error while finding module specification for 'setup.py' (AttributeError: module 'setup' has no attribute '__path__')

Command executed:

BLIS_ARCH=generic python -m setup.py build_ext --inplace

That problem is a blocker for running SpaCy on ARM64 and platforms like Nvidia Jetson.

@nextsunday
Copy link

I have same problem compiling with Jetson Nano.

@gaiar
Copy link
Contributor Author

gaiar commented May 20, 2019

I'm still getting such error

gcc: error: blis/cy.c: No such file or directory
gcc: fatal error: no input files

And I see in .gitignore

blis/cy.c
blis/py.c

Are these files expected to be generated?

@InputMoe
Copy link

InputMoe commented Jun 5, 2019

Please fix this issue fast :-)

@Impelon
Copy link
Contributor

Impelon commented Jun 15, 2019

I am also having this issue. Especially:

I'm still getting such error

gcc: error: blis/cy.c: No such file or directory
gcc: fatal error: no input files

And I see in .gitignore

blis/cy.c
blis/py.c

Are these files expected to be generated?

when building from source.

It is impossible to install via pip, because it uses x86_64 as arch, but I am on arm/aarch64. Even export BLIS_ARCH="generic" will not help, as the version on pip does not have the configuration for linux-generic.

@honnibal
Copy link
Member

honnibal commented Aug 18, 2019

Sorry for the delay on this. You should now be able to:

a) Installing with generic arch support:

BLIS_ARCH="generic" pip install spacy --no-binary blis

b) Building ARM64 support:

See here for list of architectures: https://github.com/flame/blis/blob/0.5.1/config_registry

git clone https://github.com/explosion/cython-blis && cd cython-blis
git pull && git submodule init && git submodule update && git submodule status
python3 -m venv env3.6
source env3.6/bin/activate
pip install -r requirements.txt
./bin/generate-make-jsonl linux cortex57
BLIS_ARCH="coretexa57" python setup.py build_ext --inplace
BLIS_ARCH="cortexa57" python setup.py bdist_wheel

Fingers crossed, this will build you a wheel that supports your platform. You could then make a PR with the blis/_src/make/linux-cortexa57.jsonl and blis/_src/include/linux-cortexa57/blis.h files so that you can finally run:

BLIS_ARCH=cortexa57 pip install spacy --no-binary=blis

@Impelon
Copy link
Contributor

Impelon commented Aug 18, 2019

Hey, great that you're back with a fix for this! Much appreciated.

b) Building ARM64 support:

See here for list of architectures: https://github.com/flame/blis/blob/0.5.1/config_registry

git clone https://github.com/explosion/cython-blis && cd cython-blis
git pull && git submodule init && git submodule update && git submodule status
python3 -m venv env3.6
source env3.6/bin/activate
pip install -r requirements.txt
./bin/generate-make-jsonl linux cortex57
BLIS_ARCH="coretex57" python setup.py build_ext --inplace
BLIS_ARCH="cortex57" python setup.py bdist_wheel

Fingers crossed, this will build you a wheel that supports your platform. You could then make a PR with the blis/_src/make/linux-cortex57.jsonl and blis/_src/include/linux-cortex57/blis.h files so that you can finally run:

BLIS_ARCH=cortex57 pip install spacy --no-binary=blis

Are you sure about these exact steps/commands for building? In your original reply there was some amd64 and power9 mixed in between. Now instead you replaced those occurrences with cortex57, but the linked config-registry does not mention that configuration. Instead there is a cortexa-"family" (including cortexa57), I suppose you mean that one? Also it seems those configurations seem to be disabled.

I have not tried building it on my AArch64 system with the new configuration; I will try to do so in the next couple of days/weeks and keep you updated.
Could you please clarify my points above and/or edit your building-script in your previous answer in order for me to do so?

@honnibal
Copy link
Member

@Impelon Thanks, updated to say cortexa57. My understanding is that the families are disabled because Blis isn't capable of choosing between generic and cortexa57 kernels at runtime, due to some missing detection logic? I'm not sure on this, it was just how I understood the comment. So I would hope that cortexa57 would work.

What machine are you using, by the way? Do you know any cloud computing resources that provide these ARM architectures so that I can test things?

@gaiar
Copy link
Contributor Author

gaiar commented Aug 19, 2019

@honnibal Both builds failed on Jetson Nano - cortexa57 and generic. As a cloud provider, I'm using Scaleway. I have access to ARM7 and ARM64 instances if needed.

@honnibal
Copy link
Member

Could you describe the failure? If you clone and build https://github.com/flame/blis, can you build that?

@Impelon
Copy link
Contributor

Impelon commented Aug 20, 2019

@honnibal I am on a Raspberry Pi 3 with Arch Linux ARM AArch64. Also as far as I understand the Raspberry Pi 3 actually uses the coretex-A53 micro-architecture, so I'll be using that.
I am now in the process of trying both installation methods. I will update this comment later with my findings.

Update 1

This is the pip-log after the failed installation with the first method. Will try the 2nd option now.
spacy_generic.log

Update 2

I have now tried the second method and succeded.
I cloned the repository and created the virtual environment, setup everything and then I executed ./bin/generate-make-jsonl linux cortexa53
Here is the log from running the generate-make-jsonl-script, it is relatively unspectacular, also here the log from blame-blis' make.
During the make process these warnings appeared.

I continued afterwards with the building process by running BLIS_ARCH="cortexa53" python setup.py build_ext --inplace
As you can see this was successful, but I had a lot of warnings about unused functions, and some deprecated NumPy API:

[...]
/home/server/cython-blis/blis/_src/include/linux-cortexa53/blis.h:4330:15: warning: 'bli_is_odd' defined but not used  -Wunused-function]
 static bool_t bli_is_odd( gint_t a )
               ^~~~~~~~~~
/home/server/cython-blis/blis/_src/include/linux-cortexa53/blis.h:4310:16: warning: 'bli_round_to_mult' defined but not used [-Wunused-function]
 static guint_t bli_round_to_mult( guint_t val, guint_t mult )
                ^~~~~~~~~~~~~~~~~
/home/server/cython-blis/blis/_src/include/linux-cortexa53/blis.h:4303:15: warning: 'bli_round' defined but not used [-Wunused-function]
 static double bli_round( double a )
               ^~~~~~~~~
/home/server/cython-blis/blis/_src/include/linux-cortexa53/blis.h:1802:13: warning: 'bli_obj_init_subpart_from' defined but not used [-Wunused-function]
 static void bli_obj_init_subpart_from( obj_t* a, obj_t* b )
             ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/server/cython-blis/include/numpy/ndarraytypes.h:1728,
                 from /home/server/cython-blis/include/numpy/ndarrayobject.h:17,
                 from /home/server/cython-blis/include/numpy/arrayobject.h:15,
                 from blis/py.c:598:
/home/server/cython-blis/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
  ^~~~~~~

Finally I executed BLIS_ARCH="cortexa53" python setup.py bdist_wheel and got the following result:
bdist_wheel.log
The same warnings as one step above occured during this step as well.

In conclusion: I did manage to compile a blis-wheel on my AArch64-system.

@Impelon
Copy link
Contributor

Impelon commented Aug 21, 2019

Looking through the first log I posted above, I noticed that blis 0.2.4 was requested by thinc.
Isn't that a problem? You mentioned these errors are fixed in 0.3.1.

@honnibal
Copy link
Member

@Impelon Thanks! Yes I need to push new versions of Thinc and spaCy that allow v0.3.1. I think it's just a matter of updating the requirements though.

@Impelon
Copy link
Contributor

Impelon commented Aug 23, 2019

I just tried to install my compiled wheel, though.

(env) [_redacted_ dist]$ pip install blis-0.3.1-cp37-cp37m-linux_aarch64.whl 
Processing ./blis-0.3.1-cp37-cp37m-linux_aarch64.whl
Requirement already satisfied: numpy>=1.15.0 in /usr/lib/python3.7/site-packages (from blis==0.3.1) (1.17.0)
Installing collected packages: blis
Successfully installed blis-0.3.1
(env) [_redacted_ dist]$ python3
Python 3.7.4 (default, Jul 30 2019, 12:59:34) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import blis
Segmentation fault (core dumped)

Any ideas?

@honnibal
Copy link
Member

Hmm. I'm really not sure how to debug that :(. Can you try the generic kernel?

@gaiar
Copy link
Contributor Author

gaiar commented Aug 28, 2019

Still not able to build on ARM64 :(

Will try cortexa53

(env3.6) (base) root@scw-cranky-dubinsky:~/developer/cython-blis# ./bin/generate-make-jsonl linux cortexa57
configure: detected Linux kernel version 4.14.128-mainline-rev1.
configure: python interpeter search list is: python python3 python2.
configure: using 'python' python interpreter.
configure: found python version 3.6.8 (maj: 3, min: 6, rev: 8).
configure: python 3.6.8 appears to be supported.
configure: C compiler search list is: gcc clang cc.
configure: using 'gcc' C compiler.
configure: C++ compiler search list is: g++ clang++ c++.
configure: using 'g++' C++ compiler (for sandbox only).
configure: found gcc version 7.4.0 (maj: 7, min: 4, rev: 0).
configure: checking for blacklisted configurations due to gcc 7.4.0.
configure: found assembler ('as') version 2.30 (maj: 2, min: 30, rev: ).
configure: checking for blacklisted configurations due to as 2.30.
configure: warning: assembler ('as' 2.30) does not support 'bulldozer'; adding to blacklist.
configure: warning: assembler ('as' 2.30) does not support 'sandybridge'; adding to blacklist.
configure: warning: assembler ('as' 2.30) does not support 'haswell'; adding to blacklist.
configure: warning: assembler ('as' 2.30) does not support 'piledriver'; adding to blacklist.
configure: warning: assembler ('as' 2.30) does not support 'steamroller'; adding to blacklist.
configure: warning: assembler ('as' 2.30) does not support 'excavator'; adding to blacklist.
configure: warning: assembler ('as' 2.30) does not support 'skx'; adding to blacklist.
configure: warning: assembler ('as' 2.30) does not support 'knl'; adding to blacklist.
configure: configuration blacklist:
configure:   bulldozer sandybridge haswell piledriver steamroller excavator skx knl
configure: reading configuration registry...done.
configure: determining default version string.
configure: could not find '.git' directory; using unmodified version file.
configure: starting configuration of BLIS 0.5.1.
configure: configuring with official version string.
configure: found shared library .so version '2.0.0'.
configure:   .so major version: 2
configure:   .so minor.build version: 0.0
configure: manual configuration requested; configuring with 'cortexa57'.
configure: checking configuration against contents of 'config_registry'.
configure: configuration 'cortexa57' is registered.
configure: 'cortexa57' is defined as having the following sub-configurations:
configure:    cortexa57
configure: which collectively require the following kernels:
configure:    armv8a
configure: checking sub-configurations:
configure:   'cortexa57' is registered...and exists.
configure: checking sub-configurations' requisite kernels:
configure:   'armv8a' kernels...exist.
configure: no install prefix option given; defaulting to '/root/blis'.
configure: no install libdir option given; defaulting to PREFIX/lib.
configure: no install includedir option given; defaulting to PREFIX/include.
configure: no install sharedir option given; defaulting to PREFIX/share.
configure: final installation directories:
configure:   libdir:     /root/blis/lib
configure:   includedir: /root/blis/include
configure:   sharedir:   /root/blis/share
configure: no preset CFLAGS detected.
configure: no preset LDFLAGS detected.
configure: debug symbols disabled.
configure: enabling verbose make output. (disable with 'make V=0'.)
configure: disabling ARG_MAX hack.
configure: building BLIS as a static library (shared library disabled).
configure: threading is disabled.
configure: requesting slab threading in jr and ir loops.
configure: internal memory pools for packing blocks are enabled.
configure: internal memory pools for small blocks are enabled.
configure: memory tracing output is disabled.
configure: libmemkind not found; disabling.
configure: compiler appears to support #pragma omp simd.
configure: the BLAS compatibility layer is disabled.
configure: the CBLAS compatibility layer is disabled.
configure: mixed datatype support is enabled.
configure: mixed datatype optimizations requiring extra memory are enabled.
configure: the BLIS API integer size is automatically determined.
configure: the BLAS/CBLAS API integer size is 32-bit.
configure: configuring for conventional gemm implementation.
configure: creating ./config.mk from ./build/config.mk.in
configure: creating ./bli_config.h from ./build/bli_config.h.in
configure: creating ./obj/cortexa57
configure: creating ./obj/cortexa57/config/cortexa57
configure: creating ./obj/cortexa57/kernels/armv8a
configure: creating ./obj/cortexa57/ref_kernels/cortexa57
configure: creating ./obj/cortexa57/frame
configure: creating ./obj/cortexa57/blastest
configure: creating ./obj/cortexa57/testsuite
configure: creating ./lib/cortexa57
configure: creating ./include/cortexa57
configure: mirroring ./config/cortexa57 to ./obj/cortexa57/config/cortexa57
configure: mirroring ./kernels/armv8a to ./obj/cortexa57/kernels/armv8a
configure: mirroring ./ref_kernels to ./obj/cortexa57/ref_kernels
configure: mirroring ./ref_kernels to ./obj/cortexa57/ref_kernels/cortexa57
configure: mirroring ./frame to ./obj/cortexa57/frame
configure: creating makefile fragments in ./obj/cortexa57/config/cortexa57
configure: creating makefile fragments in ./obj/cortexa57/kernels/armv8a
configure: creating makefile fragments in ./obj/cortexa57/ref_kernels
configure: creating makefile fragments in ./obj/cortexa57/frame
configure: configured to build within top-level directory of source distribution.
Compile

^[[B^[[BPreprocess make log
(env3.6) (base) root@scw-cranky-dubinsky:~/developer/cython-blis#
(env3.6) (base) root@scw-cranky-dubinsky:~/developer/cython-blis# BLIS_ARCH="coretexa57" python setup.py build_ext --inplace
BLIS_COMPILER? None
/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
running build_ext
Processing blis/cy.pyx
/root/developer/cython-blis/env3.6/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /root/developer/cython-blis/blis/cy.pxd
  tree = Parsing.p_module(s, pxd, full_module_name)
Processing blis/py.pyx
/root/developer/cython-blis/env3.6/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /root/developer/cython-blis/blis/py.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
unix
py_compiler gcc
error: [Errno 2] No such file or directory: '/root/developer/cython-blis/blis/_src/make/linux-coretexa57.jsonl'
(env3.6) (base) root@scw-cranky-dubinsky:~/developer/cython-blis# ls /root/developer/cython-blis/blis/_src/make/
darwin-x86_64.jsonl    linux-cortexa57.jsonl  linux-x86_64.jsonl
linux-cortexa53.jsonl  linux-generic.jsonl    windows-x86_64.jsonl

@gaiar
Copy link
Contributor Author

gaiar commented Aug 28, 2019

Nevermind, there is a typo in readme. PR created.
BLIS_ARCH="corEtexa57" python setup.py build_ext --inplace

@gaiar
Copy link
Contributor Author

gaiar commented Aug 28, 2019

I've succeded build and importing blis on my ARM64 server

(env3.6) (base) root@scw-cranky-dubinsky:~/developer/cython-blis/dist# pip install blis-0.4.0-cp36-cp36m-linux_aarch64.whl
Processing ./blis-0.4.0-cp36-cp36m-linux_aarch64.whl
Requirement already satisfied: numpy>=1.15.0 in /root/developer/cython-blis/env3.6/lib/python3.6/site-packages (from blis==0.4.0)
Installing collected packages: blis
Successfully installed blis-0.4.0
(env3.6) (base) root@scw-cranky-dubinsky:~/developer/cython-blis/dist# export OMP_NUM_THREADS=1
(env3.6) (base) root@scw-cranky-dubinsky:~/developer/cython-blis/dist# python -m blis.benchmark
Setting up data for gemm. 1000 iters,  nO=384 nI=384 batch_size=2000
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/developer/cython-blis/env3.6/lib/python3.6/site-packages/blis/benchmark.py", line 107, in <module>
    main()
  File "/root/developer/cython-blis/env3.6/lib/python3.6/site-packages/blis/benchmark.py", line 76, in main
    numpy_blas = get_numpy_blas()
  File "/root/developer/cython-blis/env3.6/lib/python3.6/site-packages/blis/benchmark.py", line 19, in get_numpy_blas
    blas_libs = numpy.__config__.blas_opt_info["libraries"]
KeyError: 'libraries'
(env3.6) (base) root@scw-cranky-dubinsky:~/developer/cython-blis/dist# python
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import blis
>>>

there are some problems with benchmarking, but hope it is minor

@Impelon
Copy link
Contributor

Impelon commented Aug 30, 2019

Sorry I have not responded these past few days, I have been quite sick.

Eitherway, I am going to try to give @honnibal some more info to debug this. I've run python with gdb:

(env) [server@alarm cython-blis]$ gdb python
Reading symbols from python...
(No debugging symbols found in python)
(gdb) run
Starting program: /home/server/cython-blis/env/bin/python 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Python 3.7.4 (default, Jul 30 2019, 12:59:34) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import blis

Program received signal SIGSEGV, Segmentation fault.
0x0000ffffbed87620 in bli_gks_lookup_ind_cntx ()
   from /home/server/cython-blis/blis/cy.cpython-37m-aarch64-linux-gnu.so
(gdb) backtrace 
#0  0x0000ffffbed87620 in bli_gks_lookup_ind_cntx () from /home/server/cython-blis/blis/cy.cpython-37m-aarch64-linux-gnu.so
#1  0x0000ffffbed986b0 in bli_ind_init () from /home/server/cython-blis/blis/cy.cpython-37m-aarch64-linux-gnu.so
#2  0x0000ffffbed87ee0 in bli_init_apis () from /home/server/cython-blis/blis/cy.cpython-37m-aarch64-linux-gnu.so
#3  0x0000ffffbf32c378 in __pthread_once_slow () from /usr/lib/libpthread.so.0
#4  0x0000ffffbebef350 in __pyx_pymod_exec_cy (__pyx_pyinit_module=<optimized out>) at blis/cy.c:22101
#5  0x0000ffffbf424700 in PyModule_ExecDef () from /usr/lib/libpython3.7m.so.1.0
#6  0x0000ffffbf4e149c in ?? () from /usr/lib/libpython3.7m.so.1.0
#7  0x0000ffffbf3ddfb8 in _PyMethodDef_RawFastCallDict () from /usr/lib/libpython3.7m.so.1.0
#8  0x0000ffffbf3de024 in _PyCFunction_FastCallDict () from /usr/lib/libpython3.7m.so.1.0
#9  0x0000ffffbf3b5ce0 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#10 0x0000ffffbf4c6b6c in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#11 0x0000ffffbf3dd154 in _PyFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#12 0x0000ffffbf3b6ffc in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#13 0x0000ffffbf3ad44c in ?? () from /usr/lib/libpython3.7m.so.1.0
#14 0x0000ffffbf3b70a8 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#15 0x0000ffffbf3ad44c in ?? () from /usr/lib/libpython3.7m.so.1.0
#16 0x0000ffffbf3b4c44 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#17 0x0000ffffbf3ad44c in ?? () from /usr/lib/libpython3.7m.so.1.0
#18 0x0000ffffbf3b4c44 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#19 0x0000ffffbf3ad44c in ?? () from /usr/lib/libpython3.7m.so.1.0
#20 0x0000ffffbf3dd0b0 in _PyFunction_FastCallDict () from /usr/lib/libpython3.7m.so.1.0
#21 0x0000ffffbf3df050 in ?? () from /usr/lib/libpython3.7m.so.1.0
#22 0x0000ffffbf3df36c in _PyObject_CallMethodIdObjArgs () from /usr/lib/libpython3.7m.so.1.0
#23 0x0000ffffbf4e4ff8 in PyImport_ImportModuleLevelObject () from /usr/lib/libpython3.7m.so.1.0
#24 0x0000ffffbf3b7b14 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#25 0x0000ffffbf4c6b6c in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#26 0x0000ffffbf4c6f00 in PyEval_EvalCodeEx () from /usr/lib/libpython3.7m.so.1.0
#27 0x0000ffffbf4c6f44 in PyEval_EvalCode () from /usr/lib/libpython3.7m.so.1.0
#28 0x0000ffffbf4c3cfc in ?? () from /usr/lib/libpython3.7m.so.1.0
#29 0x0000ffffbf3ddf90 in _PyMethodDef_RawFastCallDict () from /usr/lib/libpython3.7m.so.1.0
#30 0x0000ffffbf3de024 in _PyCFunction_FastCallDict () from /usr/lib/libpython3.7m.so.1.0
#31 0x0000ffffbf3b5ce0 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#32 0x0000ffffbf4c6b6c in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#33 0x0000ffffbf3dd154 in _PyFunction_FastCallKeywords () from /usr/lib/libpython3.7m.so.1.0
#34 0x0000ffffbf3b6ffc in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#35 0x0000ffffbf3ad44c in ?? () from /usr/lib/libpython3.7m.so.1.0
#36 0x0000ffffbf3b70a8 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#37 0x0000ffffbf3ad44c in ?? () from /usr/lib/libpython3.7m.so.1.0
#38 0x0000ffffbf3b4c44 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#39 0x0000ffffbf3ad44c in ?? () from /usr/lib/libpython3.7m.so.1.0
#40 0x0000ffffbf3b4c44 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#41 0x0000ffffbf3ad44c in ?? () from /usr/lib/libpython3.7m.so.1.0
#42 0x0000ffffbf3dd0b0 in _PyFunction_FastCallDict () from /usr/lib/libpython3.7m.so.1.0
#43 0x0000ffffbf3df050 in ?? () from /usr/lib/libpython3.7m.so.1.0
#44 0x0000ffffbf3df36c in _PyObject_CallMethodIdObjArgs () from /usr/lib/libpython3.7m.so.1.0
#45 0x0000ffffbf4e4ff8 in PyImport_ImportModuleLevelObject () from /usr/lib/libpython3.7m.so.1.0
#46 0x0000ffffbf3b7b14 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.7m.so.1.0
#47 0x0000ffffbf4c6b6c in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.7m.so.1.0
#48 0x0000ffffbf4c6f00 in PyEval_EvalCodeEx () from /usr/lib/libpython3.7m.so.1.0
#49 0x0000ffffbf4c6f44 in PyEval_EvalCode () from /usr/lib/libpython3.7m.so.1.0
#50 0x0000ffffbf4fdf2c in ?? () from /usr/lib/libpython3.7m.so.1.0
#51 0x0000ffffbf4fe280 in PyRun_InteractiveLoopFlags () from /usr/lib/libpython3.7m.so.1.0
#52 0x0000ffffbf4fed50 in PyRun_AnyFileExFlags () from /usr/lib/libpython3.7m.so.1.0
#53 0x0000ffffbf5234d4 in ?? () from /usr/lib/libpython3.7m.so.1.0
#54 0x0000ffffbf5239c0 in _Py_UnixMain () from /usr/lib/libpython3.7m.so.1.0
#55 0x0000ffffbf1cb6e4 in __libc_start_main () from /usr/lib/libc.so.6
#56 0x0000aaaaaaaaa910 in _start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Also I did try the generic kernel, you can see my failed attempt and the log-file in my previous post, where I documented the installation process.

@gaiar I think you should make a PR with the cortexa57 configuration as mentioned by @honnibal. Then others may not have to worry about this in the future.

@gaiar
Copy link
Contributor Author

gaiar commented Aug 30, 2019

Yes, sure, I'll create a PR, but I've into a problem, that numpy even after compilation doesn't pickup blis library :( I've tried release version and compiled from master.

@Impelon
Copy link
Contributor

Impelon commented Aug 30, 2019

I am not sure that this matters. I mean correct me if I am entirely wrong about this, but I think as long as we were able to successfully build the wheel the configuration was correct. I think they are used to collect information about the architectures capabilities. I think the same configuration-files will be generated on the same architectures, regardless if the produced wheel is working or not.

Also I'm a bit unsure on what problem you are having with numpy. Looking through your error above when benchmarking this strikes my eye:

  File "/root/developer/cython-blis/env3.6/lib/python3.6/site-packages/blis/benchmark.py", line 19, in get_numpy_blas
    blas_libs = numpy.__config__.blas_opt_info["libraries"]
KeyError: 'libraries'

That error has nothing to do with blis.
The following works on my system:

>>> import numpy
>>> numpy.__config__.blas_opt_info
{'define_macros': [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)], 'libraries': ['cblas', 'blas', 'blas'], 'library_dirs': ['/usr/lib'], 'include_dirs': ['/usr/local/include', '/usr/include'], 'language': 'c'}
>>> numpy.__config__.blas_opt_info["libraries"]
['cblas', 'blas', 'blas']

Again, correct me if I am wrong, but I don't think numpy is supposed to work together with blis; blis is module you can use to perform some operations faster than you could with numpy, or not?

@gaiar
Copy link
Contributor Author

gaiar commented Aug 30, 2019

Yes, you are correct. But after I'm installing blis, numpy is not using it, so that warned me a bit, as I wasn't able to check it in action.

I can try uploading the wheel, so and then maybe or someone can try installing it and running - to have another pair of eyes.

@gaiar
Copy link
Contributor Author

gaiar commented Sep 2, 2019

Here is the wheel
blis-0.4.0-cp36-cp36m-linux_aarch64.whl.zip

@ismu
Copy link

ismu commented Sep 7, 2019

Hello :)
I am very intresting to use spacy on ARMv8, but I have still problem with blis. When I use @gaiar .whl when I import spacy I get segmentation fault. When I use pdb I get message taht spacy isn't installed... I dont't understand it, becouse I installed it and pip3 freeze list it...
I think it can be caused by incompatibile version of blis? When I try manualy "compile" using @honnibal tutorial I can't generate .josonl files. I get error:
Traceback (most recent call last): File "../bin/munge_make_log.py", line 5, in <module> arch_name = sys.argv[1] IndexError: list index out of range
I use command ./bin/generate-make-jsonl linux cortexa57
Someone can help with it?

EDIT:
I don't know what I made, but all works...

@thietnha
Copy link

Hello :)
I am very intresting to use spacy on ARMv8, but I have still problem with blis. When I use @gaiar .whl when I import spacy I get segmentation fault. When I use pdb I get message taht spacy isn't installed... I dont't understand it, becouse I installed it and pip3 freeze list it...
I think it can be caused by incompatibile version of blis? When I try manualy "compile" using @honnibal tutorial I can't generate .josonl files. I get error:
Traceback (most recent call last): File "../bin/munge_make_log.py", line 5, in <module> arch_name = sys.argv[1] IndexError: list index out of range
I use command ./bin/generate-make-jsonl linux cortexa57
Someone can help with it?

EDIT:
I don't know what I made, but all works...

I have the same error! Please anyone recommend me!

@ppizzo
Copy link

ppizzo commented Sep 25, 2019

I managed to get spaCy compiling and running on my NVIDIA Jetson TX1 (arm64) with the following setup:

  1. install spaCy from source: you have to get the latest stable version, 2.1.8 at the time of writing, (git clone -b ...) and follow guidelines on spaCy website
  2. replace the downloaded requirements.txt with requirements.txt on master branch
  3. set env var BLIS_ARCH=generic
  4. build & install as usual

The above trick works because spaCy 2.1.8 depends on blis 0.2 which doesn't have generic arch support JSON file, which is included in release 0.4 as per requirements.txt on master branch; but if you compile the development version you cannot download any model because they are not released yet. So I'm using the stable branch with latest development dependencies.

BUT: I didn't manage (yet) to compile it with GPU support.

@sreevan
Copy link

sreevan commented Sep 25, 2019

I tried the various solutions as above on Jetson TX2 but none of them worked. Can someone please provide a whl? It seems to choose x86 architecture always when compiling blis from source.
part of the error:

gcc -c /home/nvidia/cython-blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c -o /tmp/tmp7oxv4z9t/bli_amaxv_zen_int.o -O3 -mavx2 -mfma -mfpmath=sse -march=core-avx2 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/home/nvidia/cython-blis/blis/_src/include/linux-x86_64
gcc: error: unrecognized command line option ‘-mavx2’
gcc: error: unrecognized command line option ‘-mfma’
gcc: error: unrecognized command line option ‘-mfpmath=sse’

@sebpop
Copy link
Contributor

sebpop commented May 22, 2020

I created PR #25 to add the generated files for cortex-a57.

@sebpop
Copy link
Contributor

sebpop commented May 28, 2020

PR #25 got merged. Thanks!

BLIS_ARCH="cortexa57" pip3 install spacy --no-binary blis still fails with the same error not finding blis/blis/_src/make/linux-cortexa57.jsonl.

Could somebody please propagate the change to https://pypi.org/project/blis/#files
it still has a cython-blis released on Sep 30, 2019:
https://files.pythonhosted.org/packages/98/5a/f9b8a78e3d1fdde1b0215413d88ab55d907ab81f95b62418a6e9cda30dec/blis-0.4.1.tar.gz

@ansarirayyan
Copy link

ansarirayyan commented Jun 16, 2020

I got past the blis/blis/_src/make/linux-cortexa57.jsonl issue (except in my case I used cortexa15). If I recall correctly, I did this by installing the wheel file located in the ./dist directory of cython-blis after cloning the repository and generating the file. But I get the following errors now:

2020-06-16T03:45:34,103       gcc: error: unrecognized -march target: core-avx2
2020-06-16T03:45:34,104       gcc: note: valid arguments are: armv4 armv4t armv5t armv5te armv5tej armv6 armv6j armv6k armv6z armv6kz armv6zk armv6t2 armv6-m armv6s-m armv7 armv7-a armv7ve armv7-r armv7-m armv7e-m armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv8-m.base armv8-m.main armv8-r iwmmxt iwmmxt2 native
2020-06-16T03:45:34,105       gcc: error: missing argument to '-march='
2020-06-16T03:45:34,110       gcc: error: unrecognized command line option '-mavx2'
2020-06-16T03:45:34,111       gcc: error: unrecognized command line option '-mfma'
2020-06-16T03:45:34,120       gcc: error: unrecognized command line option '-mfpmath=sse'

These files were generated on a Raspberry Pi 3 Model B V1.2 with an armv71 chip with a model name of cortex-a53. The CPU information of the single-board system was gathered via lscpu. I used the cortexa15 architectures when generating the *.whl file. The logs you see above were taken from a log file created using the --log flag. The exact command that was run is the following:

BLIS_ARCH="coretexa15" sudo pip -v --no-color install spacy --no-binary=blis --log log2

The Raspberry Pi is running Arch Linux ARM with kernel version 4.19.115-1.

I seem to be facing the same error that @sreevan is facing.

@honnibal
Copy link
Member

@sebpop Sorry for the delay on this (and sorry for the delay to others as well!)

I had a lot of trouble updating cython-blis previously because the Python ecosystem was stuck on the manylinux1 container, which used a compiler toolchain from 2007. This made it really hard to build wheels for the library, so I was struggling to get updated to recent versions of Blis.

I've now made a new release that also includes build files for a cortexa57 architecture, which is now supported by Travis CI. I'm hoping we can set up a build system for more architectures as well.

@WalrusHat
Copy link

Can someone write a new tutorial on how to install this on a Pi 4... going from here to stackoverflow to figure out how to install this is getting exhausting. I’ve been trying to build the blis wheel for 3 days now...

1 similar comment
@WalrusHat
Copy link

Can someone write a new tutorial on how to install this on a Pi 4... going from here to stackoverflow to figure out how to install this is getting exhausting. I’ve been trying to build the blis wheel for 3 days now...

@veerkumar
Copy link

After lots of hiccups, finally could compile for Jetson TX2 (Cortex-A57):
Here is the whl file for direct installation.
Blis-0.7.1: blis-0.7.1-cp36-cp36m-linux_aarch64.whl

@gruentee
Copy link

After lots of hiccups, finally could compile for Jetson TX2 (Cortex-A57):
Here is the whl file for direct installation.
Blis-0.7.1: blis-0.7.1-cp36-cp36m-linux_aarch64.whl

When I try building spaCy after installing this in a virtualenv, pip still tries to install blis from PyPi. Any idea why?

@adrianeboyd
Copy link
Contributor

Hi, this issue is fairly old and we don't have any idea about the quality/suitability of the wheel from that link. Can you open a new issue describing the particular problems you're running into installing blis with more information about your environment instead?

@gruentee
Copy link

@adrianeboyd Thanks for the quick response! I'm trying to install a fairly old spaCy version as dependency for AllenNLP on a Jetson Nano. I'll open a separate issue for this.

@joes-complexio
Copy link

For other people searching for issues related to linux-cortexa57.jsonl not being found, Google brought me to this issue.

You want to look at #112

@SvenWesterlaken
Copy link

For other people searching for issues related to linux-cortexa57.jsonl not being found, Google brought me to this issue.

You want to look at #112

Had this issue, seems like it's getting picked up mostly in this issue: #117

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

Successfully merging a pull request may close this issue.