pymc-devs / pymc-devs/pytensor

pytensor >= 2.17.4 doesn't detect system blas

Open
#524 22 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Describe the issue:

As the title says pytensor >=2.17.4 doesn't detect system blas

Reproducable code example:

for pytensor >= 2.17.4

python -c "import pytensor; print(pytensor.config.blas__ldflags)"
WARNING (pytensor.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

pytensor 2.16.3 finds the default blas correctly

python -c "import pytensor; print(pytensor.config.blas__ldflags)"
-L/opt/intel/oneapi/mkl/latest/lib/intel64 -lmkl_rt -lpthread -lm -lm

PyTensor version information:

pytensor >= 2.17.4

Context for the issue:

pytensor is installed as a dependency for pymc

OS is Ubuntu 22.04, default blas is mkl, set by update-alternatives. python 3.10.9, numpy 1.23.5. Python is compiled from source and invoked by sourcing a script that sets the environmental variables :

export PREFIX=/home/beew/opt/python310

export HOME=$PREFIX #for spyder to create seperate config than system

export PYTHONHOME=$PREFIX

export MKL_THREADING_LAYER=GNU #required by pymc

export PATH=$PYTHONHOME/bin:$PATH

export LD_LIBRARY_PATH=$PYTHONHOME/lib:$PYTHONHOME/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH

export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH

export PYTHONUSERBASE=$PYTHONHOME

export PYTHONPATH=$PYTHONHOME/lib/python3.10/site-packages

some of these might not be necessary but it works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Python command that prints pytensor.config.blas__ldflags with PyTensor 2.17.4 or newer, then compare it with 2.16.3 under the reported Ubuntu and MKL environment. Done means the newer version detects the system BLAS and no longer emits the NumPy C-API fallback warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.