BENCHMARKS

SimplePETSc

This page is based on a Jupyter notebook.

The following shows running a simple steady-state diffusion benchmark running on 2 cores.

import os(click to toggle)
import os
from pathlib import Path
from subprocess import run

import numpy as np
import ogstools as ot
prj_name = "square_1e1_neumann"(click to toggle)
prj_name = "square_1e1_neumann"
data_dir = os.environ.get("OGS_DATA_DIR", "../../../Data")
prj_file = f"{data_dir}/EllipticPETSc/{prj_name}.prj"
out_dir = Path(os.environ.get("OGS_TESTRUNNER_OUT_DIR", "_out"))(click to toggle)
out_dir = Path(os.environ.get("OGS_TESTRUNNER_OUT_DIR", "_out"))
out_dir.mkdir(parents=True, exist_ok=True)

command = f"mpirun --bind-to none -np 2 ogs {prj_file} -o {out_dir} > {out_dir}/out.txt"
print(command)
run(command, shell=True, check=True)
mpirun --bind-to none -np 2 ogs /var/lib/gitlab-runner/builds/sy3_rc3xP/0/ogs/ogs/Tests/Data/EllipticPETSc/square_1e1_neumann.prj -o /var/lib/gitlab-runner/builds/sy3_rc3xP/0/ogs/build/release-petsc/Tests/Data/Notebooks/SimplePETSc > /var/lib/gitlab-runner/builds/sy3_rc3xP/0/ogs/build/release-petsc/Tests/Data/Notebooks/SimplePETSc/out.txt
CompletedProcess(args='mpirun --bind-to none -np 2 ogs /var/lib/gitlab-runner/builds/sy3_rc3xP/0/ogs/ogs/Tests/Data/EllipticPETSc/square_1e1_neumann.prj -o /var/lib/gitlab-runner/builds/sy3_rc3xP/0/ogs/build/release-petsc/Tests/Data/Notebooks/SimplePETSc > /var/lib/gitlab-runner/builds/sy3_rc3xP/0/ogs/build/release-petsc/Tests/Data/Notebooks/SimplePETSc/out.txt', returncode=0)
mesh_series = ot.MeshSeries(f"{out_dir}/{prj_name}.pvd").scale(time="a")(click to toggle)
mesh_series = ot.MeshSeries(f"{out_dir}/{prj_name}.pvd").scale(time="a")
points_coords = np.array([[0.3, 0.5, 0.0], [0.24, 0.21, 0.0]])
labels = [f"{label} linear interpolated" for label in ["pt0", "pt1"]]

ms_pts = ot.MeshSeries.probe(mesh_series, points_coords)
fig = ot.plot.line(
    ms_pts, "time", ot.variables.pressure, labels=labels, colors=["b", "r"]
)
/var/lib/gitlab-runner/builds/sy3_rc3xP/0/ogs/build/release-petsc/.venv/lib/python3.14/site-packages/ogstools/meshseries/_meshseries.py:112: RuntimeWarning: This is a parallel (pvtu) result, read natively (fast) instead of merged. This leaves ghost cells/boundary points duplicated, and integration-point data (e.g. '*_ip') may come from only one partition. Pass pvtu2vtu=True for a correctly merged mesh (slower), or pvtu2vtu=False to silence this warning.
  self._warn_pvtu_not_merged()

png


Community Discussion

The following comments are pulled in from our Discourse forum and contain community-generated content.


This article was written by Lars Bilke. If you are missing something or you find an error please reach out to us on our forum.
Generated with Hugo 0.164.0 in CI job 825193 | Last revision: November 9, 2021