Skip to content

Commit

Permalink
add mpi4py to pyproject.toml to ensure access to parallel tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stoiveroberts committed May 16, 2022
1 parent 7e03141 commit 968d057
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 10 deletions.
9 changes: 2 additions & 7 deletions anuga/parallel/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@ def configuration(parent_package='',top_path=None):

config = Configuration('parallel', parent_package, top_path)

try:
import mpi4py
except:
pass
else:
config.add_data_dir('tests')
config.add_data_dir('data')
config.add_data_dir('tests')
config.add_data_dir('data')

return config

Expand Down
3 changes: 2 additions & 1 deletion anuga/parallel/tests/test_parallel_distribute_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import os
import subprocess

verbose = True
verbose = False

path = os.path.dirname(__file__) # Get folder where this script lives
run_filename = os.path.join(path, 'run_parallel_distribute_mesh.py')
Expand All @@ -31,6 +31,7 @@ def setUp(self):
extra_options = '--oversubscribe'
cmd = 'mpiexec -np 3 ' + extra_options + ' echo '

# See if we get an error with --oversubscribe option
result = subprocess.run(cmd.split(), capture_output=True)
if result.returncode != 0:
extra_options = ' '
Expand Down
44 changes: 44 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,50 @@ via the command:
You might even like to set this up in your `.bashrc` file.
Installing on Ubuntu using apt and pip
--------------------------------------
ANUGA can be installed using `pip`, but a complication arrise when installing
the `gdal` package.
First set up a python virtual environment and activate via:
.. code-block:: bash
python3 -m venv anuga_env
course anuga_env/bin/activate
Now we first need to install the `gdal` python package. First install the
gdal library, via:
.. code-block:: bash
sudo apt-get install -y gdal-bin libgdal-dev
We need to ascertain the version of `gdal` installed using the following command:
.. code-block:: bash
ogrinfo --version
THe version of `gdal` to install via `pip` should match the version of the library.
For instance on Ubuntu 20.04 the previous command produces:
.. code-block:: bash
GDAL 3.0.4, released 2020/01/28
So in this case we install the `gdal` python package as follows
.. code-block:: bash
pip install gdal==3.0.4
Now we complete the installation of `anuga` simply by:
.. code-block:: bash
pip install anuga
Installing on Ubuntu using apt and pip
---------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "future", "Cython", "wheel", "numpy", "gitpython"]
requires = ["setuptools", "future", "Cython", "wheel", "numpy", "gitpython", "mpi4py"]
build-backend = "setuptools.build_meta"


Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ numpy
scipy
matplotlib
nose
pytest
cython
netcdf4
dill
future
gitpython
pyproj
pymetis
triangle
meshpy
Pmw
pytz
nbsphinx

0 comments on commit 968d057

Please sign in to comment.