Click here to load reader
View
217
Download
0
Embed Size (px)
8/8/2019 Gettingstarted Linux
1/16
DU-80001-001_v01 | April 2010
Getting Started
NVIDIA CUDA C INSTALLATIONAND VERIFICATION ON LINUXSYSTEMS
8/8/2019 Gettingstarted Linux
2/16
NVIDIA CUDA C Installation and Verification on Linux Systems DU-80001-001_v01 | ii
DOCUMENT CHANGE HISTORY
DU-80001-001_v01
Version Date Authors Description of Change
01 April 20, 2-010 CW, TS Release
8/8/2019 Gettingstarted Linux
3/16
NVIDIA CUDA C Installation and Verification on Linux Systems DU-80001-001_v01 | iii
TABLE OF CONTENTS
Introduction .............................................................................. 5 CUDA-Supercomputing on Desktop Systems ................................................. 5System Requirements............................................................................ 6About This Document............................................................................ 6
Installing CUDA Development Tools ............................................... 7 Verify You Have a CUDA-Enabled System .................................................... 7
Verify You Have a Supported Version of Linux ............................................ 8Verify That gcc Is Installed................................................................... 8
Download the NVIDIA Driver and CUDA Software........................................... 9Install the NVIDIA Driver ....................................................................... 10Install the CUDA Software...................................................................... 11Verify the Installation ........................................................................... 12
Compiling the Examples ..................................................................... 12Running the Binaries ......................................................................... 12
Additional Considerations............................................................ 15
8/8/2019 Gettingstarted Linux
4/16
NVIDIA CUDA C Installation and Verification on Linux Systems DU-80001-001_v01 | iv
LIST OF FIGURES
Figure 1. Valid Results from SDK deviceQuery Program.................................... 13Figure 2. Valid Results from SDK bandwidthTest Program ................................. 14
8/8/2019 Gettingstarted Linux
5/16
NVIDIA CUDA C Installation and Verification on Linux Systems DU-80001-001_v01 | 5
INTRODUCTION
CUDA-SUPERCOMPUTING ON DESKTOP SYSTEMSNVIDIACUDATMisageneralpurposeparallelcomputingarchitectureintroducedby
NVIDIA.ItincludestheCUDAInstructionSetArchitecture(ISA)andtheparallel
computeengineintheGPU.ToprogramtotheCUDAarchitecture,developerscanuse
C,oneofthemostwidelyusedhighlevelprogramminglanguages,whichcanthenbe
runatgreatperformanceonaCUDAenabledprocessor.
TheCUDAarchitectureanditsassociatedsoftwareweredevelopedwithseveraldesign
goalsinmind:
Provideasmallsetofextensionstostandardprogramminglanguages,likeC,thatenableastraightforwardimplementationofparallelalgorithms.WithCUDAandC
forCUDA,programmerscanfocusonthetaskofparallelizationofthealgorithms
ratherthanspendingtimeontheirimplementation.
SupportheterogeneouscomputationwhereapplicationsuseboththeCPUandGPU.SerialportionsofapplicationsarerunontheCPU,andparallelportionsare
offloadedtotheGPU.Assuch,CUDAcanbeincrementallyappliedtoexisting
applications.TheCPUandGPUaretreatedasseparatedevicesthathavetheirown
memoryspaces.Thisconfigurationalsoallowssimultaneouscomputationonboth
theCPUandGPUwithoutcontentionformemoryresources.
CUDAenabledGPUshavehundredsofcoresthatcancollectivelyrunthousandsofcomputingthreads.Eachcorehassharedresources,includingregistersandmemory.
Theonchipsharedmemoryallowsparalleltasksrunningonthesecorestosharedata
withoutsendingitoverthesystemmemorybus.
ThisguidewillshowyouhowtoinstallandcheckthecorrectoperationoftheCUDA
DevelopmentTools.
8/8/2019 Gettingstarted Linux
6/16
Introduction
NVIDIA CUDA C Installation and Verification on Linux Systems DU-80001-001_v01 | 6
SYSTEM REQUIREMENTS
TouseCUDAonyoursystem,youwillneedthefollowinginstalled:
CUDAenabledGPUDevicedriverAsupportedversionofLinuxwithagcccompilerandtoolchainCUDAsoftware(availableatnocostfromhttp://www.nvidia.com/cuda)
ABOUT THIS DOCUMENT
ThisdocumentisintendedforreadersfamiliarwiththeLinuxenvironmentandthe
compilationofCprogramsfromthecommandline.Youdonotneedprevious
experiencewithCUDAorexperiencewithparallelcomputation.Note:ThisguidecoversinstallationonlyonsystemsrunningXWindows.
Note: Many commands in this document might require super-user privileges. On
most distributions of Linux, this will require you to log in as root. For systems that
have enabled the sudo package, use the sudo prefix for all necessary commands.
We will no longer remark on the matter of user privilege for the installation
process except where critical to correct operation.
8/8/2019 Gettingstarted Linux
7/16
NVIDIA CUDA C Installation and Verification on Linux Systems DU-80001-001_v01 | 7
INSTALLING CUDA DEVELOPMENT TOOLS
TheinstallationofCUDAdevelopmenttoolsonasystemrunningtheappropriate
versionofLinuxconsistsoffoursimplesteps:
VerifythesystemhasaCUDAenabledGPUandasupportedversionofLinux.DownloadtheNVIDIAdriverandtheCUDAsoftware. InstalltheNVIDIAdriver. InstalltheCUDAsoftware.Testyourinstallationbycompilingandrunningoneofthesampleprogramsinthe
CUDAsoftwaretovalidatethatthehardwareandsoftwarearerunningcorrectlyand
communicatingwitheachother.
VERIFY YOU HAVE A CUDA-ENABLED SYSTEM
ManyNVIDIAproductstodaycontainCUDAenabledGPUs.Theseinclude:
NVIDIAGeForce8,9,200,and400seriesGPUsNVIDIATeslacomputingsolutionsManyoftheNVIDIAQuadroproductsAnuptodatelistofCUDAenabledGPUscanbefoundontheNVIDIACUDAWeb
siteathttp://www.nvidia.com/object/cuda_gpus.html
TheReleaseNotesfortheCUDAToolkitalsocontainalistofsupportedproducts.
8/8/2019 Gettingstarted Linux
8/16
Installing CUDA Development Tools
NVIDIA CUDA C Installation and Verification on Linux Systems DU-80001-001_v01 | 8
Toverifywhichvideoadapteryoursystemuses,findthemodelnumberbygoingto
yourdistributionsequivalentofSystemProperties,or,fromthecommandline,enter:
lspci | grep -i nvidia
Ifyoudonotseeanysettings,updatethePCIhardwaredatabasethatLinuxmaintains
byenteringupdatepciids(generallyfoundin/sbin)atthecommandlineandrerun
thepreviouslspcicommand.
Verify You Have a Supported Version of Linux
TheCUDADevelopmentToolsareonlysupportedonsomespecificdistributionsof
Linux.ThesearelistedintheCUDAToolkitreleasenotes.
Todeterminewhichdistributionandreleasenumberyourerunning,typethefollowing
atthecommandline:uname -m && cat /etc/*release
Youshouldseeoutputsimilartothefollowing,modifiedforyourparticularsystem:
i386
Red Hat Enterprise Linux WS release 4 (Nahant Update 6)
The i386lineindicatesyouarerunningona32bitsystem.On64bitsystemsrunning
in64bitmode,thislinewillgenerallyread:x86_64.Thesecondlinegivestheversion
numberoftheoperatingsystem.
Verify That gcc Is Installed
ThegcccompilerandtoolchaingenerallyareinstalledaspartoftheLinuxinstallation,
andinmostcasestheversionofgccinstalledwithasupportedversionofLinuxwill
workcorrectly.
Toverifytheversionofgccinstalledonyoursystem,typethefollowingonthe
commandline:
gcc --version
Ifanerrormessagedisplays,youneedtoinstallthe developmenttools fromyour
Linuxdistributionorobtainaversionofgccanditsaccompanyingtoolchainfromthe
Web.
8/8/2019 Gettingstarted Linux
9/16
Installing CUDA Development Tools
NVIDIA CUDA C Installation and Verification on Linux Systems DU-80001-001_v01 | 9
DOWNLOAD THE NVIDIA DRIVER AND CUDA
SOFTWARE
OnceyouhaveverifiedthatyouhaveasupportedNVIDIAprocessorandasupported
versionofLinux,youneedtomakesureyouhavearecentversionoftheNVIDIA
driver.TheCUDAToolkitreleasenotesspecifywhichminimumversionoftheNVIDIA
driverisrequired.
Onmanydistributions,thedriverreleasenumbercanbefoundinthegraphicalinterface
menusunderApplicationsSystem ToolsNVIDIA X Server Settings.Or,fromthecommandline,run:
/usr/bin/nvidia-settings.
ThefollowingCUDAsoftware isrequiredtorunCUDAprograms:
TheCUDAToolkitTheCUDAToolkitcontainsthetoolsneededtocompileandbuildaCUDA
applicationinconjunctionwiththecompilationdriver.Itincludestools,libraries,
headerfiles,andotherresources.
TheCUDASDKTheCUDASDKincludessampleprojectsthatprovidesourcecodeandother
resourcesforconstructingCUDAprograms.
TheNVIDIAdriverandCUDAsoftwareareavailableatnocostfromthemainCUDA
downloadsiteathttp://www.nvidia.com/object/cuda_get.html .
ChoosetheLinuxdistributionyouareusing,clickSearch,anddownloadtheNVIDIA
driver.Savethedriverfileonyourlocalsystem.Likewise,downloadandsavetheSDK
andToolkit.
8/8/2019 Gettingstarted Linux
10/16
Installing CUDA Development Tools
NVIDIA CUDA C Installation and Verification on Linux Systems DU-80001-001_v01 | 10
INSTALL THE NVIDIA DRIVERWiththeNVIDIAdriverandsoftwaredownloaded,youneedtoinstallthedriver.Use
thefollowingproceduretoinstallthedriver:
1. ExittheGUIifyouareinaGUIenvironment,bypressingCtrl-Alt-Backspace.
Somedistributionsrequireyoutopressthissequencetwiceinarow,othershave
disableditaltogetherinfavorofacommandsuchassudo /etc/init.d/gdm stop).At
thecommandline,turnoffXWindows