Skip to content

Performance vs Echoes ​

Before this page

Performance notes, for the paths timed below, and Cross-validation against Echoes, for the accuracy of the same runs.

Every number on this page is read from a JSON file written by a script of the repository, and can be measured again by anyone with the commands of the last section. Both codes run on the same machine, one thread each, timed by BenchmarkTools' @belapsed (the minimum of the samples); Echoes is called through its Python API, from Python modules that also run on their own.   means that MeanFieldHomogenization is faster; a ratio below 1 is in bold. The gap is the largest relative difference between the two results, so that each ratio compares two computations of the same number.

Kernels ​

Measured on AMD EPYC-Milan Processor, Julia 1.13.3, MeanFieldHomogenization 0.23.1, TensND 0.8.5, 2 thread; BenchmarkTools @belapsed minimum of 20 samples, one thread each; Echoes through PythonCall.

Hill tensor ​

The Julia back-end is the default one unless the case names another.

CaseEchoesgap
Sphere a=b=c=1 / ISOanalytical13.8 ns72 ms5200000×6.6e-10
Prolate a=5,b=c=1 / ISOanalytical85.7 ns108 ms1300000×5.3e-10
Oblate a=b=5,c=1 / ISOanalytical73.3 ns67.1 ms920000×3.6e-10
Prolate a=3,b=c=1 / cubicNUMINT3D1.17 ms98.3 ms84.1×9.8e-09
Prolate a=3,b=c=1 / cubic (Julia :decuhr)NUMINT3D1.17 ms98.3 ms84.3×6.0e-06
Prolate a=3,b=c=1 / cubic (Julia :nestedquadgk)NUMINT3D224 µs98 ms440×1.6e-09
Triaxial a=2,b=1,c=0.5 / triclinicRESIDUES3.67 ms4.98 ms1.36×1.1e-07
Triaxial a=2,b=1,c=0.5 / triclinicNUMINT3D3.67 ms89.8 ms24.5×2.5e-09
Triaxial a=2,b=1,c=0.5 / triclinic (Julia :decuhr)RESIDUES4.39 ms4.98 ms1.13×1.1e-07
Triaxial a=2,b=1,c=0.5 / triclinic (Julia :decuhr)NUMINT3D4.39 ms89.6 ms20.4×2.5e-09
Triaxial a=2,b=1,c=0.5 / triclinic (Julia :nestedquadgk)RESIDUES906 µs4.97 ms5.49×1.1e-07
Triaxial a=2,b=1,c=0.5 / triclinic (Julia :nestedquadgk)NUMINT3D906 µs89.5 ms98.8×2.5e-09
Rotated prolate a=5,b=c=1 / ISO (pi/4,pi/6,pi/3)analytical91.5 ns108 ms1200000×3.0e-10
Rotated triaxial a=2,b=1,c=0.5 / triclinic (pi/4,pi/6,pi/3)RESIDUES2.19 ms3.12 ms1.43×1.4e-12
Rotated triaxial a=2,b=1,c=0.5 / triclinic (pi/4,pi/6,pi/3)NUMINT3D2.19 ms90.4 ms41.4×1.9e-10
Rotated triaxial a=2,b=1,c=0.5 / triclinic :decuhr (pi/4,pi/6,pi/3)RESIDUES2.99 ms3.11 ms1.04×2.0e-10
Rotated triaxial a=2,b=1,c=0.5 / triclinic :decuhr (pi/4,pi/6,pi/3)NUMINT3D2.99 ms90.6 ms30.3×5.5e-14

Crack compliance ​

CaseEchoesgap
Penny / ISOanalytical350 ns57.3 ms160000×5.2e-10
Penny / cubicNUMINT3D2.5 ms62.2 ms24.9×7.1e-09
Penny / triclinicRESIDUES1.71 ms3.58 ms2.1×6.9e-10
Penny / triclinicNUMINT3D1.71 ms105 ms61.6×6.9e-10

Conductivity ​

CaseEchoesgap
Sphere a=b=c=1 / K isoanalytical8.02 ns4.84 µs600×0.0e+00
Prolate a=5,b=c=1 / K isoanalytical165 ns4.98 µs30.2×1.1e-16
Oblate a=b=5,c=1 / K isoanalytical150 ns4.94 µs32.9×1.8e-16
Triaxial a=2,b=1,c=0.5 / K anisoRESIDUES4.05 µs8.58 µs2.12×2.2e-16
Triaxial a=2,b=1,c=0.5 / K anisoNUMINT3D4.05 µs8.8 µs2.17×2.2e-16
Rotated triaxial a=2,b=1,c=0.5 / K aniso (pi/4,pi/6,pi/3)RESIDUES7.35 µs9.13 µs1.24×1.0e-15
Rotated triaxial a=2,b=1,c=0.5 / K aniso (pi/4,pi/6,pi/3)NUMINT3D7.35 µs9.17 µs1.25×1.0e-15

Derivative ​

ForwardDiff through hill_tensor on the Julia side, Echoes' hill_derivative on the other (a closed form for an isotropic medium).

CaseEchoesgap
Sphere a=b=c=1 / ISO | κ=3kISO557 ns8.47 µs15.2×4.8e-16
Sphere a=b=c=1 / ISO | η=2μISO557 ns8.47 µs15.2×9.8e-17
Prolate a=5,b=c=1 / ISO | κ=3kISO1.25 µs8.82 µs7.04×2.9e-16
Prolate a=5,b=c=1 / ISO | η=2μISO1.25 µs8.79 µs7.03×6.2e-16
Oblate a=b=5,c=1 / ISO | κ=3kISO1.23 µs8.64 µs7.05×1.5e-16
Oblate a=b=5,c=1 / ISO | η=2μISO1.23 µs8.55 µs6.98×4.8e-16
Prolate a=3,b=c=1 / cubic-as-ORTHO | C11NUMINT3D2.93 ms108 ms36.7×5.1e-05
Prolate a=3,b=c=1 / cubic-as-ORTHO | C22NUMINT3D2.95 ms111 ms37.5×1.8e-06
Prolate a=3,b=c=1 / cubic-as-ORTHO | C33NUMINT3D2.93 ms112 ms38.2×2.1e-05
Prolate a=3,b=c=1 / cubic-as-ORTHO | C12NUMINT3D2.91 ms123 ms42.3×1.3e-05
Prolate a=3,b=c=1 / cubic-as-ORTHO | C13NUMINT3D2.95 ms121 ms40.8×1.3e-04
Prolate a=3,b=c=1 / cubic-as-ORTHO | C23NUMINT3D2.91 ms128 ms43.9×9.3e-06
Prolate a=3,b=c=1 / cubic-as-ORTHO | μ₂₃NUMINT3D2.97 ms153 ms51.5×5.2e-06
Prolate a=3,b=c=1 / cubic-as-ORTHO | μ₁₃NUMINT3D2.94 ms133 ms45.3×3.7e-05
Prolate a=3,b=c=1 / cubic-as-ORTHO | μ₁₂NUMINT3D2.94 ms130 ms44.3×1.0e-05

Schemes ​

Whole homogenizations of the same RVEs, with the same tolerances on both sides: numerical Hill tensors to a relative (absolute ), fixed points to a relative . The aging viscoelastic cases discretize a Maxwell matrix on 11 instants.

Measured on AMD EPYC-Milan Processor, Julia 1.13.2, MeanFieldHomogenization 0.20.1, TensND 0.8.3, 1 thread; BenchmarkTools @belapsed minimum, one thread; Hill tensors to rtol 1e-6, atol 1e-8; fixed points to rtol 1e-8.

CaseSchemegap
isotropic matrix, spheresmori tanaka791 ns169 ms210000×1.9e-13
isotropic matrix, spheresself consistent9.8 µs1.35 s140000×1.8e-13
isotropic matrix, spheresdifferential127 µs85.7 s680000×5.5e-05
isotropic matrix, aligned prolate spheroids 5:1:1mori tanaka942 ns225 ms240000×2.1e-12
isotropic matrix, aligned prolate spheroids 5:1:1self consistent75.7 µs1.88 s25000×3.4e-13
isotropic matrix, oblate pores 1:1:0.1, isotropic averagemori tanaka916 ns165 ms180000×1.7e-13
isotropic matrix, oblate pores 1:1:0.1, isotropic averageself consistent36.7 µs6.65 s180000×3.0e-12
anisotropic matrix, two rotated triaxial familiesdilute1.13 ms226 ms200×1.4e-11
anisotropic matrix, two rotated triaxial familiesmori tanaka1.17 ms316 ms270×1.4e-11
conduction, isotropic matrix, spheresmori tanaka792 ns35.8 µs45.2×1.4e-16
conduction, isotropic matrix, spheresself consistent22.4 µs185 µs8.26×2.6e-16
conduction, anisotropic matrix, rotated triaxial ellipsoidsdilute8.44 µs48.4 µs5.73×9.7e-17
conduction, anisotropic matrix, rotated triaxial ellipsoidsmori tanaka9.9 µs56.1 µs5.67×3.5e-16
conduction, anisotropic matrix, rotated triaxial ellipsoidsself consistent161 µs288 µs1.79×4.6e-16
ALV: Maxwell matrix, elastic spheresmori tanaka107 µs1.03 ms9.66×2.9e-16
ALV: Maxwell matrix, elastic spheresself consistent1.18 ms6.58 ms5.59×2.1e-16
ALV: Maxwell matrix, oblate soft inclusions 1:1:0.1, isotropic averagemori tanaka180 µs1.05 ms5.85×7.9e-16
ALV: Maxwell matrix, oblate soft inclusions 1:1:0.1, isotropic averageself consistent1.92 ms6.69 ms3.48×6.7e-16

The differential scheme is not the same algorithm on both sides: Echoes takes 1000 explicit first-order steps, MeanFieldHomogenization integrates adaptively to a relative , hence a gap of a few , the error of the first-order steps.

The three-scale strength model: the same route, two stopping rules ​

The model of Quasi-brittle strength of cement paste and mortar computes a strength and its derivative with respect to the shear modulus of one family of hydrate needles. Both codes take the same route, described on the page of the model: the self-consistent foam is first converged with the needles averaged isotropically, whose Hill tensors are closed forms, and the 20 transversely isotropic families start from that estimate. They stop differently. Echoes takes a single step over the families and obtains the derivative there, with numerical Hill tensors to . MeanFieldHomogenization iterates the families to convergence, the derivative included through dual numbers, every Hill tensor to . The second row starts the families from the hydrate stiffness instead, the direct route kept to validate the first (Validating the angular discretization); both rows reach the same strength.

CaseSchemegap
three-scale strength model (20 needle families), value and derivativeSC + MT + MT, from the isotropic foam2.7 s2.29 s0.85×6.0e-04
three-scale strength model (20 needle families), value and derivativeSC + MT + MT, direct4.51 s2.29 s0.51×6.0e-04

What the numbers say ​

  • Closed forms against Echoes' calls. On an isotropic medium both codes evaluate a closed form, and a Hill tensor costs tens of nanoseconds in Julia against tens of milliseconds through Echoes' Python API; the isotropic schemes inherit the factor.

  • Same algorithm, comparable speed. Residues against residues on a triclinic medium, and the anisotropic conductivity, differ by a factor 2 to 2.5. The one case where Echoes is faster, :decuhr on the rotated triclinic ellipsoid against Echoes' residues, is a cubature against residues.

  • The cubatures are the fastest general back-ends. :nestedquadgk agrees with NUMINT3D to and is 80 to 400 times faster.

  • Derivatives by automatic differentiation cost no more than closed forms. ForwardDiff through hill_tensor beats Echoes' closed-form derivative on the isotropic cases.

  • Aging viscoelasticity: 3.6 to 10 times faster on 11 instants, the self-consistent schemes in the cheapest algebra of the reference kernel.

Reproducing ​

The Julia scripts call the Echoes side through PythonCall, from Python modules next to them. Install Echoes in a Python environment of your choice, which must also have sympy (pip install sympy), activate it, then start Julia from the same shell: scripts/bench_echoes/echoes_python.jl, included by every script before PythonCall loads, takes the active python3 (or the interpreter named by ECHOES_PYTHON), checks that it imports echoes and sympy, and tells PythonCall to use it and CondaPkg to manage nothing. The explicit alternative is JULIA_CONDAPKG_BACKEND=Null and JULIA_PYTHONCALL_EXE=<path to that python>. CondaPkg then touches nothing, so the numpy version Echoes was built against (often numpy 1.x, numpy < 2) is kept; never let CondaPkg manage an environment where Echoes is installed, or pin that numpy in its CondaPkg.toml. Details in scripts/bench_echoes/README.md. From the root of the repository, alone on the machine:

bash
julia --project=scripts/bench_echoes scripts/bench_echoes/benchmark.jl
julia --project=scripts/bench_echoes scripts/bench_echoes/benchmark_schemes_speed.jl

They write scripts/bench_echoes/figures/benchmark_kernels.json and benchmark_schemes_speed.json, which this page reads. The Echoes side runs on its own as well, with the cases defined once in these modules:

bash
python3 -I scripts/bench_echoes/kernels_echoes.py
python3 -I scripts/bench_echoes/schemes_speed_echoes.py

with python3 the interpreter in which import echoes works.

Internal (Julia-only) regression benchmarking is separate: scripts/bench/ holds a gated suite with a committed baseline and a bitwise checksum gate, described in its own README.md.

Where to go next ​

Roadmap lists what remains to be implemented.