Check out my first novel, midnight's simulacra!

CUDA: Difference between revisions

From dankwiki
No edit summary
Line 67: Line 67:
* Add the library path to LD_LIBRARY_PATH, assuming CUDA's been installed to a non-standard directory.
* Add the library path to LD_LIBRARY_PATH, assuming CUDA's been installed to a non-standard directory.
* Set the <tt>CUDA_INSTALL_PATH</tt> and <tt>ROOTDIR</tt> (yeargh!) if outside the SDK.
* Set the <tt>CUDA_INSTALL_PATH</tt> and <tt>ROOTDIR</tt> (yeargh!) if outside the SDK.
* I keep the following in <tt>bin/cudasetup</tt> of my home directory. Source its output, ala <tt>eval `cudasetup`</tt>:
* I keep the following in <tt>bin/cudasetup</tt> of my home directory. Source it, using sh's <tt>. cudasetup</tt> syntax:
<pre>#!/bin/sh
<pre>export CUDA_INSTALL_PATH="$CUDA"
 
export ROOTDIR="$CUDA/C/common/"
CUDA=$HOME/local/cuda
 
[ -d "$CUDA" ] || { echo "$CUDA is not a directory, exiting" >&2 ; exit 1 ; }
 
echo "# run \"eval \`$0\`\" to source these exports"
echo "export CUDA_INSTALL_PATH=$CUDA"
echo "export ROOTDIR=$CUDA/C/common/"
# check for its current presence? FIXME
if [ -n "$LD_LIBRARY_PATH" ] ; then
if [ -n "$LD_LIBRARY_PATH" ] ; then
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA/lib64"
export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA/lib64"
else
else
echo "export LD_LIBRARY_PATH=$CUDA/lib64"
export "LD_LIBRARY_PATH=$CUDA/lib64"
fi</pre>
fi</pre>


===Handrolled builds===
===Handrolled builds===

Revision as of 07:35, 26 January 2010

Hardware/Emulation

NVIDIA maintains a list of supported hardware. Otherwise, there's emulation...

[recombinator](0) $ ~/local/cuda/C/bin/linux/emurelease/deviceQuery
CUDA Device Query (Runtime API) version (CUDART static linking)
There is no device supporting CUDA.

Device 0: "Device Emulation (CPU)"
  CUDA Driver Version:                           2.30
  CUDA Runtime Version:                          2.30
  CUDA Capability Major revision number:         9999
  CUDA Capability Minor revision number:         9999
  Total amount of global memory:                 4294967295 bytes
  Number of multiprocessors:                     16
  Number of cores:                               128
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 8192
  Warp size:                                     1
  Maximum number of threads per block:           512
  Maximum sizes of each dimension of a block:    512 x 512 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
  Maximum memory pitch:                          262144 bytes
  Texture alignment:                             256 bytes
  Clock rate:                                    1.35 GHz
  Concurrent copy and execution:                 No
  Run time limit on kernels:                     No
  Integrated:                                    Yes
  Support host page-locked memory mapping:       Yes
  Compute mode:                                  Default (multiple host threads can use this device simultaneously)

Test PASSED

Installation on Debian

libcuda-dev packages exist in the non-free archive area, and supply the core library libcuda.so. Together with the upstream toolkit and SDK from NVIDIA, this provides a full CUDA development environment for 64-bit Debian Unstable systems. I installed CUDA 2.3 on 2010-01-25 (hand-rolled 2.6.32.6 kernel, built with gcc-4.4). This machine did not have CUDA-compatible hardware (it uses Intel 965).

  • Download the Ubuntu 9.04 files from NVIDIA's "CUDA Zone".
  • Run the toolkit installer (sh cudatoolkit_2.3_linux_64_ubuntu9.04.run)
    • For a user-mode install, supply $HOME/local or somesuch
* Please make sure your PATH includes /home/dank/local/cuda/bin
* Please make sure your LD_LIBRARY_PATH
*   for 32-bit Linux distributions includes /home/dank/local/cuda/lib
*   for 64-bit Linux distributions includes /home/dank/local/cuda/lib64
* OR
*   for 32-bit Linux distributions add /home/dank/local/cuda/lib
*   for 64-bit Linux distributions add /home/dank/local/cuda/lib64
* to /etc/ld.so.conf and run ldconfig as root

* Please read the release notes in /home/dank/local/cuda/doc/

* To uninstall CUDA, delete /home/dank/local/cuda
* Installation Complete
  • Run the SDK installer (sh cudasdk_2.3_linux.run)
    • I just installed it to the same directory as the toolkit, which seems to work fine.
========================================

Configuring SDK Makefile (/home/dank/local/cuda/shared/common.mk)...

========================================

* Please make sure your PATH includes /home/dank/local/cuda/bin
* Please make sure your LD_LIBRARY_PATH includes /home/dank/local/cuda/lib

* To uninstall the NVIDIA GPU Computing SDK, please delete /home/dank/local/cuda
* Installation Complete

Building

SDK's common.mk

This assumes use of the SDK's common.mk, as recommended by the documentation.

  • Add the library path to LD_LIBRARY_PATH, assuming CUDA's been installed to a non-standard directory.
  • Set the CUDA_INSTALL_PATH and ROOTDIR (yeargh!) if outside the SDK.
  • I keep the following in bin/cudasetup of my home directory. Source it, using sh's . cudasetup syntax:
export CUDA_INSTALL_PATH="$CUDA"
export ROOTDIR="$CUDA/C/common/"
if [ -n "$LD_LIBRARY_PATH" ] ; then
	export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA/lib64"
else
	export "LD_LIBRARY_PATH=$CUDA/lib64"
fi

Handrolled builds