SlideShare a Scribd company logo
GPU programming with Java

               Pramuditha Aravinda.
                 Kelum Senanayake.
Outline
   What is GPU.
   CPU vs. GPU Architecture.
   What is Stream processing.
   General Purpose GPU.
   CUDA.
   OpenCL
   Demo
What is GPU
   Graphics processing unit.
       Specialized microprocessor.
   Very efficient at manipulating computer graphics.
   Offloads and accelerates graphics rendering from the
    CPU.
   Dedicated to calculating floating point operations.
   Highly parallel structure.
       More effective for a range of complex algorithms.
   GPU can be present on,
       Video card.
       Motherboard
       CPU die (certain Core Intel CPUs)
CPU vs. GPU Architecture




       The GPU devotes more transistors to data processing.

     GPU : A Highly Parallel, Multithreaded, Manycore Processor
CPU vs. GPU contd…
What is Stream processing
   Is a computer programming paradigm, related to SIMD.
   Allows applications to easily exploit a limited form of
    parallel processing.
   Terminology
       Stream :- A set of data
       Kernel functions :- A series of operations
   Uniform streaming :- One kernel function is applied to all
    elements in the stream.
   Stream processing is driven by a data-centric model
       Image, video and digital signal processing
   Less efficient in general purpose processing with more
    randomized data access (such as databases)
General Purpose GPU
   The GPU is, by design, a stream processing system.
   GPGPU is a programming methodology.
       Modifying algorithms to run on existing GPU hardware
   Capable of performing simple operations on a stream of
    input data with amazing speed.
   Allows software developers to use stream processing on
    non-graphics data.
How hard is it?
   The languages are not very easy to use. Most GPU cards
    still operate on assembly language.
   The process flow is unique. Typically simple branching
    statement, such as if statements, offer such a performance
    penalty that it is often faster to process both conditions.
   The unique Stream-In-Stream-Out design is not typically
    used in CPU programs.
   The need to work with geometric primitives in order to
    push mathematical inputs to the system.
   Rapidly growing community.
Programming GPUs!
   Plenty of interfaces
       Compute Unified Device Architecture (CUDA)
       OpenCL
       OpenGL Shader Language (GLSL)
       DirectX/DirectCompute/HLSL
       ATI Stream
CUDA
   Compute Unified Device Architecture.
   Parallel computing architecture developed by NVIDIA.
   Programmers use C for CUDA.
       C with NVIDIA extensions and certain restrictions.
   Third party wrappers are also available for Python, Perl,
    Fortran, Java, Ruby, Lua, MATLAB and IDL.
   Currently used in,
       SETI@Home
       Distributed Calculations, such as predicting the native
        conformation of proteins
       Accelerated inter conversion of video file formats
       Physical simulations, in particular in fluid dynamics
CUDA Processing Flow
OpenCL
   Open Computing Language.
   Managed by the non-profit technology consortium
    Khronos Group
   Framework for writing programs that execute across
    heterogeneous platforms consisting of CPUs, GPUs, and
    other processors.
   Includes a language (based on C99) for writing kernels.
   APIs to define and then control the platforms.
   Supports both AMD/ATI and NVIDIA.
Programming GPU with Java and
OpenCL
   We need to program using a GPGPU driver
   However most GPGPU drivers are available as a native dll
    only.
   We need another layer to interface to Java runtime.
   Called Java Binding
Java Binding

               UserProgram.class




                    Jocl.jar




                    Jocl.dll




                  OpenCL.dll
Prerequisites - Hardware
   OpenCL capable graphic card.
   nVidea – All CUDA enabled GPU have OpenCL support.
       GeForce 8xxx or higher with 256MB minimum.
       http://www.nvidia.com/object/cuda_gpus.html
   AMD ATI Radeon™ HD 5400 or higher, AMD Radeon™
    HD 6800 series or higher.
       AMD X86 CPU w/ SSE 2.x or later are also supported.
       http://developer.amd.com/gpu/AMDAPPSDK/pages/DriverCom
        patibility.aspx
Prerequisites - Software
   OpenCL driver. – for nVidia GPUs, Usually OpenCL
    drivers are distributed with graphic card drivers.
       http://developer.nvidia.com/object/opencl-download.html
   Java bindings for OpenCL. – Usually there are two parts
       Platform dependent dll. e.g. jocl-windows-x86.dll
       Platform independent jar file. Jocl.jar
       There are few Implementations.
        http://jogamp.org/deployment/webstart/archive/jocl-0.9-b1-
        20101213-windows-i586.zip
   JDK
       http://www.oracle.com/technetwork/java/javase/downloads/ind
        ex.html
Demo Program
   Based on sample program available at
    http://jogamp.org/wiki/index.php/JOCL_Tutorial
GPU Programming with Java
Ad

Recommended

Linux Interrupts
Linux Interrupts
Kernel TLV
 
Gpu
Gpu
hashim102
 
Android Screen Containers & Layouts
Android Screen Containers & Layouts
Vijay Rastogi
 
1. over view and history of c
1. over view and history of c
Harish Kumawat
 
OOP in C++
OOP in C++
ppd1961
 
DMA operation
DMA operation
Imran Khan
 
Classification of Programming Languages
Classification of Programming Languages
Project Student
 
Direct memory access (dma)
Direct memory access (dma)
Zubair Khalid
 
Golang
Golang
Software Infrastructure
 
Real time scheduling - basic concepts
Real time scheduling - basic concepts
Student
 
Why programming is important
Why programming is important
Aman Kumar
 
C language ppt
C language ppt
Ğäùråv Júñêjå
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)
Aaron Schlesinger
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
Opersys inc.
 
ARM
ARM
Pune University
 
Programming in c
Programming in c
ankitjain851
 
Designing of media player
Designing of media player
Nur Islam
 
C notes for exam preparation
C notes for exam preparation
Lakshmi Sarvani Videla
 
Functions in C++
Functions in C++
Mohammed Sikander
 
Introduction to DirectX 11
Introduction to DirectX 11
Krzysztof Marciniak
 
Polymorphism in c++(ppt)
Polymorphism in c++(ppt)
Sanjit Shaw
 
Graphics processing unit ppt
Graphics processing unit ppt
Sandeep Singh
 
TFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU Delegates
Koan-Sin Tan
 
GRAPHICS PROCESSING UNIT (GPU)
GRAPHICS PROCESSING UNIT (GPU)
self employed
 
Pentium (80586) Microprocessor By Er. Swapnil Kaware
Pentium (80586) Microprocessor By Er. Swapnil Kaware
Prof. Swapnil V. Kaware
 
Header files in c
Header files in c
HoneyChintal
 
Go Programming Language by Google
Go Programming Language by Google
Uttam Gandhi
 
Java on the GPU: Where are we now?
Java on the GPU: Where are we now?
Dmitry Alexandrov
 
GPU Computing: A brief overview
GPU Computing: A brief overview
Rajiv Kumar
 

More Related Content

What's hot (20)

Golang
Golang
Software Infrastructure
 
Real time scheduling - basic concepts
Real time scheduling - basic concepts
Student
 
Why programming is important
Why programming is important
Aman Kumar
 
C language ppt
C language ppt
Ğäùråv Júñêjå
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)
Aaron Schlesinger
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
Opersys inc.
 
ARM
ARM
Pune University
 
Programming in c
Programming in c
ankitjain851
 
Designing of media player
Designing of media player
Nur Islam
 
C notes for exam preparation
C notes for exam preparation
Lakshmi Sarvani Videla
 
Functions in C++
Functions in C++
Mohammed Sikander
 
Introduction to DirectX 11
Introduction to DirectX 11
Krzysztof Marciniak
 
Polymorphism in c++(ppt)
Polymorphism in c++(ppt)
Sanjit Shaw
 
Graphics processing unit ppt
Graphics processing unit ppt
Sandeep Singh
 
TFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU Delegates
Koan-Sin Tan
 
GRAPHICS PROCESSING UNIT (GPU)
GRAPHICS PROCESSING UNIT (GPU)
self employed
 
Pentium (80586) Microprocessor By Er. Swapnil Kaware
Pentium (80586) Microprocessor By Er. Swapnil Kaware
Prof. Swapnil V. Kaware
 
Header files in c
Header files in c
HoneyChintal
 
Go Programming Language by Google
Go Programming Language by Google
Uttam Gandhi
 
Real time scheduling - basic concepts
Real time scheduling - basic concepts
Student
 
Why programming is important
Why programming is important
Aman Kumar
 
Why you should care about Go (Golang)
Why you should care about Go (Golang)
Aaron Schlesinger
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
Opersys inc.
 
Designing of media player
Designing of media player
Nur Islam
 
Polymorphism in c++(ppt)
Polymorphism in c++(ppt)
Sanjit Shaw
 
Graphics processing unit ppt
Graphics processing unit ppt
Sandeep Singh
 
TFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU Delegates
Koan-Sin Tan
 
GRAPHICS PROCESSING UNIT (GPU)
GRAPHICS PROCESSING UNIT (GPU)
self employed
 
Pentium (80586) Microprocessor By Er. Swapnil Kaware
Pentium (80586) Microprocessor By Er. Swapnil Kaware
Prof. Swapnil V. Kaware
 
Go Programming Language by Google
Go Programming Language by Google
Uttam Gandhi
 

Similar to GPU Programming with Java (20)

Java on the GPU: Where are we now?
Java on the GPU: Where are we now?
Dmitry Alexandrov
 
GPU Computing: A brief overview
GPU Computing: A brief overview
Rajiv Kumar
 
Newbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universe
Ofer Rosenberg
 
SeaJUG 5 15-2018
SeaJUG 5 15-2018
Will Iverson
 
NVIDIA CUDA
NVIDIA CUDA
Jungsoo Nam
 
Cuda intro
Cuda intro
Anshul Sharma
 
Introduction to Accelerators
Introduction to Accelerators
Dilum Bandara
 
Achieving Improved Performance In Multi-threaded Programming With GPU Computing
Achieving Improved Performance In Multi-threaded Programming With GPU Computing
Mesbah Uddin Khan
 
GPU in Computer Science advance topic .pptx
GPU in Computer Science advance topic .pptx
HamzaAli998966
 
Lecture2 cuda spring 2010
Lecture2 cuda spring 2010
haythem_2015
 
Challenges in GPU compilers
Challenges in GPU compilers
AnastasiaStulova
 
Open CL For Haifa Linux Club
Open CL For Haifa Linux Club
Ofer Rosenberg
 
Computing using GPUs
Computing using GPUs
Shree Kumar
 
Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.
J On The Beach
 
lecture11_GPUArchCUDA01.pptx
lecture11_GPUArchCUDA01.pptx
ssuser413a98
 
gpuprogram_lecture,architecture_designsn
gpuprogram_lecture,architecture_designsn
ARUNACHALAM468781
 
Introduction to OpenCL By Hammad Ghulam Mustafa
Introduction to OpenCL By Hammad Ghulam Mustafa
HAMMAD GHULAM MUSTAFA
 
Compute API –Past & Future
Compute API –Past & Future
Ofer Rosenberg
 
Introduction to GPU Programming
Introduction to GPU Programming
Chakkrit (Kla) Tantithamthavorn
 
Graphics processing uni computer archiecture
Graphics processing uni computer archiecture
Haris456
 
Java on the GPU: Where are we now?
Java on the GPU: Where are we now?
Dmitry Alexandrov
 
GPU Computing: A brief overview
GPU Computing: A brief overview
Rajiv Kumar
 
Newbie’s guide to_the_gpgpu_universe
Newbie’s guide to_the_gpgpu_universe
Ofer Rosenberg
 
Introduction to Accelerators
Introduction to Accelerators
Dilum Bandara
 
Achieving Improved Performance In Multi-threaded Programming With GPU Computing
Achieving Improved Performance In Multi-threaded Programming With GPU Computing
Mesbah Uddin Khan
 
GPU in Computer Science advance topic .pptx
GPU in Computer Science advance topic .pptx
HamzaAli998966
 
Lecture2 cuda spring 2010
Lecture2 cuda spring 2010
haythem_2015
 
Challenges in GPU compilers
Challenges in GPU compilers
AnastasiaStulova
 
Open CL For Haifa Linux Club
Open CL For Haifa Linux Club
Ofer Rosenberg
 
Computing using GPUs
Computing using GPUs
Shree Kumar
 
Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.
J On The Beach
 
lecture11_GPUArchCUDA01.pptx
lecture11_GPUArchCUDA01.pptx
ssuser413a98
 
gpuprogram_lecture,architecture_designsn
gpuprogram_lecture,architecture_designsn
ARUNACHALAM468781
 
Introduction to OpenCL By Hammad Ghulam Mustafa
Introduction to OpenCL By Hammad Ghulam Mustafa
HAMMAD GHULAM MUSTAFA
 
Compute API –Past & Future
Compute API –Past & Future
Ofer Rosenberg
 
Graphics processing uni computer archiecture
Graphics processing uni computer archiecture
Haris456
 
Ad

More from Kelum Senanayake (10)

Couchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
Kelum Senanayake
 
Node.js Introduction
Node.js Introduction
Kelum Senanayake
 
What you need to know about GC
What you need to know about GC
Kelum Senanayake
 
A Searchable Symmetric Key Cipher System
A Searchable Symmetric Key Cipher System
Kelum Senanayake
 
Blind Signature Scheme
Blind Signature Scheme
Kelum Senanayake
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
Kelum Senanayake
 
Security Risks & Vulnerabilities in Skype
Security Risks & Vulnerabilities in Skype
Kelum Senanayake
 
The NFS Version 4 Protocol
The NFS Version 4 Protocol
Kelum Senanayake
 
Knight's Tour
Knight's Tour
Kelum Senanayake
 
How to Share a Secret
How to Share a Secret
Kelum Senanayake
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
Kelum Senanayake
 
What you need to know about GC
What you need to know about GC
Kelum Senanayake
 
A Searchable Symmetric Key Cipher System
A Searchable Symmetric Key Cipher System
Kelum Senanayake
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
Kelum Senanayake
 
Security Risks & Vulnerabilities in Skype
Security Risks & Vulnerabilities in Skype
Kelum Senanayake
 
The NFS Version 4 Protocol
The NFS Version 4 Protocol
Kelum Senanayake
 
Ad

Recently uploaded (20)

ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
Publishing Your Memoir with Brooke Warner
Publishing Your Memoir with Brooke Warner
Brooke Warner
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
TechSoup
 
Communicable Diseases and National Health Programs – Unit 9 | B.Sc Nursing 5t...
Communicable Diseases and National Health Programs – Unit 9 | B.Sc Nursing 5t...
RAKESH SAJJAN
 
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
RAKESH SAJJAN
 
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
RAKESH SAJJAN
 
LDM Recording Presents Yogi Goddess by LDMMIA
LDM Recording Presents Yogi Goddess by LDMMIA
LDM & Mia eStudios
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
LDMMIA Practitioner Level Orientation Updates
LDMMIA Practitioner Level Orientation Updates
LDM & Mia eStudios
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
 
“THE BEST CLASS IN SCHOOL”. _
“THE BEST CLASS IN SCHOOL”. _
Colégio Santa Teresinha
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
Publishing Your Memoir with Brooke Warner
Publishing Your Memoir with Brooke Warner
Brooke Warner
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
TechSoup
 
Communicable Diseases and National Health Programs – Unit 9 | B.Sc Nursing 5t...
Communicable Diseases and National Health Programs – Unit 9 | B.Sc Nursing 5t...
RAKESH SAJJAN
 
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
RAKESH SAJJAN
 
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
RAKESH SAJJAN
 
LDM Recording Presents Yogi Goddess by LDMMIA
LDM Recording Presents Yogi Goddess by LDMMIA
LDM & Mia eStudios
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
LDMMIA Practitioner Level Orientation Updates
LDMMIA Practitioner Level Orientation Updates
LDM & Mia eStudios
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 

GPU Programming with Java

  • 1. GPU programming with Java Pramuditha Aravinda. Kelum Senanayake.
  • 2. Outline  What is GPU.  CPU vs. GPU Architecture.  What is Stream processing.  General Purpose GPU.  CUDA.  OpenCL  Demo
  • 3. What is GPU  Graphics processing unit.  Specialized microprocessor.  Very efficient at manipulating computer graphics.  Offloads and accelerates graphics rendering from the CPU.  Dedicated to calculating floating point operations.  Highly parallel structure.  More effective for a range of complex algorithms.  GPU can be present on,  Video card.  Motherboard  CPU die (certain Core Intel CPUs)
  • 4. CPU vs. GPU Architecture The GPU devotes more transistors to data processing. GPU : A Highly Parallel, Multithreaded, Manycore Processor
  • 5. CPU vs. GPU contd…
  • 6. What is Stream processing  Is a computer programming paradigm, related to SIMD.  Allows applications to easily exploit a limited form of parallel processing.  Terminology  Stream :- A set of data  Kernel functions :- A series of operations  Uniform streaming :- One kernel function is applied to all elements in the stream.  Stream processing is driven by a data-centric model  Image, video and digital signal processing  Less efficient in general purpose processing with more randomized data access (such as databases)
  • 7. General Purpose GPU  The GPU is, by design, a stream processing system.  GPGPU is a programming methodology.  Modifying algorithms to run on existing GPU hardware  Capable of performing simple operations on a stream of input data with amazing speed.  Allows software developers to use stream processing on non-graphics data.
  • 8. How hard is it?  The languages are not very easy to use. Most GPU cards still operate on assembly language.  The process flow is unique. Typically simple branching statement, such as if statements, offer such a performance penalty that it is often faster to process both conditions.  The unique Stream-In-Stream-Out design is not typically used in CPU programs.  The need to work with geometric primitives in order to push mathematical inputs to the system.  Rapidly growing community.
  • 9. Programming GPUs!  Plenty of interfaces  Compute Unified Device Architecture (CUDA)  OpenCL  OpenGL Shader Language (GLSL)  DirectX/DirectCompute/HLSL  ATI Stream
  • 10. CUDA  Compute Unified Device Architecture.  Parallel computing architecture developed by NVIDIA.  Programmers use C for CUDA.  C with NVIDIA extensions and certain restrictions.  Third party wrappers are also available for Python, Perl, Fortran, Java, Ruby, Lua, MATLAB and IDL.  Currently used in,  SETI@Home  Distributed Calculations, such as predicting the native conformation of proteins  Accelerated inter conversion of video file formats  Physical simulations, in particular in fluid dynamics
  • 12. OpenCL  Open Computing Language.  Managed by the non-profit technology consortium Khronos Group  Framework for writing programs that execute across heterogeneous platforms consisting of CPUs, GPUs, and other processors.  Includes a language (based on C99) for writing kernels.  APIs to define and then control the platforms.  Supports both AMD/ATI and NVIDIA.
  • 13. Programming GPU with Java and OpenCL  We need to program using a GPGPU driver  However most GPGPU drivers are available as a native dll only.  We need another layer to interface to Java runtime.  Called Java Binding
  • 14. Java Binding UserProgram.class Jocl.jar Jocl.dll OpenCL.dll
  • 15. Prerequisites - Hardware  OpenCL capable graphic card.  nVidea – All CUDA enabled GPU have OpenCL support.  GeForce 8xxx or higher with 256MB minimum.  http://www.nvidia.com/object/cuda_gpus.html  AMD ATI Radeon™ HD 5400 or higher, AMD Radeon™ HD 6800 series or higher.  AMD X86 CPU w/ SSE 2.x or later are also supported.  http://developer.amd.com/gpu/AMDAPPSDK/pages/DriverCom patibility.aspx
  • 16. Prerequisites - Software  OpenCL driver. – for nVidia GPUs, Usually OpenCL drivers are distributed with graphic card drivers.  http://developer.nvidia.com/object/opencl-download.html  Java bindings for OpenCL. – Usually there are two parts  Platform dependent dll. e.g. jocl-windows-x86.dll  Platform independent jar file. Jocl.jar  There are few Implementations. http://jogamp.org/deployment/webstart/archive/jocl-0.9-b1- 20101213-windows-i586.zip  JDK  http://www.oracle.com/technetwork/java/javase/downloads/ind ex.html
  • 17. Demo Program  Based on sample program available at http://jogamp.org/wiki/index.php/JOCL_Tutorial