PyCUDA: Even Simpler GPU Programming with Python
65 Pages
English

PyCUDA: Even Simpler GPU Programming with Python

-

Downloading requires you to have access to the YouScribe library
Learn all about the services we offer

Description

GPU Scripting PyOpenCL News RTCG ShowcasePyCUDA: Even SimplerGPU Programming with PythonAndreas Kl ocknerCourant Institute of Mathematical SciencesNew York UniversityNvidia GTC September 22, 2010Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with PythonGPU Scripting PyOpenCL News RTCG ShowcaseThanksJan Hesthaven (Brown)Tim Warburton (Rice)Leslie Greengard (NYU)PyCUDA contributorsPyOpenCL contributorsNvidia CorporationAndreas Kl ockner PyCUDA: Even Simpler GPU Programming with PythonGPU Scripting PyOpenCL News RTCG ShowcaseOutline1 Scripting GPUs with PyCUDA2 PyOpenCL3 The News4 Run-Time Code Generation5 ShowcaseAndreas Kl ockner PyCUDA: Even Simpler GPU Programming with PythonGPU Scripting PyOpenCL News RTCG Showcase Overview Being ProductiveOutline1 Scripting GPUs with PyCUDAPyCUDA: An OverviewDo More, Faster with PyCUDA2 PyOpenCL3 The News4 Run-Time Code Generation5 ShowcaseAndreas Kl ockner PyCUDA: Even Simpler GPU Programming with PythonGPU Scripting PyOpenCL News RTCG Showcase Overview Being ProductiveWhetting your appetite1 import pycuda.driver as cuda2 import p.autoinit , pycuda.compiler3 import numpy45 a = numpy.random.randn(4,4).astype(numpy. oat32)6 a gpu = cuda.mem alloc(a.nbytes)7 cuda.memcpy htod(a gpu, a)[This is examples/demo.py in the PyCUDA distribution.]Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with PythonCompute kernelGPU Scripting PyOpenCL News RTCG Showcase Overview Being ...

Subjects

Informations

Published by
Published 24 June 2011
Reads 0
Language English
Document size 4 MB
GPU Scripting PyOpenCL News RTCG Showcase PyCUDA: Even Simpler GPU Programming with Python Andreas Kl ockner Courant Institute of Mathematical Sciences New York University Nvidia GTC September 22, 2010 Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python GPU Scripting PyOpenCL News RTCG Showcase Thanks Jan Hesthaven (Brown) Tim Warburton (Rice) Leslie Greengard (NYU) PyCUDA contributors PyOpenCL contributors Nvidia Corporation Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python GPU Scripting PyOpenCL News RTCG Showcase Outline 1 Scripting GPUs with PyCUDA 2 PyOpenCL 3 The News 4 Run-Time Code Generation 5 Showcase Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python GPU Scripting PyOpenCL News RTCG Showcase Overview Being Productive Outline 1 Scripting GPUs with PyCUDA PyCUDA: An Overview Do More, Faster with PyCUDA 2 PyOpenCL 3 The News 4 Run-Time Code Generation 5 Showcase Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python GPU Scripting PyOpenCL News RTCG Showcase Overview Being Productive Whetting your appetite 1 import pycuda.driver as cuda 2 import p.autoinit , pycuda.compiler 3 import numpy 4 5 a = numpy.random.randn(4,4).astype(numpy. oat32) 6 a gpu = cuda.mem alloc(a.nbytes) 7 cuda.memcpy htod(a gpu, a) [This is examples/demo.py in the PyCUDA distribution.] Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python Compute kernel GPU Scripting PyOpenCL News RTCG Showcase Overview Being Productive Whetting your appetite 1 mod = pycuda.compiler.SourceModule(""" 2 global void twice( oat a) 3 f 4 int idx = threadIdx.x + threadIdx.y4; 5 a[ idx ] = 2; 6 g 7 """) 8 9 func = mod.get function("twice") 10 func(a gpu, block=(4,4,1)) 11 12 a doubled = numpy.empty like(a) 13 cuda.memcpy dtoh(a doubled, a gpu) 14 print a doubled 15 print a Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python GPU Scripting PyOpenCL News RTCG Showcase Overview Being Productive Whetting your appetite 1 mod = pycuda.compiler.SourceModule(""" 2 global void twice( oat a) 3 f 4 int idx = threadIdx.x + threadIdx.y4; 5 a[ idx ] = 2; Compute kernel6 g 7 """) 8 9 func = mod.get function("twice") 10 func(a gpu, block=(4,4,1)) 11 12 a doubled = numpy.empty like(a) 13 cuda.memcpy dtoh(a doubled, a gpu) 14 print a doubled 15 print a Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python GPU Scripting PyOpenCL News RTCG Showcase Overview Being Productive Why do Scripting for GPUs? GPUs are everything that scripting languages are not. Highly parallel Very architecture-sensitive Built for maximum FP/memory throughput ! complement each other CPU: largely restricted to control tasks (1000/sec) Scripting fast enough Python + CUDA = PyCUDA Python + OpenCL = PyOpenCL Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python GPU Scripting PyOpenCL News RTCG Showcase Overview Being Productive Scripting: Python One example of a scripting language: Python Mature Large and active community Emphasizes readability Written in widely-portable C A ‘multi-paradigm’ language Rich ecosystem of sci-comp related software Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python GPU Scripting PyOpenCL News RTCG Showcase Overview Being Productive Scripting: Interpreted, not Compiled Program creation work ow: Edit Compile Link Run Andreas Kl ockner PyCUDA: Even Simpler GPU Programming with Python