From be7d2d66e94df5d5eb1813d1e35fd5f3547cef32 Mon Sep 17 00:00:00 2001
From: Keith Valin <keith@mailtux.net>
Date: Mon, 31 Jul 2023 10:02:07 -0400
Subject: [PATCH] Fix bailing when one STREAM_ARRAY_SIZE does not compile (#29)

* Update to exit only when base_cache size could not be compiled, skip size otherwise
---
 streams/streams_extra/run_stream | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/streams/streams_extra/run_stream b/streams/streams_extra/run_stream
index 3e2c85d..7a03b7e 100755
--- a/streams/streams_extra/run_stream
+++ b/streams/streams_extra/run_stream
@@ -155,16 +155,22 @@ build_images()
 				fi
  			fi
 
-			if [[ $streams_exec == "" ]]; then
-				streams_exec=$stream
-			else
-				streams_exec=$streams_exec" "$stream
-			fi
-			echo gcc ${MOPT} -fopenmp  -mcmodel=large ${optim_opt} -DSTREAM_ARRAY_SIZE=${use_cache} stream_omp_5_10.c -o ${stream} -fno-pic >> streams_build_options
-			gcc ${MOPT} -fopenmp  -mcmodel=large ${optim_opt} -DSTREAM_ARRAY_SIZE=${use_cache} stream_omp_5_10.c -o ${stream} -fno-pic
+			CC_CMD="gcc ${MOPT} -fopenmp  -mcmodel=large ${optim_opt} -DSTREAM_ARRAY_SIZE=${use_cache} stream_omp_5_10.c -o ${stream} -fno-pic"
+			echo $CC_CMD >> streams_build_options
+			$CC_CMD
 			if [ $? -ne 0 ]; then
-				echo Compilation of streams failed.
-				exit 1
+				if [ -z "$streams_exec" ]; then
+					echo Compilation of streams failed.
+					exit 1
+				else
+					echo Could not compile streams with $use_cache size, skipping
+				fi
+			else
+				if [[ $streams_exec == "" ]]; then
+					streams_exec=$stream
+				else
+					streams_exec=$streams_exec" "$stream
+				fi
 			fi
 
 			use_cache=`echo ${base_cache_size}*1024*${multiple_size} | bc`