acc is now built with cmake instead of the old build script. This was mainly done to fix compilation on Puhti where I had problems linking flex even though it is available. As an added bonus the code is now safer to build since all dependencies are now rigorously tracked by cmake and make, and f.ex. change in the compiler now forces also the whole library to be rebuilt (which is the behaviour we want)

This commit is contained in:
jpekkila
2019-09-24 16:57:19 +03:00
parent a91da8388c
commit 72af2cf31d
5 changed files with 38 additions and 16 deletions

View File

@@ -1,16 +1,16 @@
#!/bin/bash
# Usage ./compile <source file> <gcc preprocessor flags, f.ex. -I some/path>
# Usage ./compile <acc binary> <source file> <gcc preprocessor flags, f.ex. -I some/path>
ACC_DIR=`dirname $0`
ACC_BINARY=$1
FULL_NAME=$(basename -- $1)
FULL_NAME=$(basename -- $2)
FILENAME="${FULL_NAME%.*}"
EXTENSION="${FULL_NAME##*.}"
if [ "${EXTENSION}" = "sas" ]; then
COMPILE_FLAGS="-sas" # Generate stencil assembly stage
CUH_FILENAME="stencil_assembly.cuh"
echo "-- Generating stencil assembly stage: ${FILENAME}.sas -> ${CUH_FILENAME}"
echo "-- Generating stencil assembly stage: ${FILENAME}.sas -> ${CUH_FILENAME}"
elif [ "${EXTENSION}" = "sps" ]; then
COMPILE_FLAGS="-sps" # Generate stencil processing stage
CUH_FILENAME="stencil_process.cuh"
@@ -18,11 +18,11 @@ elif [ "${EXTENSION}" = "sps" ]; then
elif [ "${EXTENSION}" = "sdh" ]; then
COMPILE_FLAGS="-sdh" # Generate stencil definition header
CUH_FILENAME="stencil_defines.h"
echo "-- Generating stencil definition header: ${FILENAME}.sdh -> ${CUH_FILENAME}"
echo "-- Generating stencil definition header: ${FILENAME}.sdh -> ${CUH_FILENAME}"
else
echo "-- Error: unknown extension" ${EXTENSION} "of file" ${FULL_NAME}
echo "-- Extension should be either .sas, .sps or .sdh"
exit
fi
${ACC_DIR}/preprocess.sh $@ | ${ACC_DIR}/build/acc ${COMPILE_FLAGS} > ${CUH_FILENAME}
${ACC_DIR}/preprocess.sh ${@:2} | ${ACC_BINARY} ${COMPILE_FLAGS} > ${CUH_FILENAME}