From 2ab4d61cd4b632c0e991c781f3c15f3b054d1bbd Mon Sep 17 00:00:00 2001 From: eschnett Date: Mon, 6 Jun 2011 10:11:44 +0000 Subject: Introduce Cactus options for vectorisation Introduce configuration-time options for vectorisation, including options to allow architecture-specific choices that may influence performance. Introduce "middle" masked stores for large vector sizes and small loops. Clean up and simplify some of the implementation code. git-svn-id: https://svn.cct.lsu.edu/repos/numrel/LSUThorns/Vectors/trunk@10 105869f7-3296-0410-a4ea-f4349344b45a --- configure.sh | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 configure.sh (limited to 'configure.sh') diff --git a/configure.sh b/configure.sh new file mode 100644 index 0000000..85a6e26 --- /dev/null +++ b/configure.sh @@ -0,0 +1,123 @@ +#! /bin/bash + +# Set up shell +set -x # Output commands +set -e # Abort on errors + + + +################################################################################ +# Examine settings +################################################################################ + + + +case $(echo "x$VECTORISE" | tr '[:upper:]' '[:lower:]') in + (xyes) VECTORISE=1 ;; + (xno) VECTORISE=0 ;; + (x) VECTORISE=0 ;; # default + (*) echo "BEGIN ERROR" + echo "Illegal value of option VECTORISE" + echo "END ERROR" + exit 1;; +esac + +# Disable vectorisation when optimisation is disabled. (The +# vectorisation macros depend on optimisation for efficient code; +# without optimisation, the code is most likely much slower than +# usual.) +case $(echo "x$OPTIMISE" | tr '[:upper:]' '[:lower:]') in + (xyes) ;; # do nothing + (xno) VECTORISE=0 ;; # disable vectorisation + (*) echo "BEGIN ERROR" + echo "Illegal value of option CCTK_OPTIMISE_MODE" + echo "END ERROR" + exit 1 +esac + +case $(echo "x$VECTORISE_ALIGNED_ARRAYS" | tr '[:upper:]' '[:lower:]') in + (xyes) VECTORISE_ALIGNED_ARRAYS=1 ;; + (xno) VECTORISE_ALIGNED_ARRAYS=0 ;; + (x) VECTORISE_ALIGNED_ARRAYS=0 ;; # default + (*) echo "BEGIN ERROR" + echo "Illegal value of option VECTORISE_ALIGNED_ARRAYS" + echo "END ERROR" + exit 1 +esac + +case $(echo "x$VECTORISE_ALWAYS_USE_UNALIGNED_LOADS" | tr '[:upper:]' '[:lower:]') in + (xyes) VECTORISE_ALWAYS_USE_UNALIGNED_LOADS=1 ;; + (xno) VECTORISE_ALWAYS_USE_UNALIGNED_LOADS=0 ;; + (x) VECTORISE_ALWAYS_USE_UNALIGNED_LOADS=0 ;; # default + (*) echo "BEGIN ERROR" + echo "Illegal value of option VECTORISE_ALWAYS_USE_UNALIGNED_LOADS" + echo "END ERROR" + exit 1 +esac + +case $(echo "x$VECTORISE_ALWAYS_USE_ALIGNED_LOADS" | tr '[:upper:]' '[:lower:]') in + (xyes) VECTORISE_ALWAYS_USE_ALIGNED_LOADS=1 ;; + (xno) VECTORISE_ALWAYS_USE_ALIGNED_LOADS=0 ;; + (x) VECTORISE_ALWAYS_USE_ALIGNED_LOADS=0 ;; # default + (*) echo "BEGIN ERROR" + echo "Illegal value of option VECTORISE_ALWAYS_USE_ALIGNED_LOADS" + echo "END ERROR" + exit 1 +esac + +case $(echo "x$VECTORISE_STREAMING_STORES" | tr '[:upper:]' '[:lower:]') in + (xyes) VECTORISE_STREAMING_STORES=1 ;; + (xno) VECTORISE_STREAMING_STORES=0 ;; + (x) VECTORISE_STREAMING_STORES=1 ;; # default + (*) echo "BEGIN ERROR" + echo "Illegal value of option VECTORISE_STREAMING_STORES" + echo "END ERROR" + exit 1 +esac + +case $(echo "x$VECTORISE_INLINE" | tr '[:upper:]' '[:lower:]') in + (xyes) VECTORISE_INLINE=1 ;; + (xno) VECTORISE_INLINE=0 ;; + (x) VECTORISE_INLINE=1 ;; # default + (*) echo "BEGIN ERROR" + echo "Illegal value of option VECTORISE_INLINE" + echo "END ERROR" + exit 1 +esac + +case $(echo "x$VECTORISE_EMULATE_AVX" | tr '[:upper:]' '[:lower:]') in + (xyes) VECTORISE_EMULATE_AVX=1 ;; + (xno) VECTORISE_EMULATE_AVX=0 ;; + (x) VECTORISE_EMULATE_AVX=0 ;; # default + (*) echo "BEGIN ERROR" + echo "Illegal value of option VECTORISE_EMULATE_AVX" + echo "END ERROR" + exit 1 +esac + + + +################################################################################ +# Configure Cactus +################################################################################ + +# Pass options to Cactus +echo "BEGIN DEFINE" +echo "VECTORISE $VECTORISE" +echo "VECTORISE_ALIGNED_ARRAYS $VECTORISE_ALIGNED_ARRAYS" +echo "VECTORISE_ALWAYS_USE_UNALIGNED_LOADS $VECTORISE_ALWAYS_USE_UNALIGNED_LOADS" +echo "VECTORISE_ALWAYS_USE_ALIGNED_LOADS $VECTORISE_ALWAYS_USE_ALIGNED_LOADS" +echo "VECTORISE_INLINE $VECTORISE_INLINE" +echo "VECTORISE_STREAMING_STORES $VECTORISE_STREAMING_STORES" +echo "VECTORISE_EMULATE_AVX $VECTORISE_EMULATE_AVX" +echo "END DEFINE" + +echo "BEGIN MAKE_DEFINITION" +echo "VECTORISE = $VECTORISE" +echo "VECTORISE_ALIGNED_ARRAYS = $VECTORISE_ALIGNED_ARRAYS" +echo "VECTORISE_ALWAYS_USE_UNALIGNED_LOADS = $VECTORISE_ALWAYS_USE_UNALIGNED_LOADS" +echo "VECTORISE_ALWAYS_USE_ALIGNED_LOADS = $VECTORISE_ALWAYS_USE_ALIGNED_LOADS" +echo "VECTORISE_INLINE = $VECTORISE_INLINE" +echo "VECTORISE_STREAMING_STORES = $VECTORISE_STREAMING_STORES" +echo "VECTORISE_EMULATE_AVX = $VECTORISE_EMULATE_AVX" +echo "END MAKE_DEFINITION" -- cgit v1.2.3