From fbe852506771a70abf612d2738acfa5ef5391ea5 Mon Sep 17 00:00:00 2001 From: "George G. Vega Yon" Date: Tue, 30 Jan 2024 21:30:35 -0700 Subject: [PATCH] Adding openmp optional --- .github/workflows/ci.yml | 4 ++-- examples/Makefile | 2 +- tests/00-cloning-model-saves/README.md | 1 - tests/00-lfmcmc-saves/README.md | 1 - tests/01-queue-saves/README.md | 1 - tests/01-sample-saves/README.md | 1 - tests/01-sir-saves/README.md | 1 - tests/01-sirconnected-saves/README.md | 1 - tests/01b-sir-saves/README.md | 1 - tests/01c-sir-saves/README.md | 1 - tests/02-reproducible-sir-saves/README.md | 1 - tests/02-reproducible-sirconn-saves/README.md | 1 - tests/03-sis-saves/README.md | 1 - tests/04-initial-dist-saves/README.md | 1 - tests/Makefile | 10 +++++----- tests/main-saves/README.md | 1 - tests/tests.hpp | 4 +++- 17 files changed, 11 insertions(+), 22 deletions(-) delete mode 100644 tests/00-cloning-model-saves/README.md delete mode 100644 tests/00-lfmcmc-saves/README.md delete mode 100644 tests/01-queue-saves/README.md delete mode 100644 tests/01-sample-saves/README.md delete mode 100644 tests/01-sir-saves/README.md delete mode 100644 tests/01-sirconnected-saves/README.md delete mode 100644 tests/01b-sir-saves/README.md delete mode 100644 tests/01c-sir-saves/README.md delete mode 100644 tests/02-reproducible-sir-saves/README.md delete mode 100644 tests/02-reproducible-sirconn-saves/README.md delete mode 100644 tests/03-sis-saves/README.md delete mode 100644 tests/04-initial-dist-saves/README.md delete mode 100644 tests/main-saves/README.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5e0c9f1e..672a44825 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: Check run: | docker run --rm -i -v ${PWD}:/home/tests -w /home/tests ${cntr} \ - make all-examples + OPENMP=-fopenmp make all-examples test-macos: runs-on: macos-latest @@ -50,7 +50,7 @@ jobs: - name: Check run: | - cd tests && make main.o && ./main.o + cd tests && OPENMP=-fopenmp make main.o && ./main.o # cd tests && make 01c.o && valgrind --leak-check=full ./01c.o diff --git a/examples/Makefile b/examples/Makefile index d22c88ba4..e9ec42df2 100755 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,5 +1,5 @@ VPATH = ../include/epiworld -CPPFLAGS= -std=c++11 -Wall -pedantic -g -O2 -ftree-vectorize # -fopenmp +CPPFLAGS= -std=c++11 -Wall -pedantic -g -O2 -ftree-vectorize $(OPENMP) GPP=g++ # icpx take a look at ~/.profile # # /opt/intel/oneapi/setvars.sh diff --git a/tests/00-cloning-model-saves/README.md b/tests/00-cloning-model-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/00-cloning-model-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/00-lfmcmc-saves/README.md b/tests/00-lfmcmc-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/00-lfmcmc-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/01-queue-saves/README.md b/tests/01-queue-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/01-queue-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/01-sample-saves/README.md b/tests/01-sample-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/01-sample-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/01-sir-saves/README.md b/tests/01-sir-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/01-sir-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/01-sirconnected-saves/README.md b/tests/01-sirconnected-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/01-sirconnected-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/01b-sir-saves/README.md b/tests/01b-sir-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/01b-sir-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/01c-sir-saves/README.md b/tests/01c-sir-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/01c-sir-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/02-reproducible-sir-saves/README.md b/tests/02-reproducible-sir-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/02-reproducible-sir-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/02-reproducible-sirconn-saves/README.md b/tests/02-reproducible-sirconn-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/02-reproducible-sirconn-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/03-sis-saves/README.md b/tests/03-sis-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/03-sis-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/04-initial-dist-saves/README.md b/tests/04-initial-dist-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/04-initial-dist-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/Makefile b/tests/Makefile index 344658e29..8cf21ee26 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,20 +1,20 @@ all: main.o main.o: main.cpp clean - g++ -std=c++14 -Wunused -Wall -Wextra -Wnull-dereference -fdelete-null-pointer-checks -O2 -fopenmp -g -pedantic main.cpp -o main.o + g++ -std=c++14 -Wunused -Wall -Wextra -Wnull-dereference -fdelete-null-pointer-checks -O2 $(OPENMP) -g -pedantic main.cpp -o main.o main.a: main.cpp clean - clang++ -std=c++14 -Wall -Wextra -fopenmp -Wpedantic -O2 main.cpp -o main.a + clang++ -std=c++14 -Wall -Wextra $(OPENMP) -Wpedantic -O2 main.cpp -o main.a # Compile 02-reproducible-sirconn.cpp 02-reproducible-sirconn.o: 02-reproducible-sirconn.cpp - g++ -std=c++14 -Wall -Wextra -O2 -g -fopenmp -pedantic 02-reproducible-sirconn.cpp -o 02-reproducible-sirconn.o + g++ -std=c++14 -Wall -Wextra -O2 -g $(OPENMP) -pedantic 02-reproducible-sirconn.cpp -o 02-reproducible-sirconn.o 02.o: 02-reproducible.cpp - g++ -std=c++14 -Wall -Wextra -O2 -g -fopenmp -pedantic 02-reproducible.cpp -o 02.o + g++ -std=c++14 -Wall -Wextra -O2 -g $(OPENMP) -pedantic 02-reproducible.cpp -o 02.o 01c.o: 01c-sir.cpp - g++ -std=c++14 -Wall -Wextra -O2 -g -fopenmp -pedantic 01c-sir.cpp -o 01c.o + g++ -std=c++14 -Wall -Wextra -O2 -g $(OPENMP) -pedantic 01c-sir.cpp -o 01c.o # Check coverage using the main.o target coverage: main.o diff --git a/tests/main-saves/README.md b/tests/main-saves/README.md deleted file mode 100644 index 2d50a84ea..000000000 --- a/tests/main-saves/README.md +++ /dev/null @@ -1 +0,0 @@ -# Dummy \ No newline at end of file diff --git a/tests/tests.hpp b/tests/tests.hpp index 303759ff5..dde5d1536 100644 --- a/tests/tests.hpp +++ b/tests/tests.hpp @@ -6,7 +6,9 @@ #include #include #include -#include +#if defined(_OPENMP) + #include +#endif #include "../include/epiworld/epiworld.hpp" template