installation.rst 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ..
  2. Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at
  3. McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/)
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. Installation
  14. ============
  15. This section describes the necessary steps for installing PyPDEVS.
  16. Dependencies
  17. ------------
  18. The following dependencies are mandatory:
  19. * python 2.7
  20. For parallel and distributed simulation, the following additional dependencies are required:
  21. * MPICH3 with socket device
  22. * mpi4py
  23. Installation instructions are given for these two dependencies further in this section.
  24. Realtime simulation using the Tk backend, obviously requires Tk.
  25. PyPDEVS Installation
  26. --------------------
  27. Execute the following command in the 'src' folder::
  28. python setup.py install --user
  29. Afterwards, PyPDEVS should be installed. This can easily be checked with the command::
  30. python -c "import pypdevs"
  31. If this returns without errors, PyPDEVS is sucessfully installed.
  32. Parallel and distributed simulation with mpi4py
  33. -----------------------------------------------
  34. .. note:: An installation script for mpi4py and MPICH3 is provided in :download:`install_mpi4py.sh <install_mpi4py.sh>`. At the end, you will still need to add mpi to your PATH though, as explained by the script.
  35. First of all, an MPI middleware has to be installed, for which I recommend MPICH3.
  36. Due to some non-standard configuration options, it is required to install MPICH manually instead of using the one from the repositories.
  37. You can use either the official installation guide, or follow the steps below.
  38. Just make sure that the correct configuration options are used.
  39. The following commands should work on most systems, just replace the '/home/you' part with a location of your choosing::
  40. mkdir mpich-build
  41. mkdir mpich
  42. base=`pwd`
  43. cd mpich-build
  44. wget http://www.mpich.org/static/downloads/3.1.2/mpich-3.1.2.tar.gz
  45. tar -xvzf mpich-3.1.2.tar.gz
  46. cd mpich-3.1.2
  47. ./configure --prefix=$base/mpich --with-device=ch3:sock --disable-fortran
  48. make
  49. make install
  50. export PATH=$base/mpich/bin:$PATH
  51. cd ../..
  52. You will probably want to put this final export of PATH to your .bashrc file, to make sure that mpi is found in new terminals too.
  53. After that, make sure that the following command does not cause any errors and simply prints your hostname 4 times::
  54. mpirun -np 4 hostname
  55. Now you just need to install mpi4py, which is easy if you have MPICH installed correctly::
  56. mkdir mpi4py
  57. cd mpi4py
  58. wget https://pypi.python.org/packages/source/m/mpi4py/mpi4py-1.3.1.tar.gz
  59. tar -xvzf mpi4py-1.3.1.tar.gz
  60. cd mpi4py-1.3.1
  61. python setup.py build --mpicc=../../mpich/bin/mpicc
  62. python setup.py install --user
  63. cd ../..
  64. Testing whether or not everything works can be done by making sure that the following command prints '4' four times::
  65. mpirun -np 4 python -c "from mpi4py import MPI; print(MPI.COMM_WORLD.Get_size())"