From 2712293e9f4d223aaa3c7d9a974f1c83fcc13ae9 Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Tue, 16 Apr 2019 09:12:00 +0200
Subject: [PATCH] pystencils_walberla: graceful fallback when cpuinfo is not
 installed

---
 pystencils_walberla/codegen.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pystencils_walberla/codegen.py b/pystencils_walberla/codegen.py
index 4d7612d..fbe5db3 100644
--- a/pystencils_walberla/codegen.py
+++ b/pystencils_walberla/codegen.py
@@ -191,7 +191,11 @@ def default_create_kernel_parameters(generation_context, params):
     default_dtype = "float64" if generation_context.double_accuracy else 'float32'
 
     if generation_context.optimize_for_localhost:
-        default_vec_is = get_supported_instruction_sets()[-1]
+        supported_instruction_sets = get_supported_instruction_sets()
+        if supported_instruction_sets:
+            default_vec_is = get_supported_instruction_sets()[-1]
+        else:  # if cpuinfo package is not installed
+            default_vec_is = 'sse'
     else:
         default_vec_is = None
 
-- 
GitLab