52 lines
1.6 KiB
Makefile
52 lines
1.6 KiB
Makefile
.PHONY: all watch-openmp clean
|
|
|
|
CFLAGS := -std=c11 -fopenmp \
|
|
-I/opt/homebrew/opt/libomp/include \
|
|
-I/usr/lib/gcc/aarch64-linux-gnu/11/include \
|
|
-O3 -g
|
|
LDFLAGS := -std=c11 -fopenmp -L/opt/homebrew/opt/libomp/lib -O3
|
|
RUST_SOURCES := $(shell find . -name "*.rs")
|
|
|
|
all: lc_openmp lc_pthreads
|
|
|
|
clean:
|
|
rm -rf \
|
|
lc_openmp lc_pthreads \
|
|
zhan4854 zhan4854.tar.gz \
|
|
dataset/small \
|
|
*.o
|
|
|
|
zhan4854.tar.gz: common.c common.h lc_openmp.c lc_pthreads.c Makefile
|
|
mkdir -p zhan4854
|
|
mv $^ zhan4854
|
|
tar -czvf $@ zhan4854
|
|
rm -r zhan4854
|
|
|
|
lc_openmp: lc_openmp.o common.o
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lm
|
|
|
|
lc_pthreads: lc_pthreads.o common.o
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
|
|
|
## 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
|
|
|
|
watch-openmp:
|
|
watchexec -c clear -e Makefile,c,h 'make lc_openmp && ./lc_openmp ./dataset/small_data.csv ./dataset/small_label.csv 10 2'
|
|
|
|
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
|
|
./lc_openmp dataset/mnist/train_data.txt dataset/mnist/train_label.txt 10 8 dataset/mnist/test_data.txt dataset/mnist/test_label.txt
|
|
|
|
rust: $(RUST_SOURCES)
|
|
cargo run -- ${BASE_PATH}/dataset/{small_data.csv,small_label.csv} 10 2
|