xref: /libCEED/benchmarks/petsc-bps.sh (revision 7b3ff0698626cc2e5ce463afc10290072fd55c90)
1# Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and other CEED contributors.
2# All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3#
4# SPDX-License-Identifier: BSD-2-Clause
5#
6# This file is part of CEED:  http://github.com/ceed
7function run_tests()
8{
9   $dry_run cd "$test_exe_dir"
10
11   # Some of the available options are:
12   # -degree <1>: Polynomial degree of tensor product basis
13   # -q_extra <1>: Number of extra quadrature points
14   # -ceed </cpu/self>: CEED resource specifier
15   # -local_nodes <1000>: Target number of locally (per rank) owned nodes
16
17   # The variables 'max_dofs_node', and 'max_p' can be set on the command line
18   # invoking the 'benchmark.sh' script.
19   local ceed="${ceed:-/cpu/self}"
20   local common_args=(-ceed $ceed -pc_type none -benchmark)
21   local max_dofs_node_def=$((3*2**20))
22   local max_dofs_node=${max_dofs_node:-$max_dofs_node_def}
23   local max_loc_nodes=$((max_dofs_node/num_proc_node))
24   local max_p=${max_p:-8}
25   local sol_p=
26   for ((sol_p = 1; sol_p <= max_p; sol_p++)); do
27      local loc_el=
28      for ((loc_el = 1; loc_el*sol_p**3 <= max_loc_nodes; loc_el = 2*loc_el)); do
29         local loc_nodes=$((loc_el*sol_p**3))
30         local all_args=("${common_args[@]}" -degree $sol_p -local_nodes $loc_nodes -problem $bp)
31         if [ -z "$dry_run" ]; then
32            echo
33            echo "Running test:"
34            quoted_echo $mpi_run ./petsc-bps "${all_args[@]}"
35            $mpi_run ./petsc-bps "${all_args[@]}" || \
36               printf "\nError in the test, error code: $?\n\n"
37         else
38            $dry_run $mpi_run ./petsc-bps "${all_args[@]}"
39         fi
40      done
41   done
42}
43
44test_required_examples="petsc-bps"
45