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.
Note: If you want to use the ΦFlow CUDA operations with TensorFlow, you have to build ΦFlow from source instead (see below).
The following command installs the latest stable version of ΦFlow with GUI support using pip.
$ pip install phiflow dash
To install the latest developer version of ΦFlow, run
$ pip install --upgrade git+https://github.com/tum-pbs/PhiFlow@develop
The ΦFlow source additionally contains demo scripts and tests.
In particular, it includes
which tests your configuration.
Clone the git repository by running
$ git clone https://github.com/tum-pbs/PhiFlow.git <target directory>
This will create the folder <target directory> and copy all ΦFlow source files into it.
With this done, you may compile CUDA kernels for better performance, see below.
Finally, ΦFlow needs to be added to the Python path. This can be done in one of multiple ways:
$ pip install <target directory>/. This command needs to be rerun after you make changes to the source code.
The ΦFlow 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>.
If you have installed ΦFlow from source, execute the included
$ python <Φ-Flow directory>/tests/verify.py
Otherwise, run the following Python code.
import phi phi.verify()
If ΦFlow 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.
PyTest is required to run the unit tests. To install it, run
$ pip install pytest.
Some unit tests require TensorFlow and PyTorch. Make sure, both are installed before running the tests.
$ 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.
You can run the additional tests
$ pytest <target directory>/tests/gpu $ pytest <target directory>/tests/release