diff --git a/.github/workflows/main_cpp.yml b/.github/workflows/main_cpp.yml index 442cdd7acb..82e9fd97d5 100644 --- a/.github/workflows/main_cpp.yml +++ b/.github/workflows/main_cpp.yml @@ -22,11 +22,13 @@ jobs: with: python-version: 3.11 - - name: Install Cmake, Make, g++, MKL + - name: Install Cmake, Make, g++, MKL, OpenCV run: | sudo apt update && sudo apt upgrade sudo apt install cmake g++ make sudo apt-get -y install intel-mkl + sudo apt -y install libtbb-dev + sudo apt install libopencv-dev - name: Run Cpp Tests run: | chmod +x ./run_cpp_examples.sh diff --git a/run_cpp_examples.sh b/run_cpp_examples.sh index 3aed67d023..45f1c4a92d 100644 --- a/run_cpp_examples.sh +++ b/run_cpp_examples.sh @@ -55,6 +55,31 @@ function autograd() { fi } +function custom-dataset() { + start + # Download the dataset and unzip it + if [ ! -d "$BASE_DIR/cpp/$EXAMPLE/dataset" ]; then + wget https://data.caltech.edu/records/mzrjq-6wc02/files/caltech-101.zip + unzip caltech-101.zip + cd caltech-101 + tar -xzf 101_ObjectCategories.tar.gz + mv 101_ObjectCategories $BASE_DIR/cpp/$EXAMPLE/dataset + fi + # build the executable and run it + cd $BASE_DIR/cpp/$EXAMPLE + mkdir build + cd build + cmake -DCMAKE_PREFIX_PATH=$LIBTORCH_PATH -DOpenCV_DIR=/usr/local/bin .. + make + if [ $? -eq 0 ]; then + echo "Successfully built $EXAMPLE" + ./$EXAMPLE # Run the executable + else + error "Failed to build $EXAMPLE" + exit 1 + fi +} + function clean() { cd $BASE_DIR echo "Running clean to remove cruft" @@ -62,11 +87,13 @@ function clean() { find . -type d -name 'build' -exec rm -rf {} + # Remove the libtorch directory rm -rf $HOME_DIR/libtorch + rm -f libtorch-shared-with-deps-latest.zip echo "Clean completed" } function run_all() { - autograd + # autograd + custom-dataset } # by default, run all examples