Skip to content

Instantly share code, notes, and snippets.

@thataustin
Created July 22, 2025 18:54
Show Gist options
  • Save thataustin/24c9eb9bb8715bae082627e1260c7db6 to your computer and use it in GitHub Desktop.
Save thataustin/24c9eb9bb8715bae082627e1260c7db6 to your computer and use it in GitHub Desktop.
Example CUDA Makefile
# Name of your CUDA source file (without extension)
TARGET=my_cuda_program
SRC=$(TARGET).cu
# Output binary name
OUT=$(TARGET).out
# Supported GPU architectures
ARCHS=70 75 80 86 89 90
# Build target
all:
nvcc -o $(OUT) $(SRC) $(foreach arch,$(ARCHS),-gencode arch=compute_$(arch),code=sm_$(arch))
clean:
rm -f $(OUT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment