You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.3 KiB
45 lines
1.3 KiB
#!/bin/bash
|
|
|
|
export CUDA_HOME=/usr/local/cuda-11.8
|
|
export PATH=${CUDA_HOME}/bin:${PATH}
|
|
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
|
|
|
|
# Set the number of test samples (default: 100, but can be reduced for faster testing)
|
|
NUM_SAMPLES=3
|
|
if [ "$1" != "" ]; then
|
|
NUM_SAMPLES=$1
|
|
fi
|
|
|
|
# Control the number of samples to test (e.g., set to 1 for quick testing)
|
|
# MAX_SAMPLES=3
|
|
MAX_SAMPLES=1
|
|
# MAX_SAMPLES=-1 # To run on all samples
|
|
|
|
echo "Running tests with $NUM_SAMPLES samples..."
|
|
|
|
# Get the directory of this script
|
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
|
PROJECT_DIR=$(dirname "$SCRIPT_DIR")
|
|
cd "$PROJECT_DIR"
|
|
|
|
# Make sure the build directory exists
|
|
mkdir -p build
|
|
|
|
# Build the C++ code
|
|
cd build
|
|
echo "Building C++ code..."
|
|
cmake ..
|
|
make -j$(nproc)
|
|
|
|
# Run the C++ test program to generate samples and outputs
|
|
echo "Running C++ tests..."
|
|
./test_models ../test/input_samples ../test/output $NUM_SAMPLES
|
|
|
|
# Run the Python comparison script
|
|
cd "$PROJECT_DIR"
|
|
echo "Running Python comparison..."
|
|
python_compare_script="compare_models.py"
|
|
# python3 "${SCRIPT_DIR}/${python_compare_script}" --num-samples ${NUM_SAMPLES}
|
|
python3 "${SCRIPT_DIR}/${python_compare_script}" --num_samples ${NUM_SAMPLES}
|
|
|
|
echo "Tests complete! View results in test/comparison/report.html"
|