mosaic-bench 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mosaic_bench-0.1.0/.gitignore +57 -0
- mosaic_bench-0.1.0/LICENSE +200 -0
- mosaic_bench-0.1.0/PKG-INFO +278 -0
- mosaic_bench-0.1.0/README.md +245 -0
- mosaic_bench-0.1.0/mosaic/__init__.py +44 -0
- mosaic_bench-0.1.0/mosaic/_version.py +24 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/__init__.py +2 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/__init__.py +36 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/__main__.py +11 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/_helpers.py +544 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/_status_helpers.py +306 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/build.py +73 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/ics.py +66 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/reference.py +314 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/run.py +337 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/status.py +192 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/cli/templates.py +190 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/__init__.py +2 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/cell_filter.py +113 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/config.py +1257 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/console.py +68 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/exceptions.py +14 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/experiment.py +684 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/hardware.py +146 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/harness.py +199 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/io.py +1160 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/memory.py +206 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/partial.py +134 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/reference.py +180 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/resources.py +37 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/runner.py +815 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/status.py +1588 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/status_checks.py +243 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/core/utils.py +226 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/__init__.py +75 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_3d_grid/__init__.py +4 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_3d_grid/config.py +422 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_3d_grid/exclusions.py +39 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_3d_grid/extras.py +860 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_3d_grid/ics.py +123 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_3d_grid/optimization.py +1077 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_3d_grid/physics.py +52 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_3d_grid/plots.py +772 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_grid/__init__.py +4 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_grid/config.py +455 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_grid/exclusions.py +123 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_grid/extras.py +372 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_grid/ics.py +66 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_grid/optimization.py +599 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_grid/physics.py +87 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/navier_stokes_grid/plots.py +641 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/ns_grid/references/forward_cylinder.npz +0 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/__init__.py +21 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/cost.py +251 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/diagnostics.py +71 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/forward.py +483 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/gradient.py +529 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/ics.py +54 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/mesh.py +58 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/optimization.py +248 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/plots/__init__.py +26 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/plots/cost.py +508 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/plots/cost_overview.py +377 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/plots/forward.py +1016 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/plots/gradient.py +1273 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/plots/ics.py +216 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/plots/optimization.py +73 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/plots/solver_styles.py +78 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/shared/plots/style.py +883 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/__init__.py +4 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/config.py +369 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/exclusions.py +69 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/extras.py +622 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/ics.py +118 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/optimization.py +208 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/physics.py +237 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/plots.py +538 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/references/forward_agreement.npz +0 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/structural_mesh/references/forward_baseline.npz +0 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/__init__.py +4 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/config.py +498 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/exclusions.py +54 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/extras.py +238 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/ics.py +159 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/optimization.py +277 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/physics.py +377 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/plots.py +112 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/references/forward_agreement.npz +0 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/references/forward_baseline.npz +0 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/references/forward_source_baseline.npz +0 -0
- mosaic_bench-0.1.0/mosaic/benchmarks/problems/thermal_mesh/references/forward_source_linearity.npz +0 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/__init__.py +24 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/__init__.py +4 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/navier_stokes_grid/__init__.py +7 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/navier_stokes_grid/drag.py +93 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/navier_stokes_grid/grid_fluid.py +75 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/navier_stokes_grid/ns_solver.jl +851 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/navier_stokes_grid/schemas.py +129 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/structural_mesh/__init__.py +6 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/structural_mesh/schemas.py +163 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/structural_mesh/topopt_solver.jl +251 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/thermal_mesh/__init__.py +6 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/problems/thermal_mesh/schemas.py +198 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/pyproject.toml +22 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/types.py +315 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/utils/__init__.py +2 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/utils/comparisons.py +147 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/utils/plotting.py +75 -0
- mosaic_bench-0.1.0/mosaic/mosaic_shared/utils/sdf.py +38 -0
- mosaic_bench-0.1.0/mosaic/templates/__init__.py +4 -0
- mosaic_bench-0.1.0/mosaic/templates/ns-periodic.yaml +68 -0
- mosaic_bench-0.1.0/mosaic/templates/scaffold.py +353 -0
- mosaic_bench-0.1.0/mosaic/templates/structural-steady.yaml +110 -0
- mosaic_bench-0.1.0/mosaic/templates/thermal-steady.yaml +111 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/exponax/tesseract_api.py +396 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/exponax/tesseract_config.yaml +26 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/exponax/tesseract_requirements.txt +4 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/ins-jl/tesseract_api.py +558 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/ins-jl/tesseract_config.yaml +36 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/ins-jl/tesseract_requirements.txt +3 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/jax-cfd/tesseract_api.py +470 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/jax-cfd/tesseract_config.yaml +27 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/jax-cfd/tesseract_requirements.txt +4 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/openfoam/tesseract_api.py +1033 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/openfoam/tesseract_config.yaml +37 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/openfoam/tesseract_requirements.txt +2 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/phiflow/tesseract_api.py +470 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/phiflow/tesseract_config.yaml +30 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/phiflow/tesseract_requirements.txt +4 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/pict/tesseract_api.py +1453 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/pict/tesseract_config.yaml +74 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/pict/tesseract_requirements.txt +6 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/warp-ns/tesseract_api.py +1841 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/warp-ns/tesseract_config.yaml +24 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/warp-ns/tesseract_requirements.txt +2 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/xlb/tesseract_api.py +887 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/xlb/tesseract_config.yaml +33 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/navier-stokes-grid/xlb/tesseract_requirements.txt +4 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/dealii-structural/CMakeLists.txt +14 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/dealii-structural/src/cnpy.cpp +233 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/dealii-structural/src/cnpy.h +55 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/dealii-structural/src/struct_solver.cpp +500 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/dealii-structural/tesseract_api.py +203 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/dealii-structural/tesseract_config.yaml +30 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/dealii-structural/tesseract_environment.yaml +7 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/dealii-structural/tesseract_requirements.txt +2 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/fenics-structural/tesseract_api.py +420 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/fenics-structural/tesseract_config.yaml +27 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/fenics-structural/tesseract_environment.yaml +12 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/firedrake-structural/tesseract_api.py +537 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/firedrake-structural/tesseract_config.yaml +28 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/firedrake-structural/tesseract_environment.yaml +1 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/firedrake-structural/tesseract_requirements.txt +4 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/jax-fem/tesseract_api.py +358 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/jax-fem/tesseract_config.yaml +31 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/jax-fem/tesseract_environment.yaml +21 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/jax-fem/tesseract_requirements.txt +10 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/topopt-jl/tesseract_api.py +214 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/topopt-jl/tesseract_config.yaml +37 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/structural-mesh/topopt-jl/tesseract_requirements.txt +3 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/dealii-heat/CMakeLists.txt +14 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/dealii-heat/src/cnpy.cpp +6 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/dealii-heat/src/cnpy.h +224 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/dealii-heat/src/heat_solver.cpp +380 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/dealii-heat/tesseract_api.py +207 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/dealii-heat/tesseract_config.yaml +31 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/dealii-heat/tesseract_environment.yaml +7 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/dealii-heat/tesseract_requirements.txt +3 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/fenics-heat/tesseract_api.py +717 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/fenics-heat/tesseract_config.yaml +27 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/fenics-heat/tesseract_environment.yaml +12 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/firedrake-heat/tesseract_api.py +670 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/firedrake-heat/tesseract_config.yaml +27 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/firedrake-heat/tesseract_requirements.txt +1 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/jax-fem/tesseract_api.py +383 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/jax-fem/tesseract_config.yaml +29 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/jax-fem/tesseract_environment.yaml +21 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/torch-fem-thermal/tesseract_api.py +561 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/torch-fem-thermal/tesseract_config.yaml +32 -0
- mosaic_bench-0.1.0/mosaic/tesseracts/thermal-mesh/torch-fem-thermal/tesseract_requirements.txt +4 -0
- mosaic_bench-0.1.0/pyproject.toml +138 -0
- mosaic_bench-0.1.0/requirements.txt +330 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
*.egg
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Virtual environments
|
|
12
|
+
.venv/
|
|
13
|
+
venv/
|
|
14
|
+
env/
|
|
15
|
+
|
|
16
|
+
# IDE
|
|
17
|
+
.idea/
|
|
18
|
+
.vscode/
|
|
19
|
+
*.swp
|
|
20
|
+
*.swo
|
|
21
|
+
*~
|
|
22
|
+
|
|
23
|
+
# OS
|
|
24
|
+
.DS_Store
|
|
25
|
+
Thumbs.db
|
|
26
|
+
|
|
27
|
+
# Quarto
|
|
28
|
+
_site/
|
|
29
|
+
.quarto/
|
|
30
|
+
docs/solvers.qmd
|
|
31
|
+
|
|
32
|
+
# LaTeX
|
|
33
|
+
*.aux
|
|
34
|
+
*.bbl
|
|
35
|
+
*.blg
|
|
36
|
+
*.fdb_latexmk
|
|
37
|
+
*.fls
|
|
38
|
+
*.log
|
|
39
|
+
*.out
|
|
40
|
+
*.synctex.gz
|
|
41
|
+
*.pdf
|
|
42
|
+
|
|
43
|
+
# Benchmark results (default output of `mosaic run`)
|
|
44
|
+
mosaic-results/
|
|
45
|
+
|
|
46
|
+
# Tesseract build artifacts
|
|
47
|
+
*.whl
|
|
48
|
+
|
|
49
|
+
# Misc
|
|
50
|
+
.env
|
|
51
|
+
.claude/
|
|
52
|
+
uv.lock
|
|
53
|
+
|
|
54
|
+
/.quarto/
|
|
55
|
+
|
|
56
|
+
# Version file (auto-generated)
|
|
57
|
+
mosaic/_version.py
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. Please also get specific
|
|
185
|
+
permission from your employer if they claim rights to intellectual
|
|
186
|
+
property that you create.
|
|
187
|
+
|
|
188
|
+
Copyright 2025- Pasteur Labs
|
|
189
|
+
|
|
190
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
191
|
+
you may not use this file except in compliance with the License.
|
|
192
|
+
You may obtain a copy of the License at
|
|
193
|
+
|
|
194
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
195
|
+
|
|
196
|
+
Unless required by applicable law or agreed to in writing, software
|
|
197
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
198
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
|
+
See the License for the specific language governing permissions and
|
|
200
|
+
limitations under the License.
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mosaic-bench
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A benchmark suite for differentiable physics solvers
|
|
5
|
+
Project-URL: Homepage, https://github.com/pasteurlabs/mosaic
|
|
6
|
+
Project-URL: Documentation, https://docs.pasteurlabs.ai/projects/mosaic/latest
|
|
7
|
+
Author-email: "The Mosaic team @ Pasteur Labs + OSS contributors" <info@simulation.science>
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Requires-Dist: docker>=6
|
|
12
|
+
Requires-Dist: filelock>=3
|
|
13
|
+
Requires-Dist: jax[cpu]
|
|
14
|
+
Requires-Dist: matplotlib
|
|
15
|
+
Requires-Dist: numpy
|
|
16
|
+
Requires-Dist: nvidia-ml-py
|
|
17
|
+
Requires-Dist: optax
|
|
18
|
+
Requires-Dist: pandas
|
|
19
|
+
Requires-Dist: psutil
|
|
20
|
+
Requires-Dist: pyyaml
|
|
21
|
+
Requires-Dist: rich>=13.0
|
|
22
|
+
Requires-Dist: tesseract-core[runtime]>=1.9.0
|
|
23
|
+
Requires-Dist: tesseract-jax
|
|
24
|
+
Requires-Dist: typer>=0.12
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: mosaic-shared; extra == 'dev'
|
|
27
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
30
|
+
Requires-Dist: pyyaml; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
# Mosaic: a benchmark suite for differentiable physics solvers
|
|
37
|
+
|
|
38
|
+
Mosaic measures gradient quality, computational cost, and solver compatibility across 14 differentiable physics solvers in 4 domains. Each solver is packaged as a [Tesseract](https://github.com/pasteurlabs/tesseract-core) container exposing a uniform `apply` / `vjp` interface, enabling cross-solver comparison regardless of language or AD backend.
|
|
39
|
+
|
|
40
|
+
### Why Mosaic?
|
|
41
|
+
|
|
42
|
+
Differentiable physics solvers unlock gradient-based optimization for topology optimization, aerodynamic design, optimal control, and solver-in-the-loop ML. But the practical cost of obtaining correct gradients is largely undocumented: solvers span multiple languages and AD frameworks, runtime overhead varies by orders of magnitude, and subtle numerical issues (ill-conditioned Jacobians, chaotic divergence, floating-point truncation) can silently corrupt gradients. Mosaic provides a standardized, solver-agnostic evaluation that surfaces these practically relevant differences so practitioners can make informed choices.
|
|
43
|
+
|
|
44
|
+
<p align="center"><img src="visual_abstract.png" width="100%" alt="Overview of Mosaic: diverse solver backends are wrapped behind a uniform containerized interface (Tesseract), enabling cross-solver comparison on shared benchmark tasks across different physical domains."></p>
|
|
45
|
+
|
|
46
|
+
| ID | Domain | Optimization task | Solvers |
|
|
47
|
+
| :----- | :------------------------- | :----------------------------- | :----------------------------------------------------- |
|
|
48
|
+
| **H** | Heat transfer | Conductivity inversion | deal.II, FEniCS, Firedrake, JAX-FEM, torch-fem |
|
|
49
|
+
| **S** | Structural mechanics | Compliance minimization (SIMP) | deal.II, FEniCS, Firedrake, JAX-FEM, TopOpt.jl |
|
|
50
|
+
| **F2** | Incompressible fluids (2D) | Inflow optimization (drag) | JAX-CFD, PhiFlow, INS.jl, XLB, PICT, Warp-NS, OpenFOAM |
|
|
51
|
+
| **F3** | 3D Navier-Stokes | Initial condition recovery | PhiFlow, XLB, PICT, Warp-NS, Exponax, INS.jl, OpenFOAM |
|
|
52
|
+
|
|
53
|
+
### 📊 [Browse the latest benchmark results →](https://docs.pasteurlabs.ai/projects/mosaic/latest/docs/results_ns_grid.html)
|
|
54
|
+
|
|
55
|
+
Per-domain pages with every plot, solver rankings, and the full evaluation protocol, refreshed on each release:
|
|
56
|
+
[Navier–Stokes 2D](https://docs.pasteurlabs.ai/projects/mosaic/latest/docs/results_ns_grid.html) ·
|
|
57
|
+
[Navier–Stokes 3D](https://docs.pasteurlabs.ai/projects/mosaic/latest/docs/results_ns_3d_grid.html) ·
|
|
58
|
+
[Structural mechanics](https://docs.pasteurlabs.ai/projects/mosaic/latest/docs/results_structural_mesh.html) ·
|
|
59
|
+
[Heat transfer](https://docs.pasteurlabs.ai/projects/mosaic/latest/docs/results_thermal_mesh.html)
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
> **Paper reproduction:** if you're here to reproduce the results from [our paper](https://arxiv.org/abs/XXXX.XXXXX), see the [`v0.1+paper-repro`](https://github.com/pasteurlabs/mosaic/tree/v0.1+paper-repro) tag which contains the figure-generation code, pinned dependencies, and step-by-step instructions.
|
|
64
|
+
|
|
65
|
+
**Jump to your use case:**
|
|
66
|
+
|
|
67
|
+
- [Browse the results](https://docs.pasteurlabs.ai/projects/mosaic/latest/docs/results_ns_grid.html) — see how the solvers compare, no setup required
|
|
68
|
+
- [Run the benchmarks](#run-the-benchmarks) — run solvers and inspect results
|
|
69
|
+
- [Use Tesseracts in your own code](#use-tesseracts-in-your-own-code) — researcher building on Mosaic solvers
|
|
70
|
+
- [Contribute](#contribute) — add a solver, tune a configuration, or extend to a new domain
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Run the benchmarks
|
|
75
|
+
|
|
76
|
+
Requires Python >= 3.10, Docker, and (for GPU solvers) the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html).
|
|
77
|
+
|
|
78
|
+
> **Platform note:** We strongly recommend **Linux with Docker Engine** for the best experience. Docker Desktop on macOS and Windows runs containers inside a VM, which adds significant overhead to solver execution and can surface ARM-related compatibility issues on Apple Silicon. If you're on macOS or Windows, consider using a Linux VM or WSL 2 with Docker Engine installed natively inside it.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/pasteurlabs/mosaic && cd mosaic
|
|
82
|
+
uv sync # or: pip install -e .
|
|
83
|
+
mosaic run # builds containers, runs experiments, generates plots
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
A single-problem run with `--debug` (reduced grid sizes) finishes in minutes and is a good way to verify your setup:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
$ mosaic run -p thermal-mesh --suites forward --debug
|
|
90
|
+
──────────────────────────── problem: thermal-mesh ─────────────────────────────
|
|
91
|
+
──────────────────────────────────── build ─────────────────────────────────────
|
|
92
|
+
deal.II → dealii_heat_thermal_mesh:latest (3.6s)
|
|
93
|
+
FEniCS → fenics_heat_thermal_mesh:latest (3.2s)
|
|
94
|
+
Firedrake → firedrake_heat_thermal_mesh:latest (2.4s)
|
|
95
|
+
JAX-FEM → jax_fem_thermal_mesh:latest (5.1s)
|
|
96
|
+
torch-fem → torch_fem_thermal_mesh:latest (4.8s)
|
|
97
|
+
─────────────────────────────── suite: forward ───────────────────────────────
|
|
98
|
+
5 experiment(s) queued, 5 solver(s) registered
|
|
99
|
+
────────────────────────── experiment: baseline [1/5] ──────────────────────────
|
|
100
|
+
deal.II done in 0.8s
|
|
101
|
+
FEniCS done in 1.2s
|
|
102
|
+
Firedrake done in 1.5s
|
|
103
|
+
JAX-FEM done in 2.3s
|
|
104
|
+
torch-fem done in 1.1s
|
|
105
|
+
...
|
|
106
|
+
─────────────────────────────────── summary ────────────────────────────────────
|
|
107
|
+
┏━━━━━━━━━━━━━━┳━━━━━━━━━┓
|
|
108
|
+
┃ problem ┃ forward ┃
|
|
109
|
+
┡━━━━━━━━━━━━━━╇━━━━━━━━━┩
|
|
110
|
+
│ thermal-mesh │ ok │
|
|
111
|
+
└──────────────┴─────────┘
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Inspect results
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
mosaic status # per-experiment completion table
|
|
118
|
+
mosaic status -p ns-grid -f # single domain with failure reasons
|
|
119
|
+
mosaic status --format md > report.md
|
|
120
|
+
mosaic status --format json > snap.json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Pick which solvers run
|
|
124
|
+
|
|
125
|
+
`-s` (alias `--solvers`) takes either a flat CSV applied as a union
|
|
126
|
+
across every problem, or a per-problem map for finer control:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Flat CSV — each problem keeps only the listed solvers that exist
|
|
130
|
+
# there; problems with zero matches are skipped.
|
|
131
|
+
mosaic run -s OpenFOAM,XLB,deal.II,JAX-FEM
|
|
132
|
+
|
|
133
|
+
# Per-problem map — explicit picks per domain.
|
|
134
|
+
mosaic run -s "ns-grid=XLB,jax-cfd;structural-mesh=Firedrake,JAX-FEM"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Re-run a subset
|
|
138
|
+
|
|
139
|
+
After an initial pass, `mosaic run --only <state[,…]>` re-executes only
|
|
140
|
+
the cells currently in the given state and leaves fresh-ok cells alone.
|
|
141
|
+
Useful for iterating on a single solver or recovering from a partial
|
|
142
|
+
failure without redoing everything.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
mosaic run --only failed # re-run only failed cells
|
|
146
|
+
mosaic run --only failed,stale # plus anything the harness/source has invalidated
|
|
147
|
+
mosaic run --only missing # first-time runs only
|
|
148
|
+
mosaic run -s PhiFlow --only excluded # re-check after dropping an exclusion
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
States: `failed`, `anom`, `missing`, `stale`, `excluded`. Combinable
|
|
152
|
+
with `-p / --suites / -e / -s` for finer scoping.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Use Tesseracts in your own code
|
|
157
|
+
|
|
158
|
+
Every solver in Mosaic is a standalone [Tesseract](https://github.com/pasteurlabs/tesseract-core) that you can call from your own research code — no benchmark harness required.
|
|
159
|
+
|
|
160
|
+
### Install
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Shared schemas (only deps: pydantic + tesseract-core)
|
|
164
|
+
pip install -e mosaic/mosaic_shared
|
|
165
|
+
|
|
166
|
+
# For containerised usage (recommended): also install tesseract-jax
|
|
167
|
+
pip install tesseract-core tesseract-jax jax
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Option A: Local (no Docker)
|
|
171
|
+
|
|
172
|
+
Fastest for prototyping. Requires the solver's native Python dependencies.
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
import numpy as np
|
|
176
|
+
from tesseract_core import Tesseract
|
|
177
|
+
from mosaic_shared.problems.navier_stokes_grid.schemas import make_vortex_ic
|
|
178
|
+
|
|
179
|
+
ic = make_vortex_ic(N=64, seed=42)
|
|
180
|
+
inputs = {"v0": ic, "viscosity": np.array([0.01], dtype=np.float32), "steps": 50}
|
|
181
|
+
|
|
182
|
+
t = Tesseract.from_tesseract_api(
|
|
183
|
+
"mosaic/tesseracts/navier-stokes-grid/exponax/tesseract_api.py"
|
|
184
|
+
)
|
|
185
|
+
outputs = t.apply(inputs)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Option B: Via container (requires Docker, fully isolated)
|
|
189
|
+
|
|
190
|
+
Works for every solver regardless of language. Build the image once, then use it from JAX:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
$ tesseract build mosaic/tesseracts/navier-stokes-grid/exponax
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
import jax
|
|
198
|
+
import jax.numpy as jnp
|
|
199
|
+
from tesseract_core import Tesseract
|
|
200
|
+
from tesseract_jax import apply_tesseract
|
|
201
|
+
from mosaic_shared.problems.navier_stokes_grid.schemas import make_vortex_ic
|
|
202
|
+
|
|
203
|
+
ic = make_vortex_ic(N=64, seed=42)
|
|
204
|
+
inputs = {"v0": ic, "viscosity": jnp.array([0.01]), "steps": 50}
|
|
205
|
+
|
|
206
|
+
with Tesseract.from_image("exponax_navier_stokes_grid:latest") as t:
|
|
207
|
+
outputs = apply_tesseract(t, inputs)
|
|
208
|
+
grad_v0 = jax.grad(lambda v0: jnp.mean(
|
|
209
|
+
apply_tesseract(t, {**inputs, "v0": v0})["result"] ** 2
|
|
210
|
+
))(inputs["v0"])
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
See [Standalone Usage](docs/standalone.qmd) for the full guide (GPU usage, mesh-based solvers, common gotchas) and the [Solver Reference](docs/solvers.qmd) for the per-solver catalog with image names.
|
|
214
|
+
|
|
215
|
+
### Programmatic API
|
|
216
|
+
|
|
217
|
+
Mosaic also exposes a Python API for running evaluations without the CLI:
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
from mosaic import get_config, PROBLEMS
|
|
221
|
+
|
|
222
|
+
cfg = get_config("ns-grid") # Problem for 2-D Navier-Stokes
|
|
223
|
+
print(cfg.solver_names) # available solver backends
|
|
224
|
+
|
|
225
|
+
# Each (suite, experiment) is registered on the Problem as an Experiment
|
|
226
|
+
# closure. Invoke one directly with a {solver_name: image_tag} mapping:
|
|
227
|
+
tags = {s.name: s.image_tag for s in cfg.solvers}
|
|
228
|
+
results = cfg.experiments["gradient/fd_check"].fn(cfg, tags)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Available top-level imports: `PROBLEMS`, `get_config`, `Problem`, `SolverSpec`, `IcSpec`, and the shared suite-kernel modules `forward`, `gradient`, `cost`, `optimization` (from `mosaic.benchmarks.problems.shared`).
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Contribute
|
|
236
|
+
|
|
237
|
+
Mosaic is designed to grow with the community. There are three ways in, roughly ordered by scope:
|
|
238
|
+
|
|
239
|
+
- **Tune an existing solver** — improve an out-of-the-box configuration. Snapshot `mosaic status --format json` before/after and include the diff in your PR. See [CONTRIBUTING.md](CONTRIBUTING.md#tuning-an-existing-solver) for the full workflow.
|
|
240
|
+
- **Add a solver** to an existing domain — three files under `mosaic/tesseracts/<domain>/<solver-name>/`. Walkthrough: [Add a Solver tutorial](docs/tutorial-add-solver.qmd).
|
|
241
|
+
- **Add a benchmark domain** — scaffold with `mosaic new-domain <name> --from-template <template>`. Walkthrough: [Add a Domain tutorial](docs/tutorial-add-domain.qmd).
|
|
242
|
+
|
|
243
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) covers code style, the PR workflow, and how to build the docs locally. For questions and support, visit the [Tesseract Forum](https://si-tesseract.discourse.group/).
|
|
244
|
+
|
|
245
|
+
## Documentation
|
|
246
|
+
|
|
247
|
+
- [Getting Started](docs/getting-started.qmd) — prerequisites, installation, first benchmark
|
|
248
|
+
- [Use Mosaic solvers elsewhere](docs/standalone.qmd) — using individual Tesseracts in your own code
|
|
249
|
+
- [Architecture](docs/architecture.qmd) — Tesseract interface, data structures, evaluation protocol
|
|
250
|
+
- [Solver Reference](docs/solvers.qmd) — per-solver documentation with numerical methods, AD strategies, and known limitations
|
|
251
|
+
- [Add a Solver](docs/tutorial-add-solver.qmd) — step-by-step tutorial with a complete working example
|
|
252
|
+
- [Add a Domain](docs/tutorial-add-domain.qmd) — end-to-end walkthrough for a new physics domain
|
|
253
|
+
|
|
254
|
+
## Project structure
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
mosaic/
|
|
258
|
+
benchmarks/ # evaluation harness (Python package: mosaic.benchmarks)
|
|
259
|
+
cli.py # command-line interface
|
|
260
|
+
core/ # runner, config, hardware detection, solver auto-discovery
|
|
261
|
+
problems/ # per-domain packages (ns-grid, ns-3d-grid, structural-mesh, thermal-mesh)
|
|
262
|
+
shared/ # cross-domain suite kernels (forward, gradient, cost, optimization) + plots
|
|
263
|
+
plots/ # plotting infrastructure
|
|
264
|
+
templates/ # task templates for scaffolding new domains
|
|
265
|
+
tesseracts/ # solver backends (each is a Tesseract container)
|
|
266
|
+
mosaic_shared/ # shared Tesseract interface schemas (also pip-installable)
|
|
267
|
+
problems/ # per-domain input/output schemas
|
|
268
|
+
utils/ # comparison metrics, plotting utilities
|
|
269
|
+
navier-stokes-grid/ # JAX-CFD, PhiFlow, XLB, PICT, Warp-NS, etc.
|
|
270
|
+
structural-mesh/ # deal.II, FEniCS, Firedrake, JAX-FEM, TopOpt.jl
|
|
271
|
+
thermal-mesh/ # deal.II, FEniCS, Firedrake, JAX-FEM, torch-fem
|
|
272
|
+
tests/ # unit tests (run with pytest)
|
|
273
|
+
docs/ # Quarto documentation site
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## License
|
|
277
|
+
|
|
278
|
+
Apache 2.0. Individual solver backends retain their upstream licenses, documented per solver in the repository.
|