Giter VIP home page Giter VIP logo

explosion / cython-blis Goto Github PK

View Code? Open in Web Editor NEW
215.0 11.0 38.0 6.1 MB

๐Ÿ’ฅ Fast matrix-multiplication as a self-contained Python library โ€“ no system dependencies!

License: Other

Python 0.09% Shell 0.10% C 99.12% C++ 0.12% Makefile 0.38% Assembly 0.12% Cython 0.08%
cython blis blas blas-libraries openblas linear-algebra matrix-multiplication numpy neural-networks neural-network

cython-blis's People

Contributors

adrianeboyd avatar althonos avatar danieldk avatar gaiar avatar hoefling avatar honnibal avatar impelon avatar ines avatar isuruf avatar niyas-sait avatar sebpop avatar shademe avatar svlandeg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cython-blis's Issues

Clang UBSAN runtime warnings: UndefinedBehaviorSanitizer: invalid-shift-base (linux-x86_64)

When trying to build blis with my local compiler setup (linux-x86_64 target) - clang complains about

SUMMARY: UndefinedBehaviorSanitizer: blis.h

blis.h runtime error: left shift of 7 by 29 places cannot be represented in type 'int'
    #0 0x7ffb69e87899 in bli_obj_set_comp_dt blis/_src/include/linux-x86_64/blis.h
    #1 0x7ffb69e86f54 in bli_obj_create_without_buffer blis/_src/frame/base/bli_obj.c
    #2 0x7ffb69e87cbe in bli_obj_create_1x1_with_attached_buffer blis/_src/frame/base/bli_obj.c
    #3 0x7ffb69e79ea7 in bli_sgemm_ex blis/_src/frame/3/bli_l3_tapi.c

Looking at the code the offending section seems to be:

static void bli_obj_set_comp_dt( num_t dt, obj_t* obj )
{
	obj->info = ( objbits_t )
	            ( obj->info & ~BLIS_COMP_DT_BITS ) |
	            ( dt << BLIS_COMP_DT_SHIFT );
}

but I think the actual issues are the defines around things like BLIS_COMP_DT_BITS which is

#define BLIS_COMP_DT_BITS                  ( 0x7  << BLIS_COMP_DT_SHIFT )

e.g. a left shift of 29 to the constant 7 -> which invokes undefined behavior according to clang. What is the intention of this code? To create a big signed wrap around value e.g -536870912?

setup.py should respect CC

If you set CC=/some/custom/toolchain/path/bin/gcc when running setup.py build_ext, setup.py will still invoke the gcc on $PATH if there is one. This is contrary to the normal distutils behavior, which is that setup.py will respect the environment settings.

The problem seems to be get_compiler_name:

cython-blis/setup.py

Lines 140 to 152 in 84c54c9

def get_compiler_name(self):
if "BLIS_COMPILER" in os.environ:
return os.environ["BLIS_COMPILER"]
elif os.environ.get("TRAVIS_OS_NAME") == "linux":
return "gcc-6"
name = self.compiler.compiler_type
print(name)
if name.startswith("msvc"):
return "msvc"
elif name not in ("gcc", "clang", "icc"):
return "gcc"
else:
return name

This function turns most compiler paths into base names that have to be resolved by looking through $PATH.

Can't install blis via pip due to gcc mavx2 flag confusion in bli_amaxv_zen_int.c

Trying to install spacy python package on FreeBSD v12. Fails on dependency install of the blis package which throws "no such instruction" errors regarding AVX2 assembly commands when trying to compile the bli_amaxv_zen_int.c file with '-mavx2' and '-march=core-avx2' compiler flags set. In the attached file, I have included the output from gcc as to what it gets from the CPU, which is accurate, to the best of my knowledge. It's a sandybridge and definitely has AVX2 capabilities.

Is there a way to unset those avx2 flags? Or what is the right solution to this?

The relevant articles I've found refer to this or that software package not being up to date that then affects compilation. All those packages, I've checked on my system and they are all current.

thoughts anyone?

cheers,
~spider

compile_output.txt

support parallel builds with `setup.py build -j10`

When I try to do a parallel build with setup.py build -j10 I still only get one gcc process being run at a time, which means that the build takes a while longer than I would like. It would be great to have support for parallel builds so they take less time.

python core dump on Power8

Hi,

on my ppc64le Power8 machine (POWER8NVL)
when python library thinc == 8.1.2 calls the

cpu_gather_add(saxpy(cblas), <float *>output.data, &table[0, 0], &indices[0, 0]

function python crashes right away,
i've found the problem is actually in the compile flags on Blis library, running:

sed -i -e 's/mcpu=power9/mcpu=native/g' blis/_src/make/linux-power9.jsonl
sed -i -e 's/mtune=power9/mtune=native/g' blis/_src/make/linux-power9.jsonl

fixes the problem for me.
For some reason import blis worked without any problems

allow building using the non-forked version of blis as packaged by Debian

My employer has tasked me with packaging spaCy and gensim for Debian and as part of that I need to package cython-blis for Debian.

Since Debian prefers not to use embedded code copies and prefers to use the primary upstream rather than forks, it would be nice to be able to build cython-blis against the work of @cdluminate, who has packaged @flame's version of blis for Debian.

I propose to have all changes from @honnibal's fork of blis merged into @flame's version, then remove the flame-blis git submodule (which is actually honnibal's fork) from cython-blis, then remove the vendored copy of the flame-blis git submodule, then update the cython-blis build system to build against the installed version of blis and finally probably have the cython-blis CI clone and build the @flame version of blis.

If this isn't acceptable then an option for setup.py to not build the vendored copy of blis and instead link against the already installed version would be a reasonable compromise. For the Debian package of cython-blis I would then remove the vendored copy of blis from the tarball.

I'm happy to work on either of these options as you prefer, but switching cython-blis to always use the flame version of blis would be preferable to me.

Infer architecture using platform.machine()

I wondered if it could be possible to infer the architecture in setup.py by using platform.machine() from the standard library?

The environment variable could remain as an override option.

Example proposed change:

def get_arch_name(self):
    if "BLIS_ARCH" in os.environ:
        return os.environ["BLIS_ARCH"]
    else:
        return platform.machine()

I noticed that platform is imported in setup.py but never used, so I looked at the commit (28cfda4) that added it and found that you used to do something similar:

def get_arch_name(self):
    if 'BLIS_ARCH' in os.environ:
        return os.environ['BLIS_ARCH']
    processor = platform.processor()
    if processor == 'x86_64':
        return 'haswell' # Best guess?
    else:
        return 'reference'

Background: I run a Raspberry Pi package repo at piwheels.org and it was reported that the blis package had failed builds. Looking into it I saw that BLIS_ARCH="generic" is required (not really doable for piwheels' automation). Issue: piwheels/packages#12

Add architecture detection logic to setup.py

The setup.py needs a smarter way to pick non-x86_64 architectures automatically, so that folks don't need to use the BLIS_ARCH environment variable as often. This is currently hard for me to test as I don't have access to machines with alternate architectures, so --- help wanted!

Update README

Today, read me file advises to run ./bin/copy-source-files.sh, but there's no such file in this repository.

Support NumPy 2.0

Hi All ๐Ÿ‘‹

NumPy is planning to release 2.0 on June 16th ( numpy/numpy#24300 (comment) ). NumPy 2.0.0 RC packages for conda & wheels came out at the beginning of April ( numpy/numpy#24300 (comment) )

NumPy has put out a migration guide. More details are in the release notes

If Cython BLIS makes use of NumPy's C API (and produces wheels that use it), having a release of Cython BLIS with wheels built against NumPy 2.0.0 RC would be helpful to ensure NumPy 1 & 2 compatible wheels (as wheels built against NumPy 1 won't be compatible with NumPy 2). More details in this NumPy 2 ABI doc. Note that Cython is compatible with NumPy 2 so it is possible just configuring builds with NumPy 2 is sufficient

Also as NumPy is tracking ecosystem support for NumPy 2.0, it would be helpful to share Cython BLIS current support status in issue (with any plans): numpy/numpy#26191

Mac M1 Chip Support old versions of blis

Hi guys,

I am trying to install spacy 2.2.3 because I use it to teach classes. I upgraded to a new M1 Max Mac, which is supported for newer versions of blis, but I am trying to install 0.4.0 due to spacy requirements. Any suggestions?

Defaulting to user installation because normal site-packages is not writeable
Collecting blis==0.4.0
  Using cached blis-0.4.0.tar.gz (1.8 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.15.0 in ./Library/Python/3.8/lib/python/site-packages (from blis==0.4.0) (1.21.5)
Building wheels for collected packages: blis
  Building wheel for blis (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/setup.py'"'"'; __file__='"'"'/private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-wheel-v9hgnksk
       cwd: /private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/
  Complete output (23 lines):
  BLIS_COMPILER? None
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14-arm64-3.8
  creating build/lib.macosx-10.14-arm64-3.8/blis
  copying blis/benchmark.py -> build/lib.macosx-10.14-arm64-3.8/blis
  copying blis/__init__.py -> build/lib.macosx-10.14-arm64-3.8/blis
  copying blis/about.py -> build/lib.macosx-10.14-arm64-3.8/blis
  creating build/lib.macosx-10.14-arm64-3.8/blis/tests
  copying blis/tests/__init__.py -> build/lib.macosx-10.14-arm64-3.8/blis/tests
  copying blis/tests/test_dotv.py -> build/lib.macosx-10.14-arm64-3.8/blis/tests
  copying blis/tests/test_gemm.py -> build/lib.macosx-10.14-arm64-3.8/blis/tests
  copying blis/tests/common.py -> build/lib.macosx-10.14-arm64-3.8/blis/tests
  copying blis/cy.pyx -> build/lib.macosx-10.14-arm64-3.8/blis
  copying blis/py.pyx -> build/lib.macosx-10.14-arm64-3.8/blis
  copying blis/__init__.pxd -> build/lib.macosx-10.14-arm64-3.8/blis
  copying blis/cy.pxd -> build/lib.macosx-10.14-arm64-3.8/blis
  running build_ext
  unix
  py_compiler gcc
  error: [Errno 2] No such file or directory: '/private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/blis/_src/make/darwin-generic.jsonl'
  ----------------------------------------
  ERROR: Failed building wheel for blis
  Running setup.py clean for blis
Failed to build blis
Installing collected packages: blis
    Running setup.py install for blis ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/setup.py'"'"'; __file__='"'"'/private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-record-msptrtm2/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/erinbuchanan/Library/Python/3.8/include/python3.8/blis
         cwd: /private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/
    Complete output (23 lines):
    BLIS_COMPILER? None
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14-arm64-3.8
    creating build/lib.macosx-10.14-arm64-3.8/blis
    copying blis/benchmark.py -> build/lib.macosx-10.14-arm64-3.8/blis
    copying blis/__init__.py -> build/lib.macosx-10.14-arm64-3.8/blis
    copying blis/about.py -> build/lib.macosx-10.14-arm64-3.8/blis
    creating build/lib.macosx-10.14-arm64-3.8/blis/tests
    copying blis/tests/__init__.py -> build/lib.macosx-10.14-arm64-3.8/blis/tests
    copying blis/tests/test_dotv.py -> build/lib.macosx-10.14-arm64-3.8/blis/tests
    copying blis/tests/test_gemm.py -> build/lib.macosx-10.14-arm64-3.8/blis/tests
    copying blis/tests/common.py -> build/lib.macosx-10.14-arm64-3.8/blis/tests
    copying blis/cy.pyx -> build/lib.macosx-10.14-arm64-3.8/blis
    copying blis/py.pyx -> build/lib.macosx-10.14-arm64-3.8/blis
    copying blis/__init__.pxd -> build/lib.macosx-10.14-arm64-3.8/blis
    copying blis/cy.pxd -> build/lib.macosx-10.14-arm64-3.8/blis
    running build_ext
    unix
    py_compiler gcc
    error: [Errno 2] No such file or directory: '/private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/blis/_src/make/darwin-generic.jsonl'
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/setup.py'"'"'; __file__='"'"'/private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-install-z7uivl4e/blis_3824fe6c68df47c0b5d8286145a0069a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/2k/dx83q1d91gld71_lk76chpdw0000gn/T/pip-record-msptrtm2/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/erinbuchanan/Library/Python/3.8/include/python3.8/blis Check the logs for full command output.

Installation correctness for Aarch64

I successfully ran the following:

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 cortexa57
BLIS_ARCH="cortexa57" python setup.py build_ext --inplace
BLIS_ARCH="cortexa57" python setup.py bdist_wheel

I found a file "blis-0.7.4-cp36-cp36m-linux_aarch64.whl" inside the dist folder of cython-blis, similar to the "blis-0.7.1-cp36-cp36m-linux_aarch64.whl" in

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
The file size is exactly the same as well.
The above comment was from a thread on Aarch64

To install (just blis), I ran "pip3 install blis-0.7.4-cp36-cp36m-linux_aarch64.whl" in that folder and it says:

Processing ./blis-0.7.4-cp36-cp36m-linux_aarch64.whl
Requirement already satisfied: numpy>=1.15.0 in /home/vap-team-admin/Desktop/balefire/balefire/lib/python3.6/site-packages (from blis==0.7.4) (1.19.4)
Installing collected packages: blis
Successfully installed blis-0.7.4

However, when I run "python3", "import blis" and "blis.version", it says: AttributeError: module 'blis' has no attribute 'version'

Looking at "about.py" in the blis installation folder, I see:

__name__ = "blis"
__version__ = "0.7.4"
__summary__ = (
    "The Blis BLAS-like linear algebra library, as a self-contained C-extension."
)
__uri__ = "https://github.com/explosion/cython-blis"
__author__ = "Matthew Honnibal"
__email__ = "[email protected]"
__license__ = "BSD"
__title__ = "blis"
__release__ = True

I did this check and this is what I see:

>>> import blis
>>> dir(blis)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'cy', 'init']

Is this a correct installation? I basically need to install blis in order to install thinc in order to install spacy on Jetson AGX Xavier. I didn't do the pull request step, as I have no idea what that is supposed to do. If I am, could someone explain more clearly what exactly that step does and what I should do? Thanks!

EDIT I think it works. Pls close. Thanks!

error whille building on M2 ARM Mac: expression is not assignable ++Py_REFCNT(o)

I am trying to install / build blis on Mac M2 and running into such an issue:

Compiler gcc
            building 'blis.cy' extension
            creating build/temp.macosx-10.9-x86_64-3.10
            creating build/temp.macosx-10.9-x86_64-3.10/blis
            clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/dlituiev/opt/anaconda3/envs/spacy3/include -fPIC -O2 -isystem /Users/dlituiev/opt/anaconda3/envs/spacy3/include -I/private/var/folders/qz/tt8wl6hn2cs6rw77r5mcmll00000gp/T/pip-install-tqzt5dlh/blis_e4a4e54f5c374774981f6ecff79be5af/include -I/private/var/folders/qz/tt8wl6hn2cs6rw77r5mcmll00000gp/T/pip-install-tqzt5dlh/blis_e4a4e54f5c374774981f6ecff79be5af/blis/_src/include/darwin-x86_64 -I/Users/dlituiev/.virtualenvs/clinspacy/include -I/Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10 -c blis/cy.c -o build/temp.macosx-10.9-x86_64-3.10/blis/cy.o -std=c99
[...]
           executed [-Wunreachable-code]
                  PyErr_SetNone(PyExc_AssertionError);
                  ^~~~~~~~~~~~~
            blis/cy.c:2626:7: warning: code will never be executed [-Wunreachable-code]
                  PyErr_SetNone(PyExc_AssertionError);
                  ^~~~~~~~~~~~~
            blis/cy.c:2642:7: warning: code will never be executed [-Wunreachable-code]
                  PyErr_SetNone(PyExc_AssertionError);
                  ^~~~~~~~~~~~~
            blis/cy.c:2658:7: warning: code will never be executed [-Wunreachable-code]
                  PyErr_SetNone(PyExc_AssertionError);
                  ^~~~~~~~~~~~~
            blis/cy.c:2674:7: warning: code will never be executed [-Wunreachable-code]
                  PyErr_SetNone(PyExc_AssertionError);
                  ^~~~~~~~~~~~~
            blis/cy.c:2690:7: warning: code will never be executed [-Wunreachable-code]
                  PyErr_SetNone(PyExc_AssertionError);
                  ^~~~~~~~~~~~~
            blis/cy.c:2706:7: warning: code will never be executed [-Wunreachable-code]
                  PyErr_SetNone(PyExc_AssertionError);
                  ^~~~~~~~~~~~~
            blis/cy.c:2722:7: warning: code will never be executed [-Wunreachable-code]
                  PyErr_SetNone(PyExc_AssertionError);
                  ^~~~~~~~~~~~~
            blis/cy.c:2738:7: warning: code will never be executed [-Wunreachable-code]
                  PyErr_SetNone(PyExc_AssertionError);
                  ^~~~~~~~~~~~~
            blis/cy.c:5816:3: warning: code will never be executed [-Wunreachable-code]
              goto __pyx_L0;
              ^~~~~~~~~~~~~
            blis/cy.c:5947:3: warning: code will never be executed [-Wunreachable-code]
              goto __pyx_L0;
              ^~~~~~~~~~~~~
            blis/cy.c:20514:5: error: expression is not assignable
                ++Py_REFCNT(o);
                ^ ~~~~~~~~~~~~
            blis/cy.c:20516:5: error: expression is not assignable
                --Py_REFCNT(o);
                ^ ~~~~~~~~~~~~
            blis/cy.c:20809:5: error: expression is not assignable
                ++Py_REFCNT(o);
                ^ ~~~~~~~~~~~~
            blis/cy.c:20811:5: error: expression is not assignable
                --Py_REFCNT(o);
                ^ ~~~~~~~~~~~~
            blis/cy.c:21051:5: error: expression is not assignable
                ++Py_REFCNT(o);
                ^ ~~~~~~~~~~~~
            blis/cy.c:21053:5: error: expression is not assignable
                --Py_REFCNT(o);
                ^ ~~~~~~~~~~~~
[...]

            blis/cy.c:24316:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                                (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                 ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
                  PyUnicode_WSTR_LENGTH(op) :                    \
                  ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
            #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                              ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3)
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24316:22: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                                (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                 ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
                  ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                         ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24316:22: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                                (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                 ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
                   PyUnicode_WSTR_LENGTH(op)))
                   ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
            #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                              ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3)
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24316:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                                (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                               ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
                  PyUnicode_WSTR_LENGTH(op) :                    \
                  ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
            #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                              ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3)
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24316:52: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                                (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                               ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
                  ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                         ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24316:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                                (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                               ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
                   PyUnicode_WSTR_LENGTH(op)))
                   ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
            #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                              ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3)
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24332:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                                    (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                     ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
                  PyUnicode_WSTR_LENGTH(op) :                    \
                  ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
            #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                              ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3)
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24332:26: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                                    (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                     ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
                  ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                         ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24332:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                                    (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                     ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
                   PyUnicode_WSTR_LENGTH(op)))
                   ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
            #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                              ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3)
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24332:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                                    (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                                      ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
                  PyUnicode_WSTR_LENGTH(op) :                    \
                  ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
            #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                              ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3)
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24332:59: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                                    (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                                      ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
                  ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                         ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:24332:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                                    (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                                      ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
                   PyUnicode_WSTR_LENGTH(op)))
                   ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
            #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                              ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3)
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            blis/cy.c:25165:16: warning: 'PyUnicode_FromUnicode' is deprecated [-Wdeprecated-declarations]
                    return PyUnicode_FromUnicode(NULL, 0);
                           ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/cpython/unicodeobject.h:551:1: note: 'PyUnicode_FromUnicode' has been explicitly marked deprecated here
            Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
            ^
            /Users/dlituiev/opt/anaconda3/envs/spacy3/include/python3.10/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
            #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                                 ^
            28 warnings and 6 errors generated.
            error: command '/usr/bin/clang' failed with exit code 1
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: legacy-install-failure
      
      ร— Encountered error while trying to install package.
      โ•ฐโ”€> blis
      
      note: This is an issue with the package mentioned above, not pip.
      hint: See above for output from the failure.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

ร— pip subprocess to install build dependencies did not run successfully.
โ”‚ exit code: 1
โ•ฐโ”€> See above for output.

"environment" appears to be ignored

Going through setup.py the environment key in the .jsonl files is fished up, stored, passed as an argument to successive build_objects calls, which ultimately ignores the argument.

What is the setting for?
Shall we just remove it?

Installing blis - from source - fails on Debian 10

Hi,

I'm trying to upgrade to spacy-2.3.4 on my Debian 10 development machine and I run into this error:

bastb@bastb-vps:/var/tmp/pip-blis$ gcc -c blis/blis/_src/ref_kernels/1/bli_addv_ref.c -o /var/tmp/tmpc2h_9imn/bli_addv_zen2_ref.o -O3 -fomit-frame-pointer -mavx2 -mfpmath=sse -mfma -funsafe-math-optimizations -ffp-contract=fast -march=znver2 -fPIC -std=c99 -fopenmp-simd -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.7.0" -DBLIS_CNAME=zen2 -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/3/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/var/tmp/pip-install-viddvuxz/blis/blis/_src/include/linux-x86_64
cc1: error: bad value (โ€˜znver2โ€™) for โ€˜-march=โ€™ switch
cc1: note: valid arguments to โ€˜-march=โ€™ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server bonnell atom silvermont slm knl knm x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 btver1 btver2 native; did you mean โ€˜znver1โ€™?

The build is selecting blis-0.7.3.tar.gz

Some details concerning the deployment:

bastb@bastb-vps:/var/tmp/pip-blis$ gcc --version
gcc (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bastb@bastb-vps:/var/tmp/pip-blis$ cat /etc/debian_version
10.6

bastb@bastb-vps:/var/tmp/pip-blis$ uname -a
Linux bastb-vps 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1 (2020-01-20) x86_64 GNU/Linux

Any way I can specify -march=znver1 from the command line?

AArch64 architecture support

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.

Facing issue when running following command: pip install --upgrade --no-cache-dir thinc

I am trying to run spacy source code, but ran into "'thinc\backends\cblas.pxd' not found". On debugging more using chatgpt and chrome I got to know that there is issue with thinc module. So I performed this command "pip install --upgrade --no-cache-dir thinc", which is again failing :
" Building wheel for blis (pyproject.toml): started
Building wheel for blis (pyproject.toml): finished with status 'error'"

I have attached the full call stack with this. Please help me on this.

blis.issue.txt

Blis not compiling in OSX 10.14

Have Spacy in my requirements.txt, it needs blis as you know.

Did:

venv/bin/pip install -r requirements.txt

Had this error (TL;DR;):

    error: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.7" but "10.14" during configure

WORKAROUND is to run this before installing requirements

export MACOSX_DEPLOYMENT_TARGET="10.14"

It seems it has to do with this hardcoded value:

cython-blis/setup.py

Lines 5 to 10 in 9e77088

# This is maybe not the best place to put this,
# but we need to tell OSX to build for 10.7.
# Otherwise, wheels don't work. We can't use 10.6,
# it doesn't compile.
if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
os.environ['MACOSX_DEPLOYMENT_TARGET'] = "10.7"

And you even hard-code-fix it in travis:

export MACOSX_DEPLOYMENT_TARGET=10.7

This was the full error

   Compiler gcc
    building 'blis.cy' extension
    creating build/temp.macosx-10.14-x86_64-3.7
    creating build/temp.macosx-10.14-x86_64-3.7/blis
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/private/var/folders/wv/y1qjybgs3kzdfcwnvkxph2n80000gp/T/pip-install-bapdrfq3/blis/include -I/private/var/folders/wv/y1qjybgs3kzdfcwnvkxph2n80000gp/T/pip-install-bapdrfq3/blis/blis/_src/include/darwin-x86_64 -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/Users/cucho/Code/nerd/app/venv/include -I/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c blis/cy.c -o build/temp.macosx-10.14-x86_64-3.7/blis/cy.o -std=c99
    error: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.7" but "10.14" during configure

    ----------------------------------------
Command "/Users/cucho/Code/nerd/app/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/wv/y1qjybgs3kzdfcwnvkxph2n80000gp/T/pip-install-bapdrfq3/blis/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/wv/y1qjybgs3kzdfcwnvkxph2n80000gp/T/pip-record-qdy0d4gi/install-record.txt --single-version-externally-managed --compile --install-headers /Users/cucho/Code/nerd/app/venv/include/site/python3.7/blis" failed with error code 1 in /private/var/folders/wv/y1qjybgs3kzdfcwnvkxph2n80000gp/T/pip-install-bapdrfq3/blis/

This is my requirements.txt

#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --upgrade
#
aniso8601==5.1.0          # via flask-restplus, relativetimebuilder
apispec==1.0.0            # via flask-restplus-marshmallow
blis==0.2.3               # via spacy-nightly, thinc
certifi==2018.11.29       # via requests
chardet==3.0.4            # via requests
click==7.0                # via flask
cymem==2.0.2              # via preshed, spacy-nightly, thinc
flask-marshmallow==0.9.0  # via flask-restplus-marshmallow
flask-mongoengine==0.9.5
flask-restplus-marshmallow==0.2.20
flask-restplus==0.12.1
flask-wtf==0.14.2         # via flask-mongoengine
flask==1.0.2
idna==2.8                 # via requests
itsdangerous==1.1.0       # via flask
jinja2==2.10              # via flask
jsonschema==2.6.0         # via flask-restplus, spacy-nightly
markupsafe==1.1.1         # via jinja2
marshmallow-mongoengine==0.9.1
marshmallow==2.18.1       # via flask-marshmallow, webargs
mongoengine==0.16.3       # via flask-mongoengine, marshmallow-mongoengine
murmurhash==1.0.2         # via spacy-nightly, thinc
numpy==1.16.2             # via blis, spacy-nightly, thinc, thinc-gpu-ops
plac==0.9.6               # via spacy-nightly, thinc
preshed==2.0.1            # via spacy-nightly, thinc
pymongo==3.7.2            # via mongoengine
pytz==2018.9              # via flask-restplus
regex==2018.01.10         # via spacy-nightly
relativetimebuilder==0.2.0  # via aniso8601
requests==2.21.0          # via spacy-nightly
six==1.12.0               # via flask-marshmallow, flask-mongoengine, flask-restplus, mongoengine, thinc
spacy-nightly==2.1.0a6
srsly==0.0.5              # via spacy-nightly, thinc
thinc-gpu-ops==0.0.4      # via thinc
thinc==7.0.0.dev6         # via spacy-nightly
tqdm==4.31.1              # via thinc
urllib3==1.24.1           # via requests
wasabi==0.1.2             # via spacy-nightly, thinc
webargs==5.1.2            # via flask-restplus-marshmallow
werkzeug==0.14.1          # via flask
wrapt==1.10.11            # via thinc
wtforms==2.2.1            # via flask-wtf

Non unit-stride ndarrays

Looking into the code I'm pretty sure the code is buggy for non-unit stride ndarrays such as those resulting from slicing, reverse-slicing or broadcasting:

cython-blis/blis/py.pyx

Lines 64 to 102 in c5df079

def gemm(const_reals2d_ft A, const_reals2d_ft B,
np.ndarray out=None, bint trans1=False, bint trans2=False,
double alpha=1., double beta=1.):
cdef cy.dim_t nM = A.shape[0] if not trans1 else A.shape[1]
cdef cy.dim_t nK = A.shape[1] if not trans1 else A.shape[0]
cdef cy.dim_t nN = B.shape[1] if not trans2 else B.shape[0]
if const_reals2d_ft is const_float2d_t:
if out is None:
out = numpy.zeros((nM, nN), dtype='f')
C = <float*>out.data
with nogil:
cy.gemm(
cy.TRANSPOSE if trans1 else cy.NO_TRANSPOSE,
cy.TRANSPOSE if trans2 else cy.NO_TRANSPOSE,
nM, nN, nK,
alpha,
&A[0,0], A.shape[1], 1,
&B[0,0], B.shape[1], 1,
beta,
C, out.shape[1], 1)
return out
elif const_reals2d_ft is const_double2d_t:
if out is None:
out = numpy.zeros((A.shape[0], B.shape[1]), dtype='d')
C = <double*>out.data
with nogil:
cy.gemm(
cy.TRANSPOSE if trans1 else cy.NO_TRANSPOSE,
cy.TRANSPOSE if trans2 else cy.NO_TRANSPOSE,
A.shape[0], B.shape[1], A.shape[1],
alpha,
&A[0,0], A.shape[1], 1,
&B[0,0], B.shape[1], 1,
beta,
C, out.shape[1], 1)
return out
else:
C = NULL
raise TypeError("Unhandled fused type")

There is no check for row-major inputs but this &A[0,0], A.shape[1], 1 assumes row-major layout.

Instead the code should probably be:

def gemm(const_reals2d_ft A, const_reals2d_ft B,
         np.ndarray out=None, bint trans1=False, bint trans2=False,
         double alpha=1., double beta=1.):
    cdef cy.dim_t nM = A.shape[0] if not trans1 else A.shape[1]
    cdef cy.dim_t nK = A.shape[1] if not trans1 else A.shape[0]
    cdef cy.dim_t nN = B.shape[1] if not trans2 else B.shape[0]
    if const_reals2d_ft is const_float2d_t:
        if out is None:
            out = numpy.zeros((nM, nN), dtype='f')
        C = <float*>out.data
        with nogil:
            cy.gemm(
                cy.TRANSPOSE if trans1 else cy.NO_TRANSPOSE,
                cy.TRANSPOSE if trans2 else cy.NO_TRANSPOSE,
                nM, nN, nK,
                alpha,
                &A[0,0], A.strides[0], A.strides[1],
                &B[0,0], B.strides[0], B.strides[1],
                beta,
                C, out.strides[0], out.strides[1])
        return out
    elif const_reals2d_ft is const_double2d_t:
        if out is None:
            out = numpy.zeros((A.shape[0], B.shape[1]), dtype='d')
        C = <double*>out.data
        with nogil:
            cy.gemm(
                cy.TRANSPOSE if trans1 else cy.NO_TRANSPOSE,
                cy.TRANSPOSE if trans2 else cy.NO_TRANSPOSE,
                A.shape[0], B.shape[1], A.shape[1],
                alpha,
                &A[0,0], A.strides[0], A.strides[1],
                &B[0,0], B.strides[0], B.strides[1],
                beta,
                C, , out.strides[0], out.strides[1])
        return out
    else:
        C = NULL
        raise TypeError("Unhandled fused type")

same thing for gemv.

This has several advantages:

  • works for any strides
  • faster than default OpenBLAS/MKL as there is no conversion to contiguous array needed.

The main draw of the BLIS API is supporting strided arrays without giving up performance, this is the perfect use-case.

Wheel support for linux aarch64 [arm64]

Summary
Installing cython-blis on aarch64 via pip using command "pip3 install cython-blis" tries to build wheel from source code

Problem description
cython-blis doesn't have wheel for aarch64 on PyPI repository. So, while installing cython-blis via pip on aarch64, pip builds wheel for same resulting in it takes more time to install cython-blis. Making wheel available for aarch64 will benefit aarch64 users by minimizing cython-blis installation time.

Expected Output
Pip should be able to download cython-blis wheel from PyPI repository rather than building it from source code.

@cython-blis-team, please let me know if I can help you building wheel/uploading to PyPI repository. I am curious to make cython-blis wheel available for aarch64. It will be a great opportunity for me to work with you.

setup is stuck

I'm with blis setup taking forever and not doing anything, using pip install -v, tried 0.4.0 also

last output:

    #ifndef __STDC_FORMAT_MACROS
    #define __STDC_FORMAT_MACROS 1
    #endif

    EOF
    ### Warning:  Using unoptimized lapack ###
    ### Warning:  Using unoptimized lapack ###
    no previously-included directories found matching 'doc/build'
    no previously-included directories found matching 'doc/source/generated'
    no previously-included directories found matching 'benchmarks/env'
    no previously-included directories found matching 'benchmarks/results'
    no previously-included directories found matching 'benchmarks/html'
    no previously-included directories found matching 'benchmarks/numpy'
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.pyd' found anywhere in distribution
    warning: no previously-included files matching '*.swp' found anywhere in distribution
    warning: no previously-included files matching '*.bak' found anywhere in distribution
    warning: no previously-included files matching '*~' found anywhere in distribution
    warning: no previously-included files found matching 'LICENSES_bundled.txt'

and it just stays like this

UPDATE: realized it's just slow, anyway this can be speeded up like 'make -j4'

Power9 Architecture Support

Hi there!

I'm trying to install this on an IBM Power9 architecture server. I was able to install blis standalone, but I need the json config for BLIS_ARCH=power9 in order to install cython-blis. Can you give me directions on how I could create the jsonl for power9?

Thanks!

Slower SSE kernels used on Zen 3

Zen 3 is not detected by BLIS. Consequently, BLIS falls back to generic kernels that only use SSE intrinstics (not AVX2). See e.g. the following profile of sgemm use on a Ryzen 5900X:

Screen Shot 2021-10-07 at 10 24 07

I don't think we can do anything about this now, since upstream BLIS does not support Zen 3 yet (only the AMD fork).

Just posting this, so that we are aware of the issue.

Benchmark results look incorrect?

% export OMP_NUM_THREADS=1
% python -m blis.benchmark
Setting up data for gemm. 1000 iters,  nO=384 nI=384 batch_size=2000
Blis gemm...
Total: 11032014.6484375
9.54 seconds
Numpy (openblas) gemm...
Total: 11032015.625
9.50 seconds
Blis einsum ab,cb->ca
Total: 5510590.8203125
9.78 seconds
Numpy (openblas) einsum ab,cb->ca
unset OMP_NUM_THREADS
Total: 5510596.19140625
90.67 seconds

numpy with OpenBLAS and blis are on-par for gemm. However, this does not use intermediate optimization on numpy's einsum. Enabling this by passing optimize=True:

% python -m blis.benchmark
Setting up data for gemm. 1000 iters,  nO=384 nI=384 batch_size=2000
Blis gemm...
Total: 11032014.6484375
9.62 seconds
Numpy (openblas) gemm...
Total: 11032015.625
9.51 seconds
Blis einsum ab,cb->ca
Total: 5510590.8203125
9.70 seconds
Numpy (openblas) einsum ab,cb->ca
Total: 5510592.28515625
11.43 seconds

Only slightly slower than blis now. However, I am skeptical of the claim that parallelization does not help in inference. The matrix sizes used in the benchmark are fairly typical in inference (e.g. the standard transformer attention matrices are 768x768). Testing with 4 threads (fairly modest on current multi-core SMT CPUs):

% export OMP_NUM_THREADS=4
% python -m blis.benchmark
Setting up data for gemm. 1000 iters,  nO=384 nI=384 batch_size=2000
Blis gemm...
Total: 11032014.6484375
9.77 seconds
Numpy (openblas) gemm...
Total: 11032015.625
3.40 seconds
Blis einsum ab,cb->ca
Total: 5510590.8203125
9.83 seconds
Numpy (openblas) einsum ab,cb->ca
Total: 5510592.28515625
4.53 seconds

Maybe it's worthwhile compiling blis with multi-threading support?

For reference:

% lscpu | grep name:
Model name:          Intel(R) Xeon(R) Gold 6138 CPU @ 2.00GHz

Update to the latest flame/blis?

I am having performance issues with this library on my AMD Ryzen 3900X CPU and was looking in the code to see if I can find out why this is happening. See this issue for reference: conda-forge/cython-blis-feedstock#18

I have installed this through conda forge:

# conda list | grep blis
cython-blis               0.4.1            py38h1e0a361_1    conda-forge

It looks like cython-blis is using a version of flame/blis from Mar 12, 2019 (https://github.com/honnibal/blis/tree/2c59c46b57cb3517d33b350cc5d18022e1fe93f4)

It appears that since then, some new optimizations are added for AMD in the flame/blis library and they have added support for zen2 (https://github.com/flame/blis/tree/master/config/zen2)

Is it possible to update cython-blis to take advantage of these new optimizations?

Build fails with multi-token CC env. variable

Hi!

It appears that trying to build blis with a CC consisting of multiple tokens, e.g. CC="ccache clang", fails. This is a pretty common way to set the compiler executable AFAIK, I have this exact variable in my profile and rarely encountered problems with other software.

Here is a short proof of concept

#!/bin/bash

cat << END > .cc
#!/bin/bash
eval \$@
END
chmod +x .cc

CC="$(pwd)/.cc clang" pip wheel --no-binary :all: numpy

# Does not work
CC="$(pwd)/.cc clang" pip wheel --no-binary :all: blis

rm .cc

It thought you might want to look into it.

Cheers!

Where are the docs ?

Hi,

I'm trying to replicate the exemple in the readme file, and wrap gemm in my own cython code.
Here is what I came up with for the matrix multiplication c = a @ b:

cimport blis.cy

cpdef Cython_blis(
    double[:,::1] a,
    double[:,::1] b,
    double[:,::1] c
) :

    cdef int p = a.shape[0]
    cdef int q = b.shape[1]
    cdef int r = a.shape[1]

    blis.cy.gemm(blis.cy.NO_TRANSPOSE, blis.cy.NO_TRANSPOSE,
                p, q, r,
                1.0, a, q, 1,
                b, p, 1,
                0.0, c, p, 1
            )

upon build, cython gives me this error:

Error compiling Cython file:                                            
------------------------------------------------------------
...                                 
cdef int p = a.shape[0]
cdef int q = b.shape[1]
cdef int r = a.shape[1]
blis.cy.gemm(blis.cy.NO_TRANSPOSE, blis.cy.NO_TRANSPOSE,                                                                                                                 
                  ^                                                                                                                                              
------------------------------------------------------------   
no suitable method found   

I'm guessing I need to point cython to the correct include files, but I could not find any blis.get_include() or similar function.

Where can I find a minium working exemple of a project using cython-blis to better understand how to include it to my own project ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.