csci5451/assignments/01/Makefile

67 lines
2.2 KiB
Makefile
Raw Normal View History

2023-10-09 09:17:14 +00:00
.PHONY: all handin watch-openmp watch-report rust clean
2023-09-23 04:37:36 +00:00
2023-10-09 07:51:38 +00:00
CFLAGS := -std=c11 -fopenmp \
-I/opt/homebrew/opt/libomp/include \
-I/usr/lib/gcc/aarch64-linux-gnu/11/include \
2023-10-09 08:14:23 +00:00
-O3 -g
LDFLAGS := -std=c11 -fopenmp -L/opt/homebrew/opt/libomp/lib -O3
2023-10-08 00:49:58 +00:00
RUST_SOURCES := $(shell find . -name "*.rs")
2023-09-23 05:04:06 +00:00
2023-10-09 08:49:21 +00:00
all: lc_openmp lc_pthreads handin
handin: zhan4854.tar.gz
2023-09-23 04:37:36 +00:00
2023-10-08 01:02:34 +00:00
clean:
2023-10-09 07:51:38 +00:00
rm -rf \
lc_openmp lc_pthreads \
zhan4854 zhan4854.tar.gz \
dataset/small \
*.o
2023-10-08 01:02:34 +00:00
2023-10-09 09:17:14 +00:00
zhan4854.tar.gz: common.c common.h lc_openmp.c lc_pthreads.c Makefile ASSIGNMENT.md report.pdf run_benchmark.sh
2023-10-08 01:02:34 +00:00
mkdir -p zhan4854
2023-10-09 08:49:21 +00:00
cp $^ zhan4854
2023-10-08 01:02:34 +00:00
tar -czvf $@ zhan4854
rm -r zhan4854
2023-10-09 09:17:14 +00:00
report.pdf: report.md
pandoc -o $@ $^
2023-09-23 05:04:06 +00:00
lc_openmp: lc_openmp.o common.o
2023-10-09 08:14:23 +00:00
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lm
2023-09-23 05:04:06 +00:00
lc_pthreads: lc_pthreads.o common.o
2023-10-09 08:49:21 +00:00
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lm
2023-09-23 04:37:36 +00:00
2023-09-23 05:04:06 +00:00
%.o: %.c
2023-10-08 00:49:58 +00:00
$(CC) $(CFLAGS) -o $@ -c $<
2023-10-09 07:51:38 +00:00
## Dumb debug stuff, please ignore:
dataset/small/%.txt: generate_test_data.py
python generate_test_data.py dataset/small_data.csv dataset/small_label.csv dataset/small
dataset/mnist/%.txt: generate_test_data.py
python generate_test_data.py dataset/MNIST_data.csv dataset/MNIST_label.csv dataset/mnist
2023-10-09 09:17:14 +00:00
watch-report:
watchexec -c clear -e md 'make report.pdf'
2023-10-09 07:51:38 +00:00
watch-openmp:
watchexec -c clear -e Makefile,c,h 'make lc_openmp && ./lc_openmp ./dataset/small_data.csv ./dataset/small_label.csv 10 2'
2023-10-09 08:49:21 +00:00
run-pthreads-small: lc_pthreads dataset/small/train_data.txt
./lc_pthreads dataset/small/train_data.txt dataset/small/train_label.txt 10 2 dataset/small/test_data.txt dataset/small/test_label.txt
run-pthreads-mnist: lc_pthreads dataset/mnist/train_data.txt
./lc_pthreads dataset/mnist/train_data.txt dataset/mnist/train_label.txt 10 8 dataset/mnist/test_data.txt dataset/mnist/test_label.txt
2023-10-09 07:51:38 +00:00
run-openmp-small: lc_openmp dataset/small/train_data.txt
./lc_openmp dataset/small/train_data.txt dataset/small/train_label.txt 10 2 dataset/small/test_data.txt dataset/small/test_label.txt
run-openmp-mnist: lc_openmp dataset/mnist/train_data.txt
2023-10-09 08:14:23 +00:00
./lc_openmp dataset/mnist/train_data.txt dataset/mnist/train_label.txt 10 8 dataset/mnist/test_data.txt dataset/mnist/test_label.txt
2023-10-09 07:51:38 +00:00
2023-10-08 00:49:58 +00:00
rust: $(RUST_SOURCES)
cargo run -- ${BASE_PATH}/dataset/{small_data.csv,small_label.csv} 10 2