42 lines
1.0 KiB
Makefile
42 lines
1.0 KiB
Makefile
CUDA_PATH ?= /usr/local/cuda
|
|
HOST_COMPILER = g++
|
|
NVCC = $(CUDA_PATH)/bin/nvcc
|
|
|
|
# select one of these for Debug vs. Release
|
|
NVCC_DBG = -g -G
|
|
#NVCC_DBG =
|
|
|
|
NVCCFLAGS = $(NVCC_DBG) -m64
|
|
GENCODE_FLAGS = --gpu-architecture=compute_50 --gpu-code=compute_50,sm_50,sm_52
|
|
|
|
BUILD_DIR = build
|
|
SRCS = src/main.cu
|
|
INCS = src/vec3.cpp src/ray.cpp
|
|
|
|
$(BUILD_DIR)/cudart: $(BUILD_DIR)/cudart.o
|
|
$(NVCC) $(NVCCFLAGS) $(GENCODE_FLAGS) -o $(BUILD_DIR)/cudart $(BUILD_DIR)/cudart.o
|
|
|
|
$(BUILD_DIR)/cudart.o: $(SRCS) $(INCS)
|
|
mkdir -p $(BUILD_DIR)
|
|
$(NVCC) $(NVCCFLAGS) $(GENCODE_FLAGS) -o $(BUILD_DIR)/cudart.o -c src/main.cu
|
|
|
|
out.ppm: $(BUILD_DIR)/cudart
|
|
rm -f out.ppm
|
|
./$(BUILD_DIR)/cudart
|
|
|
|
out.jpg: out.ppm
|
|
rm -f out.jpg
|
|
ppmtojpeg out.ppm > out.jpg
|
|
|
|
profile_basic: $(BUILD_DIR)/cudart
|
|
nvprof ./$(BUILD_DIR)/cudart
|
|
|
|
|
|
# use nvprof --query-metrics
|
|
profile_metrics: $(BUILD_DIR)/cudart
|
|
nvprof --metrics achieved_occupancy,inst_executed,inst_fp_32,inst_fp_64,inst_integer ./cudart
|
|
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
rm -f out.ppm out.jpg
|