# "NumPy C-API based implementation for BLAS functions" Is it a problem?

**URL:** <https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690>\
**Category:** Questions\
**Tags:** theano\
**Created:** [January 31, 2022, 1:02pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690 "2022-01-31T13:02:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhrcook](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jhrcook/32/3255_2.png) [@jhrcook](https://discourse.pymc.io/u/jhrcook)\
**Post date:** [January 31, 2022, 1:02pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/1 "2022-01-31T13:02:16Z")

</div>

I know this is an issue that has been asked about a few times, but I wasn’t able to find a conclusive answer to whether the Theano warning below is something to be concerned about.

```auto
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

```

I work on a Linux server and locally on a Mac and use a conda virtual environment in both, but only get this warning on the Linux server. Sometimes the Linux server is slower, but this could also be due to slower hardware than on my Mac. I am trying to fit a hierarchical model with many parameters and a lot of data on the Linux server, so I want to try to have it running as efficiently as possible.

My main questions are

**1. Should I be concerned about this warning?**  
**2. If I can address it, would PyMC3 NUTS sample faster?**

---

<div class="post-metadata">

**Author:** ![cluhmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cluhmann/32/3083_2.png) [@cluhmann](https://discourse.pymc.io/u/cluhmann)\
**Post date:** [January 31, 2022, 3:34pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/2 "2022-01-31T15:34:08Z")

</div>

How did you install pymc and theano? Did you follow the instructions found [here](https://github.com/pymc-devs/pymc/wiki/Installation-Guide-(Linux))?

---

<div class="post-metadata">

**Author:** ![jhrcook](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jhrcook/32/3255_2.png) [@jhrcook](https://discourse.pymc.io/u/jhrcook)\
**Post date:** [January 31, 2022, 3:38pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/3 "2022-01-31T15:38:38Z")

</div>

Yes, below are the versions installed by conda.

```auto
# Name Version Build Channel
pymc3 3.11.4 py39ha563b64_1 conda-forge
theano-pymc 1.1.2 py39he80948d_0 conda-forge
mkl 2021.4.0 h8d4b97c_729 conda-forge
mkl-service 2.4.0 py39h7e14d7c_0 conda-forge

```

---

<div class="post-metadata">

**Author:** ![cluhmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cluhmann/32/3083_2.png) [@cluhmann](https://discourse.pymc.io/u/cluhmann)\
**Post date:** [January 31, 2022, 3:48pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/4 "2022-01-31T15:48:32Z")

</div>

Do you have gcc installed and, if so, what version?

---

<div class="post-metadata">

**Author:** ![jhrcook](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jhrcook/32/3255_2.png) [@jhrcook](https://discourse.pymc.io/u/jhrcook)\
**Post date:** [January 31, 2022, 4:25pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/5 "2022-01-31T16:25:12Z")

</div>

Yes, I believe it was installed by conda in the virtual environment. If I run `conda list gcc`, I get the following output:

```auto
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
gcc 9.4.0 h192d537_4 conda-forge
gcc_impl_linux-64 9.4.0 h03d3576_11 conda-forge
gcc_linux-64 9.4.0 h391b98a_4 conda-forge
libgcc-devel_linux-64 9.4.0 hd854feb_11 conda-forge
libgcc-ng 11.2.0 h1d223b6_11 conda-forge

```

Also, thank you for taking your time to think about this problem.

---

<div class="post-metadata">

**Author:** ![jhrcook](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jhrcook/32/3255_2.png) [@jhrcook](https://discourse.pymc.io/u/jhrcook)\
**Post date:** [January 31, 2022, 4:31pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/6 "2022-01-31T16:31:31Z")

</div>

Also, on a related note (I think), below are the “blas” libraries installed in the virtual environment:

```auto
# Name Version Build Channel
libblas 3.9.0 12_linux64_openblas conda-forge
libcblas 3.9.0 12_linux64_openblas conda-forge
libopenblas 0.3.18 pthreads_h8fe5266_0 conda-forge

```

---

<div class="post-metadata">

**Author:** ![cluhmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cluhmann/32/3083_2.png) [@cluhmann](https://discourse.pymc.io/u/cluhmann)\
**Post date:** [January 31, 2022, 5:18pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/7 "2022-01-31T17:18:25Z")

</div>

Strange! Usually this is a windows problem. The only thing I can think of is that there is an environment variable somewhere that isn’t set quite right. @almostmeenal @ricardoV94 any clues?

---

<div class="post-metadata">

**Author:** ![jhrcook](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jhrcook/32/3255_2.png) [@jhrcook](https://discourse.pymc.io/u/jhrcook)\
**Post date:** [January 31, 2022, 7:08pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/8 "2022-01-31T19:08:33Z")

</div>

The server has `gcc` and `openblas` installed already, too, but they are different versions. Do you think there could be something strange happening because of those? Are there any diagnostics I can run to help figure this out?

---

<div class="post-metadata">

**Author:** ![cluhmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cluhmann/32/3083_2.png) [@cluhmann](https://discourse.pymc.io/u/cluhmann)\
**Post date:** [January 31, 2022, 7:18pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/9 "2022-01-31T19:18:46Z")

</div>

That could definitely be part of it. Which gcc does your $PATH pick up on?

---

<div class="post-metadata">

**Author:** ![jhrcook](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jhrcook/32/3255_2.png) [@jhrcook](https://discourse.pymc.io/u/jhrcook)\
**Post date:** [January 31, 2022, 8:47pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/10 "2022-01-31T20:47:33Z")

</div>

That was the problem!

My `PATH` had, the following:

```auto
/n/app/conda2/bin
/home/jc604/.conda/envs/speclet/bin
/n/app/conda2/bin
...
/n/app/openblas/0.2.19/include
...
/n/app/gcc/6.2.0/bin
...
/n/app/conda2/condabin

```

Removing the other `gcc` from my `PATH` caused the warning to go away. I will update this post with whether or not that caused a substantial difference to the rate of sampling from the larger model.

Thank you @cluhmann for your help and patience. It is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![jhrcook](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jhrcook/32/3255_2.png) [@jhrcook](https://discourse.pymc.io/u/jhrcook)\
**Post date:** [February 14, 2022, 4:00pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/11 "2022-02-14T16:00:55Z")

</div>

I just posted the results from my experiment with running PyMC3 MCMC with and without the Theano BLAS warning. I didn’t find much of a difference. I’m curious to know what people with a better understanding of PyMC3 and Theano expected and if this is surprising or not.

> **[PyMC3 MCMC performance with and without Theano's NumPy BLAS warning | Joshua...](https://joshuacook.netlify.app/post/theano-blas-warning/)**
>
> Does the warning 'Using NumPy C-API based implementation for BLAS functions' from Theano when using PyMC3 affect the performance of MCMC?

---

<div class="post-metadata">

**Author:** ![jhrcook](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jhrcook/32/3255_2.png) [@jhrcook](https://discourse.pymc.io/u/jhrcook)\
**Post date:** [February 15, 2022, 8:00pm UTC](https://discourse.pymc.io/t/numpy-c-api-based-implementation-for-blas-functions-is-it-a-problem/8690/12 "2022-02-15T20:00:33Z")

</div>

@twiecki I saw your comment on Twitter, and trying to update to v4 is on my to-do list. If I can get it working on the cluster, then I’ll update this post with a comparison.
