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