From a68e5d03887041ec0a6babb0375787d61f532636 Mon Sep 17 00:00:00 2001 From: Sophia Vorderwuelbecke Date: Sun, 10 Jul 2022 13:03:11 +0200 Subject: [PATCH 1/3] Drop before merge: pyop2 branch --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index edc5d9e474..6f8eed1df1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - name: Build Firedrake run: | cd .. - ./firedrake/scripts/firedrake-install $COMPLEX --venv-name build --tinyasm --disable-ssh --minimal-petsc --slepc --documentation-dependencies --install thetis --install gusto --install icepack --install irksome --install femlium --no-package-manager|| (cat firedrake-install.log && /bin/false) + ./firedrake/scripts/firedrake-install $COMPLEX --venv-name build --tinyasm --disable-ssh --minimal-petsc --slepc --documentation-dependencies --install thetis --install gusto --install icepack --install irksome --install femlium --no-package-manager --package-branch PyOP2 sv/fix-flop-count --package-branch loopy stats_c_instructions|| (cat firedrake-install.log && /bin/false) - name: Install test dependencies run: | . ../build/bin/activate @@ -58,6 +58,7 @@ jobs: . ../build/bin/activate echo OMP_NUM_THREADS is $OMP_NUM_THREADS echo OPENBLAS_NUM_THREADS is $OPENBLAS_NUM_THREADS + export PYOP2_COMPUTE_KERNEL_FLOPS=1 python -m pytest --durations=200 -n 12 --cov firedrake --timeout=1800 -v tests - name: Test pyadjoint if: ${{ matrix.scalar-type == 'real' }} From c6818dab1fbe915bce6961652f3a7d82de72788b Mon Sep 17 00:00:00 2001 From: Sophia Vorderwuelbecke Date: Mon, 11 Jul 2022 13:37:13 +0200 Subject: [PATCH 2/3] Slate testing: add a test that checks if Firedrake breaks if logging the flops is turned on. --- tests/slate/test_local_logging.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/slate/test_local_logging.py b/tests/slate/test_local_logging.py index ca48fe7424..3fea61a2a2 100644 --- a/tests/slate/test_local_logging.py +++ b/tests/slate/test_local_logging.py @@ -1,9 +1,19 @@ import os -def test_slate_logging(): +def test_slate_logging_flame(): """This only checks that logging does not break Firedrake, it does not check for correctness.""" path = os.path.dirname(os.path.abspath(__file__)) pyop2_cache = os.environ['PYOP2_CACHE_DIR'] err = os.system(f'python {path}/script_logging.py -log_view :{pyop2_cache}/test.txt:ascii_flamegraph') assert err == 0 + + +def test_slate_logging_flops(): + """This only checks that flop counting does not break Firedrake, it does not check for correctness.""" + path = os.path.dirname(os.path.abspath(__file__)) + pyop2_cache = os.environ['PYOP2_CACHE_DIR'] + os.system('export PYOP2_COMPUTE_KERNEL_FLOPS=1') + err = os.system(f'python {path}/script_logging.py -log_view :{pyop2_cache}/test.txt') + assert err == 0 + os.system('export PYOP2_COMPUTE_KERNEL_FLOPS=0') From 8edd78b312a0827eb925659387e2b69be825b3cb Mon Sep 17 00:00:00 2001 From: Sophia Vorderwuelbecke Date: Mon, 18 Jul 2022 16:05:02 +0200 Subject: [PATCH 3/3] Add insn_count_subgroups_upper_bound warning in all our Loo.py kernel generation functions. --- firedrake/extrusion_utils.py | 3 ++- firedrake/parloops.py | 3 ++- firedrake/slate/slac/utils.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/firedrake/extrusion_utils.py b/firedrake/extrusion_utils.py index 269eeb2e24..743eae8f4f 100644 --- a/firedrake/extrusion_utils.py +++ b/firedrake/extrusion_utils.py @@ -219,7 +219,8 @@ def _get_lp_domains(_inames, _extents): raise NotImplementedError('Unsupported extrusion type "%s"' % extrusion_type) ast = lp.make_function(domains, instructions, data, name=name, target=target, - seq_dependencies=True, silenced_warnings=["summing_if_branches_ops"]) + seq_dependencies=True, silenced_warnings=["summing_if_branches_ops", + "insn_count_subgroups_upper_bound"]) kernel = op2.Kernel(ast, name) op2.ParLoop(kernel, ext_coords.cell_set, diff --git a/firedrake/parloops.py b/firedrake/parloops.py index c3d4cffe74..a1c700f3dc 100644 --- a/firedrake/parloops.py +++ b/firedrake/parloops.py @@ -129,7 +129,8 @@ def _form_loopy_kernel(kernel_domains, instructions, measure, args, **kwargs): except KeyError: kargs.append(...) knl = loopy.make_function(kernel_domains, instructions, kargs, name="par_loop_kernel", target=target, - seq_dependencies=True, silenced_warnings=["summing_if_branches_ops"]) + seq_dependencies=True, silenced_warnings=["summing_if_branches_ops", + "insn_count_subgroups_upper_bound"]) knl = op2.Kernel(knl, "par_loop_kernel", **kwargs) if kernel_cache is not None: return kernel_cache.setdefault(key, knl) diff --git a/firedrake/slate/slac/utils.py b/firedrake/slate/slac/utils.py index 8f309d6248..855630eff6 100644 --- a/firedrake/slate/slac/utils.py +++ b/firedrake/slate/slac/utils.py @@ -354,7 +354,8 @@ def merge_loopy(slate_loopy, output_arg, builder, var2terminal, name): preamble = preamble_init+preamble if preamble else [] slate_wrapper = lp.make_function(domains, insns, loopy_args, name=name, seq_dependencies=True, target=target, - lang_version=(2018, 2), preambles=preamble) + lang_version=(2018, 2), preambles=preamble, + silenced_warnings=["insn_count_subgroups_upper_bound"]) # Generate program from kernel, so that one can register kernels from pyop2.codegen.loopycompat import _match_caller_callee_argument_dimension_