From 5ad6a40612e9594d98d80a0b3cde66018f48b492 Mon Sep 17 00:00:00 2001 From: menxb <121934997+menxb@users.noreply.github.com> Date: Sun, 6 Jul 2025 13:36:29 +0800 Subject: [PATCH] [VENTUS][fix] Automatically process the generated files and prevent the test files from being overwritten (#182) * Modify the build-ventus.sh script to automatically delete the build and other files and generate the test_pocl folder. * Add a judgment parameter to differentiate between full and incremental compilation modes and improve code quality simultaneously. --------- Co-authored-by: ivan lei --- build-ventus.sh | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/build-ventus.sh b/build-ventus.sh index e9fedf34f8c2..65b4662f8b85 100755 --- a/build-ventus.sh +++ b/build-ventus.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash - +ORIG_ARGC=$# DIR=$(cd "$(dirname "${0}")" &> /dev/null && (pwd -W 2> /dev/null || pwd)) VENTUS_BUILD_DIR=${DIR}/build LIBCLC_BUILD_DIR=${DIR}/build-libclc @@ -174,9 +174,10 @@ build_pocl() { # Build libclc for pocl build_libclc() { - if [ ! -d "${LIBCLC_BUILD_DIR}" ]; then - mkdir ${LIBCLC_BUILD_DIR} + if [ -d "${LIBCLC_BUILD_DIR}" ]; then + rm -rf "${LIBCLC_BUILD_DIR}" fi + mkdir "${LIBCLC_BUILD_DIR}" cd ${LIBCLC_BUILD_DIR} cmake -G Ninja -B ${LIBCLC_BUILD_DIR} ${DIR}/libclc \ -DCMAKE_CLC_COMPILER=clang \ @@ -220,9 +221,14 @@ test_rodinia() { # TODO : More test cases of the pocl will be added test_pocl() { - cd ${POCL_BUILD_DIR}/examples - ./vecadd/vecadd - ./matadd/matadd + cd "${POCL_BUILD_DIR}/examples/vecadd" + mkdir -p test_vecadd + cd test_vecadd + ../vecadd + cd "${POCL_BUILD_DIR}/examples/matadd" + mkdir -p test_matadd + cd test_matadd + ../matadd } # Export needed path and enviroment variables @@ -270,7 +276,17 @@ check_if_ocl_icd_built() { fi } -# Process build options +#In full compilation mode +if [ "$ORIG_ARGC" -eq 0 ]; then + for dir in "${VENTUS_BUILD_DIR}" "${LIBCLC_BUILD_DIR}" "${POCL_BUILD_DIR}" "${DRIVER_BUILD_DIR}" "${SPIKE_BUILD_DIR}" "${OCL_ICD_BUILD_DIR}" "${VENTUS_INSTALL_PREFIX}"; do + if [ -d "$dir" ]; then + rm -rf "$dir" + fi + mkdir -p "$dir" + done +fi + +#In incremental compilation mode, process build options for program in "${PROGRAMS_TOBUILD[@]}" do if [ "${program}" == "llvm" ];then