1 / 96

Light Hearted Look At GPU Programming And Linear Algebra Operators

Light Hearted Look At GPU Programming And Linear Algebra Operators. Pass Out (3) Papers And GPUGems Book Book Has Some Nice Graphics. Demos. Pyramids Demo Blackbox. Codecreatures Demo. Benchmarks!. What Are The Differences Between These Demos?. Food For Thought

gwylan
Download Presentation

Light Hearted Look At GPU Programming And Linear Algebra Operators

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Light Hearted Look AtGPU Programming And Linear Algebra Operators

  2. Pass Out (3) PapersAnd GPUGems BookBook Has Some Nice Graphics

  3. Demos

  4. Pyramids DemoBlackbox

  5. Codecreatures Demo Benchmarks!

  6. What Are The Differences Between These Demos?

  7. Food For Thought Science/Education Versus Entertainment? “Edutainment”? Is “User Friendliness” The Same? To Me, The Codecreatures Demo Was State Of The Art! Probably To Some Video Gamers, It’s Old Hat! I Assume This Code Is Really Taking Advantage Of The GPU

  8. “The Continuum” User Friendliness small medium large Assembly Programming  “GPU Programming”  Monitor Programming  4GL, 5GL, …? What, Exactly, Is Happening On The GPU? Probably Don’t Know Exactly SDKS e.g. Visual Studio

  9. My Continuum GPU Knowledge small medium large Prof Bailey (and Prof Zhang and Jacob) Me

  10. ;-) :-)

  11. What’s On the GPU,What’s on the CPU? “Don’t Ask Me!”

  12. Is the GPU Synonymous With the Graphics Card? “Yes, close enough.  The GPU is actually the processor chip that lives on the graphics card.  The "graphics card" has a bunch of other stuff on it to support the GPU and its operations, plus memory, bus interaction, etc.” Mike Bailey

  13. Gonna Wear This One Out!

  14. GPU/ Graphics Card ?

  15. CPU, Bus, VP, FP, bunch of other stuff

  16. Benchmarking (CPU) (BUS)

  17. Benchmarking (VP) (FP) Science? Entertainment?

  18. Benchmarking glFinish(); int t0 = glutGet( GLUT_ELAPSED_TIME ); << All Graphics Calls That You Are Testing The Speed Of >> glFinish(); int t1 = glutGet( GLUT_ELAPSED_TIME ); glutSwapBuffers(); fprintf( stderr, "One display frame took %d milliseconds\n", t1 - t0 );

  19. What’s On the GPU,What’s On the CPU? How Well Do We Know The Hardware/Software Boundary?

  20. // minimal vertex shader // www.lighthouse3d.com void main() { // the following three lines provide the same result // gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; // gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; gl_Position = ftransform(); } Simplest Shader Program You Will Ever See! The end result is of course the same. Does this guarantee the same transformation as in the fixed functionality? Well in theory yes, but in practice the process of transforming the vertices may not follow the same order as in here. This is normally a highly optimized task in a graphic card, and a special function is provided to take advantage of that optimization. Another reason for this function is due to the limit in the precision of the float data type. When calculus is done in different orders, different results may be obtained due to this limited precision. Hence the GLSL provides a function that guarantees that not only the best performance is obtained but also that the result is always the same as when using the fixed functionality. This magical function is: vec4 ftransform(void); This function returns the transformed incoming vertex, following the same steps as the fixed functionality does. http://www.lighthouse3d.com/opengl/glsl/index.php?minimal Jumping Ahead: Specific Code, But Takeaway Is Some Uncertainty In Implementation

  21. GPU Overview

  22. What is the GPU? “Graphical Processing Unit”

  23. How We Gonna Dive In?

  24. GLSL/GLman Orientation GLSL - (Relatively) User Friendly GLman - User Friendly Good Demos Available (e.g. Pyramids) (Simple, Less Powerful, Less User Friendly Visual Studio Demos/Prototypes Do Exist And Will Be Overviewed

  25. GLSL/GLman Orientation

  26. “GLman is written in OpenGL.  It is meant to be a scripting system to make it easy to explore GPU programming, so internally it takes care of a lot of the boilerplate of writing GPU-based programs, leaving you just to write the GPU code.  So, the .glib files are the script, and the .vert and .frag files are the vertex and fragment GPU code.” Mike Bailey http://web.engr.oregonstate.edu/~mjb/cs519/Handouts/Glman/glman.pdf

  27. GLSL/GLman Orientation Glman Lets You Concentrate On: Vertex Processor - .vert file // text file Fragment Processor - .frag file // text file

  28. GLSL/GLman Orientation Glman makes this part easy

  29. GLSL/GLman Orientation Simple/ Standalone Visual Studio Demo Apps Available, And Will Be Looked At

  30. Why Use the GPU?

  31. “The rasterizer is a part of the GPU, but its functionality can't becustomized by the user, other than sending user-defined variablesthrough it to be interpolated.” Mike Bailey

  32. Rasterizer In The “Bunch Of Other Stuff” Category ?

  33. GPU versus CPU “The distinction is becoming more and more blurred, but the basic difference is that GPUs have certain architectural changes that appeal more to graphics, such as more cores, less cache,and special texture fetching hardware.” Mike Bailey Can’t Do Recursion On The GPU!!!

  34. GPU versus CPU Can’t Do Recursion On The GPU!!! CPU – double oriented GPU – float oriented

  35. Multi Cores  Parallelism Less Cache  Streaming Texture (Local) Memory  Reduced Bus Activity

  36. GPU versus CPU

  37. http://www.springerlink.com/content/eupfj7euk0jvj98u/fulltext.pdfhttp://www.springerlink.com/content/eupfj7euk0jvj98u/fulltext.pdf [Chiang, Hsueh, Liu]

  38. GPU versus CPU

  39. GPU versus CPU We’ll take a quick look at these (mostly linear operator) terms shortly

  40. http://ieeexplore.ieee.org/iel5/4221378/4221379/04221459.pdf ?tp=&isnumber=&arnumber=4221459 [Gong, Langille, Gong]

  41. GPU Typical Programming Environment GLSL - OpenGL Shading Language HLSL - DirectX's high-level shading language Cg – C For Graphics …

  42. Vertex Shader Program(ming) Fragment Shader Program(ming) each with a main() examples shortly

  43. Specific Linear Operators Matrices for Multiplication Matrices for Differentiation – e.g. Sobel Filter

  44. Specific Linear Operators Data Types vec2 texcoord1, texcoord2; vec3 position; vec4 myRGBA; ivec2 textureLookup; bvec3 less;

  45. Specific Linear Operators Data Types mat2 mat2D; mat3 optMatrix; mat4 view, projection; mat4x4 view; // an alternate way of declaring a mat4 mat3x2 m; // a matrix with 3 columns and 2 rows

  46. Specific Linear Operators Constructors vec3(float) // initializes each component of with the float vec4(ivec4) // makes a vec4 with component-wise conversion vec2(float, float) // initializes a vec2 with 2 floats ivec3(int, int, int) // initializes an ivec3 with 3 ints bvec4(int, int, float, float) // uses 4 Boolean conversions vec2(vec3) // drops the third component of a vec3 vec3(vec4) // drops the fourth component of a vec4 vec3(vec2, float) // vec3.x = vec2.x, vec3.y = vec2.y, vec3.z = float vec3(float, vec2) // vec3.x = float, vec3.y = vec2.x, vec3.z = vec2.y vec4(vec3, float) // We’’ll See An Application Of One Of These vec4(float, vec3) // Or Something Similar vec4(vec2, vec2)

  47. Specific Linear Operators http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf

  48. Specific Linear Operators Testing/ Benchmarking

More Related