Der Goopax Compiler GPU-Programmierung in C++ ZKI AK-Supercomputing, Münster, 27.03.2014, Ingo Josopait



Ähnliche Dokumente
Einleitung. Informationsquellen: - Webseite zur Vorlesung, Abschnitt Informationen zu C und C++ Kurzeinführung in C/C++

Grundlagen C und C++ Einheit 03: Grundlagen in C++ Lorenz Schauer Lehrstuhl für Mobile und Verteilte Systeme

Programmentwicklung mit C++ (unter Unix/Linux)

Algorithmen zur Datenanalyse in C++

Funktionen Häufig müssen bestimmte Operationen in einem Programm mehrmals ausgeführt werden. Schlechte Lösung: Gute Lösung:

2. Semester, 2. Prüfung, Lösung

Kurzeinführung in C/C++ Informationsquellen: - Webseite zur Vorlesung, Abschnitt Informationen zu C und C++ Einleitung

Informatik I (D-MAVT)

Kurze Einführung in die Programmiersprache C++ und in Root

DAP2-Programmierpraktikum Einführung in C++ (Teil 1)

Einführung in die C++ Programmierung für Ingenieure

0. Einführung & Motivation

Einführung in die Programmierung

Übersicht. Race Conditions Buffer Overflows Heap Overflows Exkurs: Stackaufbau bei Intel x86 Exkurs: Shellcode Stack Overflows

C++ Kurs Teil 1. Architektur, Anwendungsspektrum, primitive Datentypen, Funktionsaufrufe, Referenzen, Klassen

Klausur in Programmieren

Vergleich verschiedener OO-Programmiersprachen

Einführung Sprachfeatures Hinweise, Tipps und Styleguide Informationen. Einführung in C. Patrick Schulz

MPI-Programmierung unter Windows mit MPICH2. Installieren von MPICH2, Übersetzen, Ausführen und Debuggen von MPI-Programmen. Christian Terboven

OpenCL Implementierung von OpenCV Funktionen

Grundlagen von C. Ausarbeitung von Jonas Gresens

Programmierbeispiele und Implementierung. Name: Michel Steuwer

Einführung Datentypen Verzweigung Schleifen Funktionen Dynamische Datenstrukturen. Java Crashkurs. Kim-Manuel Klein

0. Einführung & Motivation

Einführung in die C-Programmierung

Einführung in die Programmierung (EPR)

Programmierung von Graphikkarten

Interaktive Simulationen Lektion 1/3: Event-Driven Design und Signals

Computergrundlagen Programmieren in C

Einführung in C ++ und die Objektorientierte Programierung

1. Vom Sourcecode zum Programm

Computergrundlagen Programmieren in C

Objektorientierte Programmierung mit C++ (WS 2010)

Hochschule Darmstadt Informatik-Praktikum (INF 1) WS 2015/2016 Wirtschaftsingenieur Bachelor 5. Aufgabe Datenstruktur, Dateieingabe und -ausgabe

Objektorientierte Programmierung mit C++ Dr. K. Ahrens

C++ vs. Java. Hello world! Java C++ class HelloWorld { static public void main(string args) { System.out.println("Hello World!

Betriebssysteme: Konzepte, Dienste, Schnittstellen (Betriebssysteme und betriebssystemnahe Programmierung)

Programmiertechnik. Teil 4. C++ Funktionen: Prototypen Overloading Parameter. C++ Funktionen: Eigenschaften

Grundlagen von CUDA, Sprachtypische Elemente

(allgemeine) OOP in C++ Klassen und header-files Konstruktorn / Destruktoren Speicherverwaltung C++ Standard Library / SLT

Codingstandard. Softwareentwicklung Praktikum Stand:

Einführung. GPU-Versuch. Andreas Schäfer Friedrich-Alexander-Universität Erlangen-Nürnberg

Grundlagen von C# - 1

Wintersemester Maschinenbau und Kunststofftechnik. Informatik. Tobias Wolf Seite 1 von 29

Pass by Value Pass by Reference Defaults, Overloading, variable Parameteranzahl

Praktikum im Bereich Praktische Informatik Echtzeitgraphik in C++ und DirectX10. computer graphics & visualization

Themen. Formatierte und unformatierte Eingabe Bedingungsoperator Namespaces Kommandozeilenargumente

Kommunikation. Björn und Georg

virtual Wertpapier& operator=(const Wertpapier&); // VIRTUELLE ZUWEISUNG protected: static enum {wortfeldlaenge = 20}; char* name_z; double kurs; };

CORBA Implementierung von Client und Server

Modellierung und Programmierung

OpenCL. Programmiersprachen im Multicore-Zeitalter. Tim Wiersdörfer

Klausur in Programmieren

Organisatorisches. Einführung in die Programmierung in C Hochschule Regensburg Universitätsstraße 31, Regensburg

0. Erste Schritte REM. Jürgen Mäter Arbeitsgruppe Modellierung und Simulation. Lehrstuhl für Informatik 4 TU Dortmund

Quiz und Übungen. C++ Übung am 19. Mai 2016

C++ - Eine Ubersicht fur Java-Programmierer

Von Java nach C++ Dr. Frank Weichert Lehrstuhl Informatik VII Technische Universität Dortmund

Von Java nach C++ Frank Weichert, Heinrich Müller Informatik VII Universität Dortmund

Programmieren 3 C++ Prof. Peter Sommerlad Fredy Ulmer

AlDaBi Praktikum WS 15/16 Hannes Hauswedell, Johannes Röhr, Jongkyu Kim

Der C++ Crashkurs v1.0

Unterprogramme. Funktionen. Bedeutung von Funktionen in C++ Definition einer Funktion. Definition einer Prozedur

Short Introduction to C# C# (C SHARP) Microsofts Antwort auf Java

Anleitung zur Einrichtung von OpenCV

C++ - Funktionen und mehr. Kerstin Gößner und Ralf Wondratschek

Angewandte Mathematik und Programmierung

Praktikum Betriebssysteme 1. Aufgabe (1)

Einleitung Grundlagen Erweiterte Grundlagen Zusammenfassung Literatur. C: Funktionen. Philip Gawehn

Einführung in die Programmiersprache C

Vorlesung Informatik II

Einführung in die Programmierung Wintersemester 2016/17


Multi- und Many-Core

Berner Fachhochschule Hochschule für Technik und Informatik HTI. Kapitel 1. Einstieg in Java. Dr. Elham Firouzi

Klausur zu Objektorientierter Softwareentwicklung in C++ 4. Februar 2003 (WS 2002/2003) Beispiellösung

Software ubiquitärer Systeme 1. Übung

Software ubiquitärer Systeme 1. Übung

Anleitung zur Einrichtung von OpenCV

Hello World. Javakurs 2014, 1. Vorlesung. Sebastian Schuck. basierend auf der Vorlage von Arne Kappen. wiki.freitagsrunde.org. 3.

Die Bildbearbeitungssprache Halide

printf("%c \n", 'd'); printf("%lx \n", 32L); printf("%o \n", 64); printf("%f \n", 1.0E-2); printf("%d \n", '\r'); printf("%f \n", 1.0/2.

Einleitung Entwicklung in C Hello-World! Konstrukte in C Zusammenfassung Literatur. Grundlagen von C. Jonas Gresens

C allgemein. C wurde unter und für Unix entwickelt. Vorläufer sind BCPL und B.

Probeklausur. Musterlösung

C++ Notnagel. Ziel, Inhalt. Programmieren in C++

Applets I. Grundlagen der g Applet-Programmierung

3D Programmierpraktikum: Einführung in C++ - Teil 1

Programmieren in C++ Arrays, Strings und Zeigerarithmetik

OpenCL. OpenCL. Boris Totev, Cornelius Knap

12. Vererbung. Prof. Dr. Markus Gross Informatik I für D-ITET (WS 03/04)

! "eine Zeichenkette\nmit Doppelapostroph \" und Backslash \\"

Objektorientierte Programmierung mit C++ Vector und List

Transkript:

Der Goopax Compiler GPU-Programmierung in C++

AMD R9 290X: 5.6 TFLOPS (SP MulAdd)

Programmierung ~10000 Threads Entwicklungsumgebungen

Entwicklungsumgebungen CUDA, OpenCL Compiler: kernel GPU Maschinencode Trennung CPU/GPU: CPU: C/C++ GPU: kernel void hello( global int* out) int tid = get_global_id(0); out[tid] = tid;

Hello World #include <goopax.h> using namespace goopax; struct hello_world : public kernel void impl() gpu_ostream out(std::cout); out << "Hello from thread " << global_id() << std::endl; ; int main(int argc, char** argv) easy_env Env(argc, argv); hello_world P; P(); Einbindung als Bibliothek GPU-Kernel als Klasse Parsing durch C++-Compiler Programmierung durch spezielle Datentypen: gpu_int, gpu_float,...

#include <goopax.h> #include <goopax/gl_env.h> #include <complex> using namespace goopax; using std::complex; Mandelbrot struct mandelbrot : public kernel const unsigned int width; const unsigned int height; buffer<float> params; void impl() const resource<float> params(this->params); resource<uint32_t> image; const complex<gpu_float> top_left(params[0], params[1]); const gpu_float scale = params[2]; gpu_for_global(k, 0, width*height) const complex<gpu_float> c = top_left + scale * complex<gpu_float>(gpu_float(k%width), gpu_float(k/width)); complex<gpu_float> z(0, 0); gpu_int escape = 0; gpu_for(i, 0, 256) z = z*z + c; escape.cmov(norm(z) < 4.0, i); image[k] = color(escape); static gpu_uint color(const gpu_int escape)

void impl() const resource<float> params(this->params); resource<uint32_t> image; Mandelbrot const complex<gpu_float> top_left(params[0], params[1]); const gpu_float scale = params[2]; gpu_for_global(k, 0, width*height) const complex<gpu_float> c = top_left + scale * complex<gpu_float>(gpu_float(k%width), gpu_float(k/width)); complex<gpu_float> z(0, 0); gpu_int escape = 0; gpu_for(i, 0, 256) z = z*z + c; escape.cmov(norm(z) < 4.0, i); image[k] = color(escape); static gpu_uint color(const gpu_int escape)...

void impl() const resource<float> params(this->params); resource<uint32_t> image; Mandelbrot const complex<gpu_float> top_left(params[0], params[1]); const gpu_float scale = params[2]; gpu_for_global(k, 0, width*height) const complex<gpu_float> c = top_left + scale * complex<gpu_float>(gpu_float(k%width), gpu_float(k/width)); complex<gpu_float> z(0, 0); gpu_int escape = 0; gpu_for(i, 0, 256) z = z*z + c; escape.cmov(norm(z) < 4.0, i); image[k] = color(escape); static gpu_uint color(const gpu_int escape)...

void impl() const resource<float> params(this->params); resource<uint32_t> image; Mandelbrot const complex<gpu_float> top_left(params[0], params[1]); const gpu_float scale = params[2]; gpu_for_global(k, 0, width*height) const complex<gpu_float> c = top_left + scale * complex<gpu_float>(gpu_float(k%width), gpu_float(k/width)); complex<gpu_float> z(0, 0); gpu_int escape = 0; gpu_for(i, 0, 256) z = z*z + c; escape.cmov(norm(z) < 4.0, i); image[k] = color(escape); static gpu_uint color(const gpu_int escape)...

void impl() const resource<float> params(this->params); resource<uint32_t> image; Mandelbrot const complex<gpu_float> top_left(params[0], params[1]); const gpu_float scale = params[2]; gpu_for_global(k, 0, width*height) const complex<gpu_float> c = top_left + scale * complex<gpu_float>(gpu_float(k%width), gpu_float(k/width)); complex<gpu_float> z(0, 0); gpu_int escape = 0; gpu_for(i, 0, 256) z = z*z + c; escape.cmov(norm(z) < 4.0, i); image[k] = color(escape); static gpu_uint color(const gpu_int escape)...

void impl() const resource<float> params(this->params); resource<uint32_t> image; Mandelbrot const complex<gpu_float> top_left(params[0], params[1]); const gpu_float scale = params[2]; gpu_for_global(k, 0, width*height) const complex<gpu_float> c = top_left + scale * complex<gpu_float>(gpu_float(k%width), gpu_float(k/width)); complex<gpu_float> z(0, 0); gpu_int escape = 0; gpu_for(i, 0, 256) z = z*z + c; escape.cmov(norm(z) < 4.0, i); image[k] = color(escape); static gpu_uint color(const gpu_int escape)...

Anwendungsgebiete HPC Simulationen Mathematik Maschinelles Lernen Bitcoins Grafik Computerspiele Virtual Reality Videoschnitt

Goopax: Vorteile OO-Programmierung in C++ CPU/GPU Code bestens integriert Zusätzliche Optimierungen durch maßgeschneiderte Programme Automatisierte Fehlersuche: Array overflows uninitialisierte Variablen Race conditions