[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 <ivanlei0@163.com>
This commit is contained in:
menxb 2025-07-06 13:36:29 +08:00 committed by GitHub
parent 8dee421bf2
commit 5ad6a40612
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 7 deletions

View File

@ -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