You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MKL FATAL ERROR on Google Colab with mkl==2019.0 #730
When using control version 0.9.1 on Google Colab and mkl version is 2019.0 the session crashes when running ts2ss() with the following runtime log:
Steps to recreate: !pip install control !pip install slycot (likely not related) !pip show mkl (verify mkl version, my sessions have all been 2019.0 so far)
import control as ct
ct.tf2ss(ct.tf([1],[1,1]))
Session crashes with previous error in runtime logs.
The fix I have found is to update the mkl version to 2021.4.0. I am not familiar enough with the version changes nor have I tried other mkl versions, so I cannot say what other versions work. !pip install mkl==2021.4.0
Probably should add a requirement on mkl version when installing control in Colab.
I have not tried to reproduce this on a local Jupyter notebook.
python-control does not call any BLAS/LAPACK library routine directly. We don't have and won't add any requirement on MKL, OpenBLAS or any other implemetation of BLAS/LAPACK directly to python-control.
This is most likely an issue with the MKL/NumPy/Slycot combination of your instance in Google Colab. And as you have found out, it seems to be fixed by updating to a more recent version. I am not familiar with the innards of Colab, but it seems that !pip install slycotis the culprit here. On a regular Python environment this would download the source and compile the Fortran routines with the headers present on the system.
I saw your comments here and decided to get in touch. I am also trying to run a very simple code on Google Colab using the Control + slycot library, but the Kernel restarts (crashes).
Activity
bnavigator commentedon May 2, 2022
Hi,
python-control does not call any BLAS/LAPACK library routine directly. We don't have and won't add any requirement on MKL, OpenBLAS or any other implemetation of BLAS/LAPACK directly to python-control.
This is most likely an issue with the MKL/NumPy/Slycot combination of your instance in Google Colab. And as you have found out, it seems to be fixed by updating to a more recent version. I am not familiar with the innards of Colab, but it seems that
!pip install slycotis the culprit here. On a regular Python environment this would download the source and compile the Fortran routines with the headers present on the system.bnavigator commentedon May 2, 2022
BTW, numpy on Colab says, that is not using MKL at all:
If you compile Slycot with
-DBLA_VENDOR=Generic, then you won't have to update MKL:Now you have to figure out how to get Colab to render LaTeX output like a real Jupyter Notebook or ignore it and use the regular
__repr__()Spogis commentedon Feb 1, 2024
Hi @bnavigator / Ben!
I saw your comments here and decided to get in touch. I am also trying to run a very simple code on Google Colab using the Control + slycot library, but the Kernel restarts (crashes).
Were you able to solve the problem?
Best regards,
Nicolas Spogis
Colab Errors:
WARNING:root:kernel f5072b3f-42c0-4442-bb37-dd67744b63be restarted
KernelRestarter: restarting kernel (1/5), keep random ports
Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.
INTEL MKL ERROR: /lib/x86_64-linux-gnu/libmkl_avx2.so: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8.
Code on Google Colab:
!apt-get install gfortran cmake --fix-missing
!apt-get install libblas-dev liblapack-dev
import os
os.environ['BLA_VENDOR']="Generic"
!echo Using $$BLA_VENDOR BLAS implementation
!pip install -v slycot
!pip install control
import control
import slycot
import matplotlib.pyplot as plt
Define transfer function of the system
s = control.tf('s')
K1 = 5.0
T1 = 5.0
P1 = K1/(T1*s+1)
K2 = 10.0
T2 = 20.0
P2 = K2/(T2*s+1)
K3 = 5.0
T3 = 5.0
P3 = K3/(T3*s+1)
K4 = 5.0
T4 = 5.0
P4 = K4/(T4*s+1)
G = control.append(P1, P2, P3, P4) #Google Colab Crash HERE!
bnavigator commentedon Feb 1, 2024
Check python-control/Slycot#183 (comment)
Spogis commentedon Feb 1, 2024
Now not crash, but i have this error:
This is my Google Colab: https://colab.research.google.com/drive/1hb9XDIVeMirQ2gevnaU282yFTs4-KS_t?usp=sharing
bnavigator commentedon Feb 2, 2024
I'm already getting a numpy error while importing control when running your colab.
bnavigator commentedon Feb 2, 2024
My own colab notebook still works, including your code:
https://colab.research.google.com/drive/1kKaK3jI_omOTrLCLQGzSs1uTowN5Cx_v?usp=sharing
Spogis commentedon Feb 2, 2024
Hi @bnavigator / Ben!
Thank you very very very much!
You help me a lot.
As "The Cure" said! It's Friday, I'm in love!
Best regards,
Nicolas