提交 85b6de00 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Merged

...@@ -145,24 +145,30 @@ Mac ...@@ -145,24 +145,30 @@ Mac
- If the above required libraries are not already installed on your Mac, one option is first, to - If the above required libraries are not already installed on your Mac, one option is first, to
install `MacPorts <http://www.macports.org/>`__. install `MacPorts <http://www.macports.org/>`__.
- Then, in order to install one or more of the required libraries, one way is to use "port install", e.g. as follows: - Then, in order to install one or more of the required libraries, use "port install", e.g. as follows:
.. code-block:: bash .. code-block:: bash
$ sudo port install gcc44 py25-zlib py25-numpy py25-scipy mercurial python_select $ sudo port install gcc44 py25-scipy mercurial python_select
Note that compiling gcc takes a significant time (hours) so it is probably This will install all the required theano dependencies. Note that
not the best solution if you are in a rush! It may happen that SciPy compiling gcc takes significant time (hours)! SciPy depends on ATLAS (a
fails to compile the first time and still compiles just fine on a second good BLAS implementation) and numpy, so these will be installed for you automatically.
try. Same thing with py25-zlib.
- Please note that in order to use the MacPorts version of python, you might - You might have some old versions of gcc, SciPy, numpy, Python installed on
your system, perhaps via XCode. It is a good idea to use **either** the
MacPorts version of everything **or** some other set of compatible versions
(provided by fink, or by XCode). The advantages of MacPorts are the
transparency with which everything can be installed and the fact that
packages are updated quite frequently.
- In order to use the MacPorts version of python, you might
need to explicitly select it with ``sudo python_select python25``. The need to explicitly select it with ``sudo python_select python25``. The
reason this is necessary is because you might have an Apple-provided python reason this is necessary is because you might have an Apple-provided python
(via, for example, an XCode installation). After performing this step, you (via, for example, an XCode installation). After performing this step, you
should check that the symbolic link provided by ``which python`` points to should check that the symbolic link provided by ``which python`` points to
the MacPorts python. For instance, on Snow Leopard with the latest MacPorts, the MacPorts python. For instance, on Snow Leopard with the latest MacPorts,
the output of ``which python`` is ``/opt/local/bin/python`` and the symbolic the output of ``which python`` is ``/opt/local/bin/python`` and this symbolic
link points to ``/opt/local/bin/python2.5``. When executing ``sudo link points to ``/opt/local/bin/python2.5``. When executing ``sudo
python_select python26-apple`` (which you should **not** do), the link python_select python26-apple`` (which you should **not** do), the link
points to ``/usr/bin/python2.6``. points to ``/usr/bin/python2.6``.
...@@ -175,36 +181,49 @@ Mac ...@@ -175,36 +181,49 @@ Mac
is not the case, then you might have some old installation of ``scipy`` in your is not the case, then you might have some old installation of ``scipy`` in your
``PYTHONPATH`` so you should edit ``PYTHONPATH`` accordingly. ``PYTHONPATH`` so you should edit ``PYTHONPATH`` accordingly.
- The same advice applies to ``numpy``. - Please follow the same procedure with ``numpy``.
- Put ``export PYTHONPATH=/opt/local/lib/python2.5/site-packages:$PYTHONPATH`` - Put ``export PYTHONPATH=/opt/local/lib/python2.5/site-packages:$PYTHONPATH``
in your ``.bashrc`` in order to include your MacPorts packages in Python's in your ``.bashrc`` in order to include your MacPorts Python packages
path. (numpy, scipy) in Python's path.
- Make sure that the gcc version that you have installed on your system is - Make sure that the gcc version that you have installed on your system is
up-to-date. If you have an old version of XCode lying around, chances are up-to-date (at the very least 3.4, but 4.x is better). If you have an old
this is the case. You can check with ``which gcc``: if it says version of XCode lying around, chances are that your gcc install is old. You
``/usr/bin/gcc`` then you should install gcc_select from MacPorts (``sudo port install should also check ``which gcc``: if it says ``/usr/bin/gcc`` then you
gcc_select``). Use ``gcc_select -l`` to see which gcc installs you have on should install gcc_select from MacPorts (``sudo port install gcc_select``)
the system. Then execute ``sudo gcc_select mp-gcc44`` to create a symlink and use the MacPorts-provided gcc. Use ``gcc_select -l`` to see which gcc
that points to the correct (MacPorts) gcc (version 4.4 in this case). installs you have on the system. Then execute ``sudo gcc_select mp-gcc44``
to create a symlink that points to the correct (MacPorts) gcc (version 4.4
in this case).
- This is covered in the MacPorts installation process, but make sure that - This is covered in the MacPorts installation process, but make sure that
your ``PATH`` environmental variable contains ``/opt/local/bin`` and your ``PATH`` environmental variable contains ``/opt/local/bin`` and
``/opt/local/sbin`` before any other paths (to make sure that the python and ``/opt/local/sbin`` before any other paths (to ensure that the python and
gcc binaries that you installed with MacPorts are visible first). gcc binaries that you installed with MacPorts are visible first).
- Likewise, you need to - Likewise, you need to
``export LD_LIBRARY_PATH=/opt/local/lib:$LD_LIBRARY_PATH`` if this is not ``export LD_LIBRARY_PATH=/opt/local/lib:$LD_LIBRARY_PATH`` if this is not
the case already (so that we link to the correct libraries). the case already (so that we link to the correct libraries).
- ``scipy`` depends on ATLAS (a BLAS library), which will be installed by MacPorts. - An obscure ``Bus error`` can sometimes be caused when linking
Theano-generated object files against the ``framework`` library in Leopard.
For this reason, we've disabled linking with ``-framework Python``, since on
most configurations this solves the ``Bus error`` problem. If this default
configuration causes problems with your Python/theano installation and you think
that linking with ``-framework Python`` might help, then either set
``THEANO_FLAGS=cmodule.mac_framework_link`` or edit your ``~/.theanorc`` to
contain
.. code-block:: bash
[cmodule]
mac_framework_link=True
These installation instructions have not tested recently, please infom us of your results! Please infom us if you have trouble installing and running Theano on your mac.
We would be especially interested in dependencies that we missed listing, as well as tests We would be especially interested in dependencies that we missed listing, as well as tests
that fail on your platform (use the ``theano-users@googlegroups.com`` mailing list, that fail on your platform (use the ``theano-users@googlegroups.com`` mailing list,
but note that you must first register to it, by going to but note that you must first register to it, by going to `theano-users`_).
`http://groups.google.com/group/theano-users`_).
Windows Windows
......
...@@ -59,7 +59,7 @@ Environment Variables ...@@ -59,7 +59,7 @@ Environment Variables
Here is the .theanorc equivalent to the THEANO_FLAGS in the example above: Here is the .theanorc equivalent to the THEANO_FLAGS in the example above:
.. bode-block:: text .. code-block:: text
[global] [global]
floatX = float32 floatX = float32
......
import sys import sys
import numpy, scipy import numpy
import scipy.sparse import scipy.sparse
from theano import gof from theano import gof
......
...@@ -52,3 +52,7 @@ AddConfigVar('cuda.root', ...@@ -52,3 +52,7 @@ AddConfigVar('cuda.root',
AddConfigVar('gpuelemwise.sync', AddConfigVar('gpuelemwise.sync',
"when true, wait that the gpu fct finished and check it error code.", "when true, wait that the gpu fct finished and check it error code.",
BoolParam(True)) BoolParam(True))
AddConfigVar('cmodule.mac_framework_link',
"If set to true, breaks certain mac installations with the infamous Bus Error",
BoolParam(False))
...@@ -625,8 +625,11 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[] ...@@ -625,8 +625,11 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[]
#DSE Patch 1 for supporting OSX frameworks; add -framework Python #DSE Patch 1 for supporting OSX frameworks; add -framework Python
if sys.platform=='darwin' : if sys.platform=='darwin' :
preargs.extend(['-undefined','dynamic_lookup']) preargs.extend(['-undefined','dynamic_lookup'])
#if python_inc.count('Python.framework')>0 : # link with the framework library *if specifically requested*
# preargs.extend(['-framework','Python']) # config.mac_framework_link is by default False, since on some mac
# installs linking with -framework causes a Bus Error
if python_inc.count('Python.framework')>0 and config.cmodule.mac_framework_link:
preargs.extend(['-framework','Python'])
workdir = location workdir = location
......
import sys,scipy
from basic import * enable_sparse=True
if not scipy.__version__.startswith('0.7.'):
sys.stderr.write("WARNING: scipy version = %s. We request version >=0.7.0 for the sparse code as it has bugs fixed in the sparse matrix code.\n" % scipy.__version__)
enable_sparse=False
if enable_sparse:
from basic import *
...@@ -29,10 +29,6 @@ _mtypes = [sparse.csc_matrix, sparse.csr_matrix] ...@@ -29,10 +29,6 @@ _mtypes = [sparse.csc_matrix, sparse.csr_matrix]
#* new class ``bsr_matrix`` : the Block CSR format #* new class ``bsr_matrix`` : the Block CSR format
_mtype_to_str = {sparse.csc_matrix: "csc", sparse.csr_matrix: "csr"} _mtype_to_str = {sparse.csc_matrix: "csc", sparse.csr_matrix: "csr"}
import scipy
if not scipy.__version__.startswith('0.7.'):
sys.stderr.write("WARNING: scipy version = %s. We prefer version >=0.7.0 because it has bugs fixed in the sparse matrix code.\n" % scipy.__version__)
def _is_sparse_variable(x): def _is_sparse_variable(x):
""" """
@rtype: boolean @rtype: boolean
......
import scipy.sparse import scipy.sparse
from theano.sparse import * from theano.sparse import *
from nose.plugins.skip import SkipTest
if enable_sparse == False:
raise SkipTest('Optional package sparse disabled')
import random import random
import unittest import unittest
import theano import theano
......
import unittest import unittest
import numpy import numpy
import theano.tensor as T import theano.tensor as T
from ..configparser import config, AddConfigVar, IntParam from theano.configparser import config, AddConfigVar, IntParam
import os, sys import os, sys
AddConfigVar('unittests.rseed', AddConfigVar('unittests.rseed',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论