1
Fork 0
mirror of https://github.com/Steffo99/unimore-hpc-assignments.git synced 2024-11-25 17:44:23 +00:00
hpc-2022-g3/openmp/lab3/Makefile
2021-04-21 11:04:24 +02:00

32 lines
622 B
Makefile

ifndef EXERCISE
EXERCISE=exercise1.c
endif
CC=clang
LD=ld
OBJDUMP=objdump
OPT=-O3 -g
OMP=-fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda
CFLAGS=$(OPT) $(OMP) -I. $(EXT_CFLAGS)
LDFLAGS=-lm $(EXT_LDFLAGS)
SRCS=utils.c
OBJS=$(SRCS:.c=.o) $(EXERCISE:.c=.o)
EXE=$(EXERCISE:.c=.exe)
$(EXE): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS)
all: $(EXE)
.PHONY: run profile clean
run: $(EXE)
./$(EXE) $(EXT_ARGS)
profile: $(EXE)
sudo LD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/ext/lib:${LD_LIBRARY_PATH} LIBRARY_PATH=/usr/ext/lib:${LIBRARY_PATH} nvprof ./$(EXE) $(EXT_ARGS)
clean:
rm -f $(OBJS) *.o *.exe *.out *~