Skip to content

Instantly share code, notes, and snippets.

View Nicholaswogan's full-sized avatar

Nick Wogan Nicholaswogan

View GitHub Profile
@Nicholaswogan
Nicholaswogan / mojo_radiative_transfer.md
Last active May 26, 2023 23:21
Benchmark of a common radiative transfer algorithm with the Mojo programming language

Radiative transfer with Mojo

Lots of scientific codes need to estimate how light passes through an atmosphere. For example, to quantify the greenhouse effect, climate models need to know how an atmosphere absorbs and scatters sunlight and how efficiently infrared radiation emitted by the atmosphere escapes to space. Also, researchers need models of radiative transfer to interpret telescope observations of atmospheres on planets orbiting distant stars. By simulating what the telescope should see under different atmospheric compositions, a researcher can ultimately back out the composition that best agrees with the telescope observations.

A problem is that many scientific codes are bottlenecked by doing radiative transfer. Lots of computation is required because gases (e.g., H2O) absorb in very complicated ways as a function of the wavelength of light, so many radiative transfer calculations are required to revolve this structure.

I was excited to see initial release of the Mojo programming language, becau

@Nicholaswogan
Nicholaswogan / a_stiff_ode_performance_python_julia.md
Last active May 26, 2023 00:21 — forked from ChrisRackauckas/a_stiff_ode_performance_python_julia.md
SciPy+Numba odeint vs Julia ODE vs NumbaLSODA: 50x performance difference on stiff ODE

SciPy+Numba odeint vs Julia DifferentialEquations.jl vs NumbaLSODA Summary

All are solved at reltol=1e-3, abstol=1e-6 using the fastest ODE solver of the respective package for the given problem.

Absolute Performance Numbers:

  • SciPy LSODA through odeint takes ~489μs
  • SciPy LSODA through odeint with Numba takes ~257μs
  • NumbaLSODA takes ~25μs
  • DifferentialEquations.jl Rosenbrock23 takes ~9.2μs