1
votes

I have created new C++Application in Netbeans and want to compile simple CUDA like:

#include <cstdlib>
// includes, system
#include <stdio.h>

// includes CUDA Runtime
#include <cuda_runtime.h>

// includes help
#include <helper_cuda.h>
#include <helper_functions.h> // helper utility functions 

/*
 * 
 */

__global__ void add(int* a , int* b, int* c){
    *c=*a+*b;
}

int main(int argc, char** argv) {
    int a,b,c; //host copies of a,b,c
    int* d_a,*d_b,*d_c; //device copies of a,b,c
    int size=sizeof(int);

    //allocate space for device copies of a,b,c
    cudaMalloc((void**)&d_a,size);
    cudaMalloc((void**)&d_b,size);
    cudaMalloc((void**)&d_c,size);

    //setup input
    a=2;
    b=7;

    //copy inputs to device
    cudaMemcpy(d_a,&a,size,cudaMemcpyHostToDevice);
    cudaMemcpy(d_b,&b,size,cudaMemcpyHostToDevice);

    //launch add() kernel on GPU device
    add<<<1,1>>>(d_a,d_b,d_c);


    return 0;
}

when I do build by IDE it is what it is doing:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory /root/NetBeansProjects/my_CUDA_1' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/libmy_cuda_1.a make[2]: Entering directory/root/NetBeansProjects/my_CUDA_1' mkdir -p build/Debug/GNU-Linux-x86 rm -f build/Debug/GNU-Linux-x86/cudaMain.o.d /usr/local/cuda-5.0/bin/nvcc
-c -g -I/usr/local/cuda-5.0/include -I/usr/local/cuda-5.0/samples/common/inc -MMD -MP -MF build/Debug/GNU-Linux-x86/cudaMain.o.d -o build/Debug/GNU-Linux-x86/cudaMain.o cudaMain.cu nvcc fatal : Unknown option 'MMD'

so I can avoid this error by compiling manually from commandline without these options:

me@comp:/root/NetBeansProjects/my_CUDA_1# /usr/local/cuda-5.0/bin/nvcc -m64 -c -g -I/usr/local/cuda-5.0/include -I/us r/local/cuda-5.0/samples/common/inc -o build/Debug/GNU-Linux-x86/cudaMain.o cudaMain.cu cudaMain.cu(28): warning: variable "c" was declared but never referenced

cudaMain.cu(28): warning: variable "c" was declared but never referenced

me@comp:/root/NetBeansProjects/my_CUDA_1# ls

how, what to configure in Netbeans to get such settings in IDE?

1

1 Answers

2
votes

Project->Properties->Build on tab Expert: Enable make Dependency Checking -> uncheck this