PhiML

ΦML Installation

Requirements

For GPU acceleration, deep learning and optimization, either PyTorch, TensorFlow 2.x or Jax must be registered with your Python installation. Note that these also require a CUDA installation with cuDNN libraries for GPU execution. We recommend CUDA 11.0 with cuDNN 8.

Installing ΦML using pip

Note: If you want to use the ΦML CUDA operations with TensorFlow, you have to build ΦML from source instead (see below).

The following command installs the latest stable version of ΦML with GUI support using pip.

$ pip install phiml

To install the latest developer version of ΦML, run

$ pip install --upgrade git+https://github.com/tum-pbs/PhiML@develop

Install PyTorch, TensorFlow or Jax in addition to ΦML to enable machine learning capabilities and GPU execution.

Installing ΦML from Source

The ΦML source additionally contains demo scripts and tests. In particular, it includes tests/verify.py, which tests your configuration.

Clone the git repository by running

$ git clone https://github.com/tum-pbs/PhiML.git <target directory>

This will create the folder <target directory> and copy all ΦML source files into it.

With this done, you may compile CUDA kernels for better performance, see below.

Finally, ΦML needs to be added to the Python path. This can be done in one of multiple ways:

Compiling the CUDA Kernels for TensorFlow

The ΦML source includes several custom CUDA kernels to speed up certain operations when using TensorFlow. To use these, you must have a TensorFlow compatible CUDA SDK with cuDNN as well as a compatible C++ compiler installed. We strongly recommend using Linux with GCC 7.3.1 (apt-get install gcc-4.8) for this. See the tested TensorFlow build configurations.

To compile the CUDA kernels for TensorFlow, clone the repository as described above, then run $ python <target directory>/setup.py tf_cuda. This will add the compiled CUDA binaries to the <target directory>.

Verifying the installation

If you have installed ΦML from source, execute the included verify.py script.

$ python <Φ<sub>ML</sub> directory>/tests/verify.py

Otherwise, run the following Python code.

import phiml; phiml.verify()

Or from the command line:

$ python3 -c "import phiml; phiml.verify()"

If ΦML and dependencies are installed correctly, you should see the text Installation verified., followed by additional information on the components at the end of the console output.

Unit tests

PyTest is required to run the unit tests. To install it, run $ pip install pytest.

Most unit tests require TensorFlow, PyTorch and Jax. Make sure, all are installed before running the tests.

Execute $ pytest <target directory>/tests/commit to run the normal tests. The result of this should match the automated tests run by Travis CI which are linked on the main GitHub page.