To run cuda program on linux through command line Run run cuda program on linux (rhel 4.3)

.> Is it possible to run a CUDA program through command line without using Makefile ?
If yes , How to run CUDA Program on linux using command line , I do not want to use the makefile , so please any one can help me that run a CUDA program on RHEL 4.3 .
And also tell me about the switch using in command line .
So tell me full step ,how to run CUDA program.

Thanks In Advance
Chitranjan Singh.

You’re probably asking about compiling, not running, program. Here is an example, for CUDA installed in /opt/cuda, and source file named foo.cu:

  1. you may wish to first compile to object code, through:
    /opt/cuda/bin/nvcc -c -I/opt/cuda/include foo.cu
  2. then you’d link to an executable, through:
    gcc -L/opt/cuda/lib foo.o -lcudart -o foo
    Of course, you could do it in single step, in which case you call nvcc, and it’ll take care of calling gcc itself. When running the executable “foo”, don’t forget to include CUDA library directory (/opt/cuda/lib) in that case, in the LD_LIBRARY_PATH.

I compiled code through :

                    /usr/local/cuda/bin/nvcc -c -I/usr/local/cuda/include addone.cu 

But Error comes as :

In file included from /usr/local/cuda/bin/…/include/cuda_runtime.h:45,

             from <command line>:8:

/usr/local/cuda/bin/…/include/host_config.h:55:63: bits/c++config.h: No such file or directory

In file included from /usr/local/cuda/bin/…/include/common_functions.h:93,

             from /usr/local/cuda/bin/../include/cuda_runtime.h:62,

             from <command line>:8:

/usr/local/cuda/bin/…/include/math_functions.h:459:1: warning: “signbit” redefined

In file included from /usr/local/cuda/bin/…/include/math_functions.h:408,

             from /usr/local/cuda/bin/../include/common_functions.h:93,

             from /usr/local/cuda/bin/../include/cuda_runtime.h:62,

             from <command line>:8:

/usr/include/math.h:202:1: warning: this is the location of the previous definition

In file included from /usr/local/cuda/bin/…/include/common_functions.h:93,

             from /usr/local/cuda/bin/../include/cuda_runtime.h:62,

             from <command line>:8:

/usr/local/cuda/bin/…/include/math_functions.h:461:1: warning: “isfinite” redefined

In file included from /usr/local/cuda/bin/…/include/math_functions.h:408,

             from /usr/local/cuda/bin/../include/common_functions.h:93,

             from /usr/local/cuda/bin/../include/cuda_runtime.h:62,

             from <command line>:8:

/usr/include/math.h:214:1: warning: this is the location of the previous definition

In file included from /usr/local/cuda/bin/…/include/common_functions.h:93,

             from /usr/local/cuda/bin/../include/cuda_runtime.h:62,

             from <command line>:8:

/usr/local/cuda/bin/…/include/math_functions.h:466:1: warning: “isnan” redefined

In file included from /usr/local/cuda/bin/…/include/math_functions.h:408,

             from /usr/local/cuda/bin/../include/common_functions.h:93,

             from /usr/local/cuda/bin/../include/cuda_runtime.h:62,

             from <command line>:8:

/usr/include/math.h:230:1: warning: this is the location of the previous definition

In file included from /usr/local/cuda/bin/…/include/common_functions.h:93,

             from /usr/local/cuda/bin/../include/cuda_runtime.h:62,

             from <command line>:8:

/usr/local/cuda/bin/…/include/math_functions.h:468:1: warning: “isinf” redefined

In file included from /usr/local/cuda/bin/…/include/math_functions.h:408,

             from /usr/local/cuda/bin/../include/common_functions.h:93,

             from /usr/local/cuda/bin/../include/cuda_runtime.h:62,

             from <command line>:8:

/usr/include/math.h:242:1: warning: this is the location of the previous definition

addone.cu:5:18: cutil.h: No such file or directory

Please tell me how error is coming like and to compile error-free .I am using Tesla C870 .

Does your code compile using makefile? If it does, you can study the makefile to see where is the difference. If it doesn’t I’m afraid you din’t configure your system properly…

Yes, I have compiled using Makefile also , but It’s giving error . I am using Tesla C870 on RHEL 4 update3 .
=> I have installed Tesla driver (NVIDIA-linux) .
=> I have installed NVIDIA_CUDA_Toolkit .
=> I have installed NVIDIA_CUDA_SDK .
and also set LIB path .

But I am getting error .

Is it sufficient way to compile and run the CUDA Program ,Please suggest me…

Thanks In Advance
Chitranjan Singh.

Can you write where exactly did you installed CUDA toolkit and SDK, and also can you paste here the output of compilation using makefiles? It would be good if you could attach your source file too.

I update my Operating system from RHEL 4 update 3 to RHEL-5 after that ,I successfully compiled the CUDA code and got the desired output.

But now I am facing two problems =>

1.> First time when I installed OS on my system before installing Tesla Driver , the NIC card ( ethernet ) detects . But after installing driver of tesla c870 the NIC card(ethernet) is not detecting . why it is happening like that please help me out ?.

2.> when I compile and run CUDA program first time it works fine ,but when I again run the CUDA program It hangs the whole system .

[…]$ …/…/bin/linux/release/matrixmul

Hangs the system after running above command 2nd time .

The above command first time works fine ,next time “make” works,but the above command with whatever the CUDA program ,it hangs the whole system .

So, please short out the problem .

Thanks In Advance.

Chitranjan Singh.

#1 sounds like an SBIOS bug or possibly a kernel bug. You should confirm that you’re using the latest released SBIOS and RHEL5 kernel.

#2 could also be an SBIOS bug. Please generate and attach an nvidia-bug-report.log.