Pressio / pressio-linalg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Temporary README

cwschilly opened this issue · comments

Unit Tests

pressio-linalg

Current installation (subject to change)

This README will change as we finalize the installation process for the repository. For now, we are working on supporting parallel C++ bindings. To install and test, begin by cloning the repository:

git clone https://github.com/Pressio/pressio-linalg.git
cd pressio-linalg

Light Mode

To install in Light mode (Python only), just run

pip install .

from the project directory.

Heavy Mode

For now, "Heavy Mode" just means Python with C++ bindings (e.g. I have not incorporated Trilinos or Pressio yet). To install with these bindings, you need to define two environment variables:

export MPI_BASE_DIR=<path-to-MPI-install>
export MPI4PY_INCLUDE_DIR=<path-to-mpi4py-include-dir>

You can find the include directory of mpi4py by running this Python code, either on the command line or in a script:

import mpi4py
print(mpi4py.get_include())

With this in mind, you can export the necessary environment variables automatically with these commands:

export MPI_BASE_DIR=$(dirname $(dirname $(which mpicxx)))
export MPI4PY_INCLUDE_DIR=$(python -c 'import mpi4py; print(mpi4py.get_include())')

Once these have been set, run

PRESSIO_LINALG_CPP=1 pip install .

to install the package with the C++ bindings.

Testing the Bindings

Once the package has installed, you can test the Python/C++ bindings by running either

python tests/test_bindings.py

or

PRESSIO_LINALG_CPP=1 python tests/test_bindings.py

(depending on how you installed the package; use the environment variable if you installed with C++ bindings).

This file calls public-facing functions and prints the output from either the Python or C++ implementation (depending on how you installed the package). The source of the function is clear in the output--e.g. Using C++ bindings.

The print_comm test asserts that the MPI communicator received by either C++ or Python is the same communicator created in the test (i.e. not a duplicate).

Testing in General

To run the other tests on the code, run

mpirun -n <np> python -m pytest tests/* --with-mpi

where <np> is the number of processors you would like to use.