FHof / torchquad

Multidimensional numerical integration on the GPU using PyTorch
https://www.esa.int/gsp/ACT/open_source/torchquad/
GNU General Public License v3.0
0 stars 0 forks source link

Split NewtonCotes and MonteCarlo integration into three steps #18

Closed FHof closed 2 years ago

FHof commented 2 years ago

To reduce code duplication I added a NewtonCotes class. After the changes it is possible to compile only the first two steps, which could be helpful in situations where the integrand cannot be compiled.

Here are plots when benchmarking with CPU:

Everything uncompiled: plot_MonteCarlo_uncompiled

Tensorflow and JAX first step, third step and integrand separately compiled: plot_MonteCarlo_tf_jax_parts_compiled

Tensorflow and JAX full integrate method compiled: plot_MonteCarlo_compiled_except_torch

Torch and Numpy are uncompiled in all plots. I have not yet tested how much the times would change if only the first and third step and not the integrand are compiled with JAX and Tensorflow.