gpgpu – ides and development tools

17
GPGPU – IDEs and Development Tools Seminar on GPGPU Programming Teppo Valtonen

Upload: others

Post on 07-Apr-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

GPGPU–IDEsandDevelopmentTools

SeminaronGPGPUProgramming

TeppoValtonen

Contents

•  Librariesandplugins– FacilitateexploiAngthepowerofGPUsin3rdpartyapplicaAons

•  ApplicaAonsandscripts– SmallstandalonesoHwarethatsolvespecificproblemsinGPGPUdevelopment

•  Integrateddevelopmentenvironments– FullscaleenvironmentsintegraAnghelpfulfuncAonsforsoHwaredevelopment

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 1

Librariesandplugins

GPUMat•  AGPUtoolboxforMatlab

•  Freeware•  BuiltontopofCUDA–  RequiresCUDAinstalled

•  ConvertsMatlabvariablestotheGPUsingleclass

•  Also:throughMatlabMEXAPI…

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 2

Librariesandplugins

GPULib

•  AhighlevellibraryofmathemaAcalfuncAonsbuiltontopofCUDA–  RequiresCUDAinstalled

•  $495.00USD•  Also:CUDPP,Shallows…

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 3

ApplicaAonsandscripts

MemtestG80

•  AsoHware‐basedtestertotestfor"soHerrors"inGPUmemoryorlogicforNVIDIACUDA‐enabledGPUs

•  Opensource•  Also:CUDAGPUmemtest

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 4

ApplicaAonsandscripts

AllineaDDT

•  AgraphicaldebuggerforparallelapplicaAons

•  Apre‐releaseversionsupportsCUDA

•  DDTLite:add‐inforMicrosoHVisualStudio

•  £70‐£1250

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 5

ApplicaAonsandscripts

CUDA‐GDB•  AportedversionofGDB:

TheGNUDebugger•  Atext‐baseddebugging

toolforCUDA•  NVCCprovidesa

mechanismforgeneraAngdebugginginformaAonnecessaryforCUDA‐GDB:$: nvcc –g –G foo.cu –o foo

$: nvcc –g –G bitreverse.cu –o bitreverse

$: cuda-gdb bitreverse (cuda-gdb) break main

Breakpoint 1 at 0x8051e8c: file bitreverse.cu, line 23. (cuda-gdb) break bitreverse

Breakpoint 2 at 0x805b4f6: file bitreverse.cu, line 10. (cuda-gdb) break bitreverse.cu:18

Breakpoint 3 at 0x805b4fb: file bitreverse.cu, line 18. (cuda-gdb) run

Breakpoint 1, main() at bitreverse.cu:23 unsigned int *d = NULL; int i;

(cuda-gdb) continue Continuing.

[Current CUDA Thread <<<(0,0),(0,0,0)>>>]

Breakpoint 2, bitreverse() at bitreverse.cu:10 unsigned int *idata = data;

(cuda-gdb) thread [Current Thread 2 (Thread 1584864 (LWP 9146))]

[Current CUDA Thread <<<(0,0),(0,0,0)>>>] (cuda-gdb) print blockIdx

$1 = {x = 0, y = 0}

(cuda-gdb) print threadIdx $2 = {x = 0, y = 0, z = 0)

(cuda-gdb) print gridDim $3 = {x = 1, y = 1}

(cuda-gdb) print blockDim $4 = {x = 256, y = 1, z = 1)

(cuda-gdb) _

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 6

ApplicaAonsandscripts

FindCUDA.cmake

•  AmodulefortheKitwareCMakebuildsystem

•  ContainsmacrostobuildNVIDIACUDAprogramsinapladormindependentmanner

•  Opensource

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 7

Integrateddevelopmentenvironments

IDEfuncAons•  SyntaxhighlighAng•  CodecompleAon•  Linkinglibraries•  InterpreAngthecodecorrectly

•  Compilingcode•  Debugging•  …

// Kernel definition __global__ void MatAdd( float A[N][N],

float B[N][N], float C[N][N])

{ int i = blockIdx.x * blockDim.x + threadIdx.x; int j = blockIdx.y * blockDim.y + threadIdx.y; if (i < N && j < N) C[i][j] = A[i][j] + B[i][j]; }

int main() { ... // Kernel invocation dim3 dimBlock(16, 16); dim3 dimGrid((N + dimBlock.x – 1) / dimBlock.x, (N + dimBlock.y – 1) / dimBlock.y); }

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 8

Integrateddevelopmentenvironments

MicrosoDVisualStudio

•  AWindowsIDE•  C/C++supportbuilt‐in•  Mostlanguagessupportedasseparateextensions

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 9

Integrateddevelopmentenvironments

MicrosoDVisualStudio

•  ApparentlynoreadyCUDAextensions

•  Canbesetupto–  highlightCUDAsyntax–  compileusingnvcc

•  ProblemswithcorrecAngCUDAcalls

•  CUDAVSWizard

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 10

Integrateddevelopmentenvironments

NVIDIAParallelNsight

•  A.k.a"Nexus”•  Beta•  IntegratesintoMicrosoHVisualStudio

•  Threecomponents–  Debugger–  Analyzerand–  GraphicsInspector

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 11

Integrateddevelopmentenvironments

NetBeans

•  Crosspladorm•  OriginallyaJavaIDE•  Opensource•  AbundleavailableforC/C++development

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 12

Integrateddevelopmentenvironments

NetBeans

•  NobundlesforCUDA•  Canbesetupto–  highlightCUDAsyntax–  compileusingnvcc

•  DebuggingperhapsnotpossiblethroughIDE

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 13

Integrateddevelopmentenvironments

Eclipse

•  Crosspladorm•  OriginallyaJavaIDE•  TheCDTpluginavailableforC/C++development

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 14

Integrateddevelopmentenvironments

Eclipse•  PluginsforCUDAnotavailable

•  Canbesetupto–  highlightCUDAsyntax–  compileusingnvcc

•  ProblemswithcorrecAngCUDAcalls

•  CUDAdebuggingnotyetsupported

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 15

Conclusions

•  AlltoolssAllintheirinfancy•  IDEsnotreadyoutofthebox•  MostexamplesconcernCUDA•  Debuggingtoolsarelimited

•  Thefieldisgrowing•  AnintegratedenvironmentforGPGPUdevelopment

11.2.2010 GPGPU–IDEsandTools/TeppoValtonen 16