// Copy result back to host cudaMemcpy(h_c, d_c, bytes, cudaMemcpyDeviceToHost);
// Cleanup cudaFree(d_a); cudaFree(d_b); cudaFree(d_c); delete[] h_a; delete[] h_b; delete[] h_c; cuda toolkit
return 0; # Compile nvcc -o vector_add vector_add.cu Run ./vector_add Makefile for larger projects CUDA_PATH ?= /usr/local/cuda NVCC = $(CUDA_PATH)/bin/nvcc NVCC_FLAGS = -arch=sm_75 -O3 -std=c++17 TARGET = vector_add SOURCES = vector_add.cu // Copy result back to host cudaMemcpy(h_c, d_c,
$(TARGET): $(SOURCES) $(NVCC) $(NVCC_FLAGS) -o $@ $^ // Cleanup cudaFree(d_a)