From d48f6900387416b4ac5bc1fc6e8c4548b3012eae Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Tue, 8 May 2018 11:29:02 +0200
Subject: [PATCH] Add an option to allow turning off vectorization of jacobians

They are only to a lesser extent important for our HPC applications
and the vectorization algorithm struggles with the complexity of the
search space.
---
 python/dune/perftool/options.py               | 1 +
 python/dune/perftool/sumfact/vectorization.py | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py
index 1ecc85c5..8e195b16 100644
--- a/python/dune/perftool/options.py
+++ b/python/dune/perftool/options.py
@@ -85,6 +85,7 @@ class PerftoolFormOptionsArray(ImmutableRecord):
     vectorization_padding = PerftoolOption(default=None, helpstr="an explicit value for the allowed padding in vectorization")
     vectorization_allow_quadrature_changes = PerftoolOption(default=False, helpstr="whether the vectorization strategy is allowed to alter quadrature point numbers")
     vectorization_list_index = PerftoolOption(default=None, helpstr="Which vectorization to pick from a list (only valid with vectorization_strategy=fromlist).")
+    vectorization_jacobians = PerftoolOption(default=False, helpstr="Whether to attempt to vectorize jacobians (takes time, often not needed)")
     simplify = PerftoolOption(default=False, helpstr="Whether to simplify expressions using sympy")
     generate_jacobians = PerftoolOption(default=True, helpstr="Whether jacobian_* methods should be generated. This is set to false automatically, when numerical_jacobian is set to true.")
     generate_residuals = PerftoolOption(default=True, helpstr="Whether alpha_* methods should be generated.")
diff --git a/python/dune/perftool/sumfact/vectorization.py b/python/dune/perftool/sumfact/vectorization.py
index 6f25e3c6..78822934 100644
--- a/python/dune/perftool/sumfact/vectorization.py
+++ b/python/dune/perftool/sumfact/vectorization.py
@@ -151,7 +151,7 @@ def decide_vectorization_strategy():
     active_sumfacts = [i for i in all_sumfacts if i.stage == 3 or i in basis_sumfacts]
 
     # If no vectorization is needed, abort now
-    if get_form_option("vectorization_strategy") == "none":
+    if get_form_option("vectorization_strategy") == "none" or (get_global_context_value("form_type") == "jacobian" and not get_form_option("vectorization_jacobians")):
         for sf in all_sumfacts:
             _cache_vectorization_info(sf, sf.copy(buffer=get_counted_variable("buffer")))
         return
-- 
GitLab