Skip to content
Snippets Groups Projects
Commit db25bf60 authored by Luca Tornatore's avatar Luca Tornatore
Browse files

update

parent 153e7982
No related branches found
No related tags found
No related merge requests found
...@@ -24,10 +24,12 @@ INC_DIR=../headers # ...@@ -24,10 +24,12 @@ INC_DIR=../headers #
# options that you need to compile # options that you need to compile
# #
#SYS=PAPI_LUMI_C
#SYS=PAPI_LEONARDO_DCGP #SYS=PAPI_LEONARDO_DCGP
SYS=PAPI_MYLAPTOP SYS=PAPI_MYLAPTOP
OPTS=" -std=c2x -DFILL=25 -D${SYS}"
# default generic options
OPTIONS_DFLT=" -std=c2x -DFILL=25 "
# specific options # specific options
# #
...@@ -35,18 +37,20 @@ ASSERT_OFF=" -DNDEBUG " ...@@ -35,18 +37,20 @@ ASSERT_OFF=" -DNDEBUG "
PAPI_OPT=" -DUSE_PAPI " PAPI_OPT=" -DUSE_PAPI "
PAPI_LIB=" -lpapi " PAPI_LIB=" -lpapi "
GCC_OPTS=" -O3 -march=native -mtune=native -ftree-vectorize -funroll-loops " declare -A OPTIMIZATIONS
ICX_OPTS=" -O3 -xHost -vec -axCORE-AVX2,CORE-AVX512 " OPTIMIZATIONS[gcc]=" -O3 -march=native -mtune=native -ftree-vectorize -funroll-loops "
OPTIMIZATIONS[icx]=" -O3 -xHost -vec -axCORE-AVX2,CORE-AVX512 "
OPTIMIZATIONS[cc]=" -O3 "
# variables that control the behaviour # variables that control the behaviour
# #
compiler=0 compiler=cc
gcc=1
icx=2
assert_on=0 assert_on=0
support_papi=0 support_papi=0
optimization_given="none"
options_given="none"
debug_option=
# #
# ================================================== # ==================================================
...@@ -54,26 +58,39 @@ support_papi=0 ...@@ -54,26 +58,39 @@ support_papi=0
# parse the arguments # parse the arguments
# #
CLOPTIONS="c:aph" CLOPTIONS="Cc:O:o:gaph"
if [[ $# -lt 1 ]]; then print_help; fi if [[ $# -lt 1 ]]; then print_help; fi
while getopts ${CLOPTIONS} opt; do while getopts ${CLOPTIONS} opt; do
case ${opt} in case ${opt} in
c) if [[ $OPTARG == [Gg][Cc][Cc] ]]; then
C) compiler=cc
echo "use generic compiler cc:"
cc --version
;;
c) lcarg=$( echo ${OPTARG} | tr "[:upper:]" "[:lower]" )
if [[ ${lcarg} == "gcc" ]]; then
echo "compile with gcc" echo "compile with gcc"
compiler=$gcc compiler="gcc"
elif [[ "$OPTARG" == [Ii][Cc][Xx] ]]; then elif [[ "${lcarg}" == "icx" ]]; then
echo "compile with icx" echo "compile with icx"
compiler=$icx compiler="icx"
else else
echo "unsupported compiler" echo "unknown compiler, use generic compiler cc:"
exit 1 cc --version
fi fi
;; ;;
g) OPTS="${OPTS} -g3 " O) optimization_given=${OPTARG}
;;
o) options_given=${OPTARG}
;;
g) debug_option=" -g3 "
;; ;;
a) assert_on=1 a) assert_on=1
...@@ -101,20 +118,31 @@ done ...@@ -101,20 +118,31 @@ done
# set-up things # set-up things
# #
if [ ${compiler} == ${gcc} ]; if [[ ${options_given} == "none" ]];
then
OPTIONS=${OPTIONS_DFLT}
else
OPTIONS=${options_given}
fi
if [[ ${optimization_given} == "none" ]];
then then
suffix=.gcc OPTIMIZATION=${OPTIMIZATIONS[${compiler}]}
OPTIMIZATION=${GCC_OPTS}
cc=gcc
else else
suffix=.icx OPTIMIZATION=${optimization_given}
OPTIMIZATION=${ICX_OPTS} fi
cc=icx
if [[ ${support_papi} == 1 ]]; then
OPTIONS="${OPTIONS} -D${SYS}"
fi fi
OPTIONS="${OPTIONS} ${debug_option}"
suffix=.${compiler}
if [[ ${assert_on} -eq 0 ]]; if [[ ${assert_on} -eq 0 ]];
then then
OPTS="${OPTS} ${ASSERT_OFF} " OPTIONS=${OPTIONS}" ${ASSERT_OFF} "
fi fi
if [[ ${support_papi} -eq 1 ]]; if [[ ${support_papi} -eq 1 ]];
...@@ -127,6 +155,11 @@ else ...@@ -127,6 +155,11 @@ else
ADD_PAPI_LIB="" ADD_PAPI_LIB=""
fi fi
echo "compiler's command line is: "
echo -I${INC_DIR} ${OPTIONS} ${OPTIMIZATION} ${ADD_PAPI_OPT} ${ADD_PAPI_LIB}
echo "source folder is " ${SRC_DIR}
# #
# =========================================== # ===========================================
# #
...@@ -134,8 +167,8 @@ fi ...@@ -134,8 +167,8 @@ fi
# #
${cc} ${OPTS} ${ADD_PAPI_OPT} -I${INC_DIR} ${OPTIMIZATION} -o ${X_DIR}/vect.1${suffix} ${SRC_DIR}/vect.1.c ${ADD_PAPI_LIB} 2> compile.log.out ${compiler} ${OPTIONS} ${ADD_PAPI_OPT} -I${INC_DIR} ${OPTIMIZATION} -o ${X_DIR}/vect.1${suffix} ${SRC_DIR}/vect.1.c ${ADD_PAPI_LIB} 2> compile.log.out
${cc} ${OPTS} ${ADD_PAPI_OPT} -I${INC_DIR} ${OPTIMIZATION} -o ${X_DIR}/vect.1b${suffix} ${SRC_DIR}/vect.1b.c -lm ${ADD_PAPI_LIB} 2>> compile.log.out ${compiler} ${OPTIONS} ${ADD_PAPI_OPT} -I${INC_DIR} ${OPTIMIZATION} -o ${X_DIR}/vect.1b${suffix} ${SRC_DIR}/vect.1b.c -lm ${ADD_PAPI_LIB} 2>> compile.log.out
${cc} ${OPTS} ${ADD_PAPI_OPT} -I${INC_DIR} ${OPTIMIZATION} -o ${X_DIR}/vect.2${suffix} ${SRC_DIR}/vect.2.c ${ADD_PAPI_LIB} 2>> compile.log.out ${compiler} ${OPTIONS} ${ADD_PAPI_OPT} -I${INC_DIR} ${OPTIMIZATION} -o ${X_DIR}/vect.2${suffix} ${SRC_DIR}/vect.2.c ${ADD_PAPI_LIB} 2>> compile.log.out
${cc} ${OPTS} ${ADD_PAPI_OPT} -I${INC_DIR} ${OPTIMIZATION} -o ${X_DIR}/vect.2b${suffix} ${SRC_DIR}/vect.2b.c -lm ${ADD_PAPI_LIB} 2>> compile.log.out ${compiler} ${OPTIONS} ${ADD_PAPI_OPT} -I${INC_DIR} ${OPTIMIZATION} -o ${X_DIR}/vect.2b${suffix} ${SRC_DIR}/vect.2b.c -lm ${ADD_PAPI_LIB} 2>> compile.log.out
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment