2022-11-28 15:22:38 +00:00
|
|
|
# Remove all make implicit rules because this is already complex enough as it is
|
|
|
|
MAKEFLAGS+= -r
|
|
|
|
|
2022-11-16 16:04:50 +00:00
|
|
|
# -DPOLYBENCH_TIME makes Polybench output the execution time of the program
|
2022-11-28 15:10:47 +00:00
|
|
|
CXXFLAGS+= -DPOLYBENCH_TIME
|
2022-11-16 00:43:59 +00:00
|
|
|
# -O3 applies all compiler optimization, improving from 800ms to 300ms
|
2022-11-28 15:11:00 +00:00
|
|
|
CXXFLAGS+= -O3
|
2022-12-01 23:15:33 +00:00
|
|
|
# Enable this to view the contents of the arrays
|
|
|
|
CXXFLAGS+= -DHPC_DEBUG
|
|
|
|
# Enable this to use CUDA
|
|
|
|
CXXFLAGS+= -DHPC_USE_CUDA
|
2022-11-17 01:59:31 +00:00
|
|
|
# Extend CFLAGS with command line parameters
|
2022-11-28 13:37:37 +00:00
|
|
|
CXXFLAGS+= ${EXTRA_CXXFLAGS}
|
|
|
|
|
|
|
|
# Select the location of the local CUDA install
|
2022-12-01 23:15:33 +00:00
|
|
|
# CUDA_HOME:=/usr/local/cuda-10.0
|
|
|
|
CUDA_HOME:=/opt/cuda
|
2022-11-28 13:37:37 +00:00
|
|
|
# Specify the directory of the nvc compiler
|
2022-11-28 14:08:26 +00:00
|
|
|
NVCC:=$(CUDA_HOME)/bin/nvcc
|
2022-11-28 13:37:37 +00:00
|
|
|
# Specify the flags for the nvc compiler
|
|
|
|
NVCFLAGS:=$(CXXFLAGS) $(NVOPT)
|
2022-11-16 16:06:16 +00:00
|
|
|
|
2022-12-01 23:15:33 +00:00
|
|
|
# Optimize for @Steffo's NVIDIA GTX 1070
|
|
|
|
NVCFLAGS+= -arch=compute_61
|
|
|
|
NVCFLAGS+= -code=sm_61
|
|
|
|
|
2022-11-16 16:09:27 +00:00
|
|
|
|
2022-11-28 15:22:38 +00:00
|
|
|
%.elf: %.cu.o polybench.cu.o
|
|
|
|
$(NVCC) $(NVCFLAGS) $^ -o $@ $(LDFLAGS)
|
2022-11-28 14:08:26 +00:00
|
|
|
|
2022-11-28 15:22:38 +00:00
|
|
|
%.cu.o: %.cu
|
2022-11-28 13:41:35 +00:00
|
|
|
$(NVCC) $(NVCFLAGS) -c $< -o $@
|
2022-11-17 01:59:31 +00:00
|
|
|
|
2022-11-28 14:08:26 +00:00
|
|
|
|
2022-12-01 23:15:33 +00:00
|
|
|
all: atax.elf
|
2022-11-16 16:09:27 +00:00
|
|
|
|
2022-12-01 23:15:33 +00:00
|
|
|
.PHONY: bench clean
|
2022-11-30 00:01:49 +00:00
|
|
|
|
2022-11-16 16:09:27 +00:00
|
|
|
bench:
|
2022-11-16 16:39:09 +00:00
|
|
|
./.bench.sh
|
2022-11-28 15:26:14 +00:00
|
|
|
|
|
|
|
clean:
|
2022-12-01 23:15:33 +00:00
|
|
|
rm *.elf
|