installation.rst 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 **or** Python 3.6+
  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. Download
  26. --------
  27. The most up-to-date version of PyPDEVS can be obtained from the git repository::
  28. git clone https://msdl.uantwerpen.be/git/yentl/PythonPDEVS.git
  29. Alternatively, the latest release can be downloaded via:
  30. https://msdl.uantwerpen.be/git/yentl/PythonPDEVS/archive/master.zip
  31. PyPDEVS Installation
  32. --------------------
  33. Execute the following command in the 'src' folder::
  34. python setup.py install --user
  35. Afterwards, PyPDEVS should be installed. This can easily be checked with the command::
  36. python -c "import pypdevs"
  37. If this returns without errors, PyPDEVS is sucessfully installed.
  38. Parallel and distributed simulation with mpi4py
  39. -----------------------------------------------
  40. .. 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.
  41. First of all, an MPI middleware has to be installed, for which I recommend MPICH3.
  42. Due to some non-standard configuration options, it is required to install MPICH manually instead of using the one from the repositories.
  43. You can use either the official installation guide, or follow the steps below.
  44. Just make sure that the correct configuration options are used.
  45. The following commands should work on most systems, just replace the '/home/you' part with a location of your choosing::
  46. mkdir mpich-build
  47. mkdir mpich
  48. base=`pwd`
  49. cd mpich-build
  50. wget http://www.mpich.org/static/downloads/3.1.2/mpich-3.1.2.tar.gz
  51. tar -xvzf mpich-3.1.2.tar.gz
  52. cd mpich-3.1.2
  53. ./configure --prefix=$base/mpich --with-device=ch3:sock --disable-fortran
  54. make
  55. make install
  56. export PATH=$base/mpich/bin:$PATH
  57. cd ../..
  58. 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.
  59. After that, make sure that the following command does not cause any errors and simply prints your hostname 4 times::
  60. mpirun -np 4 hostname
  61. Now you just need to install mpi4py, which is easy if you have MPICH installed correctly::
  62. mkdir mpi4py
  63. cd mpi4py
  64. wget https://pypi.python.org/packages/source/m/mpi4py/mpi4py-1.3.1.tar.gz
  65. tar -xvzf mpi4py-1.3.1.tar.gz
  66. cd mpi4py-1.3.1
  67. python setup.py build --mpicc=../../mpich/bin/mpicc
  68. python setup.py install --user
  69. cd ../..
  70. Testing whether or not everything works can be done by making sure that the following command prints '4' four times::
  71. mpirun -np 4 python -c "from mpi4py import MPI; print(MPI.COMM_WORLD.Get_size())"