提交 16de137c authored 作者: Frederic Bastien's avatar Frederic Bastien

updated doc about blas.

上级 f4ec6e7e
...@@ -89,14 +89,20 @@ In csh: ...@@ -89,14 +89,20 @@ In csh:
Troubleshooting: Make sure you have a BLAS library Troubleshooting: Make sure you have a BLAS library
----------------------------------------------------- -----------------------------------------------------
Theano currently depends on having a BLAS library to link against. The Their is many way to configure blas for theano. This is done with the
default is to use the blas installation information in numpy: theano flags blas.ldflags (:ref:`libdoc_config`). The default is to use
``numpy.distutils.__config__.show``, but if numpy is not configured the blas installation information in numpy:
[correctly] for using a fast BLAS, you should tell Theano which BLAS to use ``numpy.distutils.__config__.show``. You can tell theano to use a different
via the THEANO_FLAGS environment variable, or a ``.theanorc`` file. version if you want faster speed in case you didn't compile numpy with a
faster version of blas or if numpy was compiled with a static library of blas
The .theanorc file is the simplest way to set a relatively permanent option as this is not nupported in theano.
like this one. Add a ``[blas]`` section with an ``ldflags``
The short way to configure the theano flags blas.ldflags is by setting the
env variable THEANO_FLAGS to blas.ldflags=XXX
(in bash export THEANO_FLAGS=blas.ldflags=XXX)
The ${HOME}/.theanorc file is the simplest way to set a relatively permanent
option like this one. Add a ``[blas]`` section with an ``ldflags``
entry like this: entry like this:
.. code-block:: text .. code-block:: text
...@@ -108,12 +114,39 @@ entry like this: ...@@ -108,12 +114,39 @@ entry like this:
# other stuff can go here # other stuff can go here
If you prefer to use an environment variable, type something like this: ``export THEANO_FLAGS="blas.ldflags=<gcc linker flags>"``
so maybe ``export THEANO_FLAGS="blas.ldflags=-lf77blas -latlas -lgfortran"`` might work for you.
For more information on the formatting of ~/.theanorc and the configuration options that you can put there, For more information on the formatting of ~/.theanorc and the configuration options that you can put there,
see :ref:`libdoc_config`. see :ref:`libdoc_config`.
Here are some different way to configure it:
0) Do nothing and use the default config. It don't work in the case numpy was
compiled with a static library. ATLAS is compiled by default only as a static lib.
1) The simplest case is too disable the usage of the blas library. In that
case, we call numpy. If numpy is linked with a fast
implementation of blas, it will be faster in theano, but not as fast if
linked directly in theano in some case(for gemm operation). To use numpy,
put the value of blas.ldflags to the empty string
(ex: export THEANO_FLAGS=blas.ldflags=).
2) You can install the default version of blas if the numpy version don't work.
If you have root or sudo access in fedora you can do 'sudo yum install blas blas-devel'.
Under Ubuntu(Debian too?) 'sudo apt-get install libblas-dev'. Then put the
theano flags blas.ldflags=-lblas. Not that the default version of blas is not uptimized.
Using an optimized version that be up to 10x faster in the blas function that we use.
3) Install the ATLAS library. ATLAS is an open source optimized version of BLAS.
You can install precompiled version on most OS, but you can compile it to have
a faster version(I have see speed up of up to 3x, especialy on more recent computer again the precompiled one).
in Fedora 'sudo yum install blas blas-devel'. Under Ubuntu,
'sudo apt-get install libblas-dev. Then use the theano flags
"blas.ldflags=-lblas". Then put the theano flags 'blas.ldflags' to '-lf77blas -latlas -lgfortran'
should do it for you. But the flags value can change for each os.
4) Use a faster version like MKL, GOTO, ... You are on your own to install it. See the
doc of that software and put the theano flags blas.ldflags correctly.
.. note:: .. note::
Make sure your BLAS Make sure your BLAS
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论