How should a very simple Makefile look like for Cuda compiling under linux

前端 未结 4 1985
天命终不由人
天命终不由人 2021-02-04 12:38

I want to compile a very basic hello world level Cuda program under Linux. I have three files:

  • the kernel: helloWorld.cu
  • main method: helloWorld.cpp
4条回答
  •  萌比男神i
    2021-02-04 13:16

    Just in case, here's my variant. I use it to compile CUDA projects on Mac, but I think it will suit Linux too. It requires CUDA SDK.

    BINDIR = ./ # places compiled binary in current directory
    EXECUTABLE := helloWorld
    
    CCFILES := helloWorld.cpp
    CUFILES := helloWorld.cu
    
    # an ugly part - setting rootdir for CUDA SDK makefile
    # look for common.mk - I don't know where SDK installs it on Linux -
    # and change ROOTDIR accordingly 
    ROOTDIR := /Developer/GPU\ Computing/C/common
    
    include $(ROOTDIR)/../common/common.mk
    

提交回复
热议问题