I have a new Ryzen CPU and ran into this issue. Eg. default anaconda channel uses Intel MKL and this cripples performance on Ryzen systems. If a numpy version using openblas is used, then it's much faster. The above example is in ubuntu but I need to achieve this in windows as well.
To be more specific I actually managed to install numpy with openblas but as soon I try to install anything on top like scikit-learn it will "downgrade" to mkl again.
What I'm looking for is install instructions for a "SciPy stack" python environment on windows using openblas?
EDIT:
This issue seems to be extremely annoying. While there is since not very long a nomkl package also for windows it doesn't seem to take as it always installs mkl version regardless. Even if I install from pip, conda will just overwrite it, with an mkl version again next time you install something, in my case another lib which requires conda.
EDIT2:
As far as I can tell for now the only "solution" is to install anything SciPy related from pypi (pip): numpy, SciPy, pandas, scikit-learn possibly more. eg. only really a solution if you really need anaconda for a specific package, which I do.
EDIT3:
So the MKL_DEBUG_CPU_TYPE=5 trick indeed works. Performance with mkl is restored and a bit better than with openblas.
I did a very basic test (see the link above) with a fixed seed and the result is the same for mkl and openblas.
Related
I would first like to give you some information about how I installed tensorflow and other packages before explaining the problem. It took me a lot of time to get tensorflow running on my GPU (Nvidia RTX 3070, Windows 10 system). First, I installed Cuda (v.10.1), downloaded CuDDN (v7.6) and copied and pasted the CuDNN files to the correct Cuda installation folders (as described here: https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#install-windows)
I want to use tensorflow 2.3.0 and checked if the Cuda and cuDNN versions are compatible using the table on this page: https://www.tensorflow.org/install/source
Then I opened the anaconda prompt window, activated my new environment (>> activate [MyEnv]) and installed the required packages. I read that it is important to install tensorflow first, so the first package I installed was tensorflow-gpu, followed by a bunch of other packages. Later, I ran into the problem that my GPU was not found when I typed in
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
The response was "Num GPUs Available: 0"
I did a lot of googling and found the following discussion:
https://github.com/ContinuumIO/anaconda-issues/issues/12194#issuecomment-751700156
where it is mentioned that a faulty tensorflow build is installed when using conda install tensorflow-gpu in the anaconda prompt window. Instead (when using Pythin 3.8, as I do), one has to use pass the correct tensorflow build in the prompt window. So I set up a new environment and used
conda install tensorflow-gpu=2.3 tensorflow=2.3=mkl_py38h1fcfbd6_0
to install tensorflow. So far so good. Now, the cudatoolkit (version 10.1.243) and cudnn (version 7.6.5), which were missing in my first environment, are inculded in the the tensorflow package and thus in my second environment [MyEnv2].
I start VSCode, select the correct environment, and retest if the gpu can be found by repeating the test:
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
And ...it works. The GPU is found and everything looks good at the first sight.
So what's the problem?
Using tensorflow on gpu is extremly slow. Not only when training models, but also when creating the model with
model = models.Sequential()
model.add(...)
(...)
model.summary()
Running the same code sample on CPU finishes almost immediately, wheras running the code on GPU needs more than 10 minutes! (When I look into the taskmanager performance tab nothing happens. Neither CPU nor GPU seems to do anything, when I run the Code on the GPU!) And this happens, when just creating the model without training!
After compiling the model and starting the training, the same problem occurs. Training on the CPU gives me a immediate feedback about the epoch process, while training on gpu seems to freeze the program as nothing happens for several minutes (maybe "freezing" is the wrong word, because I can still switch between the tabs in VSCode. The program itself is not freezing) Another confusing aspect is that when training on the gpu, I only get nans for the loss and mae when the training finally starts after minutes of waiting. In the task manager I can obeserve that the model needs about 7,5GB of VRAM. The RTX3070 comes with 8GB of VRAM. When I run the same code on the cpu, loss and mae look perfectly fine...
I really have no idea what is happening and why I am getting this strange behaviour when I run tensorflow on my gpu. Do you have any ideas?
Nvidia RTX 3070 cards are based on the Ampere architecture for which compatible CUDA version start with 11.x.
You can upgrade tensorflow from 2.3 to 2.4, because this version supports Ampere architecture.
So to get benefit from your GPU card, the compatible combination are TF 2.4, CUDA 11.0 and cuDNN is 8.0.
A coworker and I have both have macbook pro's with macOS 14.x installed. We are starting a project that is using haskell. We ended up with sharply divergent results in installing the haskell stack. His installation breezed through: my experience was quite different.
After some tribulations it was discovered the root of my issues were essentially that gcc linker were not happy: so it was changed to clang https://stackoverflow.com/a/61032017/1056563. But then - why did the original settings using gcc work for him?
The primary suspect in my mind is a different set of options or installation mechanism for the gcc. Here is how I installed it:
brew install gcc --enable-cxx --enable-fortran --use-llvm
I am uncertain of how he installed but am guessing he used the default
brew install gcc
What then are the differences in behavior - and what gotchas would I run into if I were to uninstall brew and use the defaults. One thing is that one or more of my other packages would become unhappy since the install options used were copied from the package instructions. I just do not happen to remember exactly which one had that stipulation. Some of the packages I have built from source off the top of my head:
scientific python numpy/scikit-learn etc.
deep learning tf, pytorch
opencv
R and a bunch of R libraries
Is there any general guidance on most robust settings? Robust here meaning: will cover the widest swath of build-from-source requirements.
Update My co-worker has determined the following
I just confirmed that on my macbook I have system gcc (not from homebrew), which is a wrapper around clang
looks like installing gcc from homebrew might be contra-indicated in this case
So my question still stands - but this information sheds light on the discrepancies of behavior for haskell stack
i am attempting to install plotly 4.5.1 using the anaconda environment - conda install -c plotly plotly.
However i can see from the terminal that Anaconda attempts to downgrade Spyder back to v 3.3.6. See attached picture:
I would like to carry on using Spyder v4.0.1 but also need plotly. What is the best way to deal with this? I guess different anaconda environments, but then would that mean working in Spyder 3.3.6 to do my plotting?
PS: I also plan to install plotly-dash for dash board development. I suspect that this may also run into the same issue.
Thanks for the help in advance.
(Spyder maintainer here) We're trying to solve this problem with the Anaconda people right now. Hopefully it'll be fixed in the next days. In the meantime, please see this issue for possible solutions.
IPOPT is not thread safe. In anaconda python I can opt out MKL optimizations using conda install nomkl. However, openblas is installed automatically instead. I was wondering, if I might run into problems or wrong results because anaconda still uses threaded versions of some underlying routines ?
Generally A is not thread safe means you should not use A in more than one thread of a single process. It does not mean that A can not use threaded libraries like MKL.
What you are worrying about is not necessary. If you are still not sure, you could run some tests/examples of IPOPT to see what happens.
I am running on Window 7 and I would like to install the Scikit-image package on my Canopy 64-bit. I have looked up the Available-packeges in the package-Manager of Canopy and the scikit-image is included but the only option I have is to click on subscribe. If I click on that the ENTHOUGHT web page pops up offering me to download Canopy-express (the only that is free) but (I guess) I already have that. Is there a way to download only the package that I need?
Thanks in advance
I had the same problem when installing Scikit-image. Canopy is installed but not really helping.
Actually there are installation guides on the page http://scikit-image.org/docs/dev/install.html.
The Build Requirements are:
Python >= 2.6
Numpy >= 1.6
Cython >= 0.19.2
Six >=1.3
And the Runtime requirements are:
SciPy
Matplotlib
NetworkX
Pillow (or PIL)
I had them all installed before I installed scikit-image.
There are maybe other small accessory packages required when you installing above major ones. But there isn't a problem.
Another thing I paid attention to is to ensure the installed scikit-image versions were uninstalled before taking above ones installed 1 by 1. And you may need to exit Python IDLE.
Last, if you are a Windows user, I would recommend downloads from PyPi and http://www.lfd.uci.edu/~gohlke/pythonlibs/.
Good luck.
As you observe, scikit-image is provided pre-built only to subscribers (paid or academic), i.e. not in Canopy Express. If you have Visual Studio 2008 on your system, you can build it yourself, following these general guidelines:
https://support.enthought.com/entries/23389761-Installing-packages-into-Canopy-Python-from-the-command-line
Also, please note the following quirks regarding this package's naming:
https://support.enthought.com/entries/22447950-Scikit-learn-and-Scikit-image-naming-conventions