VegasFlow: accelerating Monte Carlo simulation across multiple hardware platforms

VegasFlow is a Monte Carlo integration library written in Python and based on the TensorFlow framework. It is developed with a focus on speed and efficiency, enabling researchers to perform very expensive calculation as quick and easy as possible.

Some of the key features of VegasFlow are:

  • Integrates efficiently high dimensional functions on single (multi-threading) and multi CPU, single and multi GPU, many GPUs or clusters.

  • Compatible with Python, C, C++ or Fortran.

  • Implementation of different Monte Carlo algorithms.

How to obtain the code

Open Source

The vegasflow package is open source and available at


The package can be installed with pip:

python3 -m pip install vegasflow

If you prefer a manual installation just use:

git clone
cd vegasflow
python3 install

or if you are planning to extend or develop code just use:

python3 develop

It is also possible to install the package from repositories such as conda-forge or the Arch User Repository

conda install vegasflow -c conda-forge
yay -S python-vegasflow


VegasFlow is developed within the Particle Physics group of the University of Milan. Theoretical calculations in particle physics are incredibly time consuming operations, sometimes taking months in big clusters all around the world.

These expensive calculations are driven by the high dimensional phase space that need to be integrated but also by a lack of expertise in new techniques on high performance computation. Indeed, while at the theoretical level these are some of the most complicated calculations performed by mankind; at the technical level most of these calculations are performed using very dated code and methodologies that are unable to make us of the available resources.

With VegasFlow we aim to fill this gap between theoretical calculations and technical performance by providing a framework which can automatically make the best of the machine in which it runs. To that end VegasFlow is based on two technologies that together will enable a new age of research.

How to cite vegaflow?

When using vegasflow in your research, please cite the following publications:


    author = "Carrazza, Stefano and Cruz-Martinez, Juan M.",
    title = "{VegasFlow: accelerating Monte Carlo simulation across multiple hardware platforms}",
    eprint = "2002.12921",
    archivePrefix = "arXiv",
    primaryClass = "physics.comp-ph",
    reportNumber = "TIF-UNIMI-2020-8",
    doi = "10.1016/j.cpc.2020.107376",
    journal = "Comput. Phys. Commun.",
    volume = "254",
    pages = "107376",
    year = "2020"

    author       = {Juan Cruz-Martinez and
                    Stefano Carrazza},
    title        = {N3PDF/vegasflow: vegasflow v1.0},
    month        = feb,
    year         = 2020,
    publisher    = {Zenodo},
    version      = {v1.0},
    doi          = {10.5281/zenodo.3691926},
    url          = {}


Why the name VegasFlow?

It is a combination of the names Vegas and Tensorflow.

  • Vegas: this integration algorithm, created originally by G.P. Lepage

sits at the core of many of the most advanced calculations in High Energy Physics, it powers Madgraph <>_, MCFM or Sherpa among others. Lepage’s own implementation is available in github.

  • TensorFlow: the tensorflow is developed by Google and was made public in November of 2015.

It is a perfect combination between performance and usability. With a focus on Deep Learning, TensorFlow provides an algebra library able to easily run operations in many different devices: CPUs, GPUs, TPUs with little input by the developer.

I have a problem I can’t solve

Please, open an issue in the github repository or check whether someone has already asked the same question. We will be happy to help.

Indices and tables