Skip to content

Conversation

@ParyaRoustaee
Copy link

@ParyaRoustaee ParyaRoustaee commented Apr 19, 2025

Checklist

  • [ x] Appropriate tests were added
  • [ x] Any code changes were done in a way that does not break public API
  • [ x] All documentation related to code changes were updated
  • [x ] The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • [ x] Any new documentation only uses public API

Additional context

This pull request adds a new tutorial to the DiffEqGPU.jl documentation. The new file, gpu_ensemble_random_decay.md, is placed in the docs/src/tutorials/ directory. The tutorial demonstrates how to perform GPU-accelerated ensemble simulations using a simple exponential decay ODE where each trajectory is assigned a random decay rate (λ sampled uniformly from [0.5, 1.5]).

Key points of the tutorial include:

1) Problem Setup:
We define an exponential decay ODE u′(t)=−λu(t) with a fixed initial condition and time span. We then use an EnsembleProblem with a prob_func to randomize λ for each ensemble member.

2) GPU & CPU Comparisons:
The tutorial shows how to run the ensemble on both GPU (using GPUTsit5() with EnsembleGPUKernel(CUDA.CUDABackend())) and CPU (using Tsit5() with EnsembleThreads()). Timing measurements are provided to illustrate the performance differences.

3) Statistical Analysis & Visualization:
It computes the ensemble statistics (mean and standard deviation) for u(t)u(t) over time and produces plots showing the ensemble's mean trajectory with ±1 standard deviation, along with a histogram of final values.

4) Reproducibility and Robustness:
A fixed random seed is set to ensure reproducibility, and the code includes checks to gracefully handle environments without a GPU.

This tutorial is intended to serve as both an educational resource and a practical example of how DiffEqGPU can be used for uncertainty quantification and sensitivity analysis through ensemble simulations.

I have tested the tutorial locally, ensured it builds with the documentation, and updated the tutorial index so that it appears alongside the other examples. Feedback and suggestions are welcome.

Thank you!
Parya

@ChrisRackauckas
Copy link
Member

This won't get built yet since some other docs need updates, but it looks fine to merge this.

@ChrisRackauckas ChrisRackauckas merged commit 8ea3c51 into SciML:master Apr 19, 2025
5 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants