A quick start on CUDA: Difference between revisions

From Cpre584
Jump to navigation Jump to search
Marinama (talk | contribs)
New page: All machines in coover 2050 are installed with CUDA. Before you run a simple program, you need to: 1) Setting environment variables export PATH=/usr/local/cuda/bin:$PATH export LD_LIB...
 
Marinama (talk | contribs)
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
All machines in coover 2050 are installed with CUDA.
All machines in coover 2050 are installed with CUDA.


Before you run a simple program, you need to:
Before you run a simple program, you need to set up environment variables
1) Setting environment variables
 
   export PATH=/usr/local/cuda/bin:$PATH
   export PATH=/usr/local/cuda/bin:$PATH
   export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
   export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
2) go to the directory of your sample code.
 
  For example:
The cuda sample code can be downloaded from:[http://developer.nvidia.com/cuda-example-introduction-general-purpose-gpu-programming CUDA by example]
  cd /home/username/cuda
 
3) nvcc hello_world.cu
1) Go to the directory of your sample code.
4) You will see the output: a.out
 
5) ./a.out
2) To compile hello_world.cu
  It will print the result.
 
  nvcc hello_world.cu  
 
3) Run the executable file: a.out
 
  ./a.out
4) Get the output.
  Hello, World!
 
Also, a very good beginning tutorial [http://www.cc.gatech.edu/~vetter/keeneland/tutorial-2012-02-20/07-intro_to_cuda_c.pdf Intro to CUDA]

Latest revision as of 23:24, 6 March 2012

All machines in coover 2050 are installed with CUDA.

Before you run a simple program, you need to set up environment variables

 export PATH=/usr/local/cuda/bin:$PATH
 export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

The cuda sample code can be downloaded from:CUDA by example

1) Go to the directory of your sample code.

2) To compile hello_world.cu

  nvcc hello_world.cu 

3) Run the executable file: a.out

 ./a.out

4) Get the output.

  Hello, World!

Also, a very good beginning tutorial Intro to CUDA