From 96de53d3969f72c7fcdb9677f1ec5bfc2e81a62c Mon Sep 17 00:00:00 2001
From: Simone Bna <s.bn@cineca.it>
Date: Fri, 15 Jan 2021 16:42:01 +0100
Subject: [PATCH] BUG #4: workaround for having CUDA 10 compiler working with
 gcc8

---
 src/catalyst/CMakeLists.txt              | 9 +++++++++
 src/runTimePostProcessing/CMakeLists.txt | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/src/catalyst/CMakeLists.txt b/src/catalyst/CMakeLists.txt
index b68d348..13fe67e 100644
--- a/src/catalyst/CMakeLists.txt
+++ b/src/catalyst/CMakeLists.txt
@@ -12,6 +12,15 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
         "In-source builds disallowed. Use a separate build directory")
 endif()
 
+# workaround to fix a problem with GCC and CUDA 10, fixed in CUDA 11
+# see https://github.com/LLNL/blt/issues/341
+# an alternative is to add: -Xcompiler=-mno-float128
+if ( (CMAKE_CXX_COMPILER_ID MATCHES GNU) AND (CMAKE_SYSTEM_PROCESSOR MATCHES ppc64le) )
+  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
+    set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -std=c++11")
+  endif()
+endif()
+
 #------------------------------------------------------------------------------
 # Simple discovery and sanity checks
 
diff --git a/src/runTimePostProcessing/CMakeLists.txt b/src/runTimePostProcessing/CMakeLists.txt
index fd5d3a1..3d2de56 100644
--- a/src/runTimePostProcessing/CMakeLists.txt
+++ b/src/runTimePostProcessing/CMakeLists.txt
@@ -12,6 +12,15 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
         "In-source builds disallowed. Use a separate build directory")
 endif()
 
+# workaround to fix a problem with GCC and CUDA 10, fixed in CUDA 11
+# see https://github.com/LLNL/blt/issues/341
+# an alternative is to add: -Xcompiler=-mno-float128
+if ( (CMAKE_CXX_COMPILER_ID MATCHES GNU) AND (CMAKE_SYSTEM_PROCESSOR MATCHES ppc64le) )
+  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
+    set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -std=c++11")
+  endif()
+endif()
+
 #-----------------------------------------------------------------------------
 # Simple discovery and sanity checks
 
-- 
GitLab