Welcome to φtorch’s documentation!

phytorch (stylised as φtorch) is a Python package that provides physics-related utilities to the PyTorch ecosystem.

Installation instructions

φtorch consists of Python modules and a PyTorch extension written in C++/CUDA. Therefore, installation has two steps, but should otherwise be fully automatic.

  1. First, clone (or download) the source code, then cd into the root directory and run

    pip install -e .
    

    This will automatically install the few dependencies and the pure-Python code (in developer mode, so that it runs out of the current directory instead of site-packages). If you are not interested in special functions and differentiable cosmographic distances, you’re good to go!

    Note

    In that case, you can also now install the pure-Python components from PyPI using

    pip install phytorch
    
  2. Then, to compile the extensions,

    cd phytorch-extensions
    python setup.py build_ext
    

    Warning

    Building the extensions currently requires you to have a CUDA compiler, which, I realise, sucks. I’m working on making a cpu-only version possible.

    Finally, the extensions, which have now been built in a folder like phytorch-extensions/build/lib*, need to be linked to phytorch/extensions:

    cd ../phytorch/extensions
    ln -s ../../phytorch-extensions/build/lib*/* .
    

    Todo

    Automate installation of the extensions.

Contents

Indices and tables