26.11.2006 - Axel Schmidt / Raphael Schlameuß1 Benchmark sparc vs. x86 von Axel Schmidt (94416)...

Post on 05-Apr-2015

115 views 0 download

Transcript of 26.11.2006 - Axel Schmidt / Raphael Schlameuß1 Benchmark sparc vs. x86 von Axel Schmidt (94416)...

Benchmarksparc vs. x86

von

Axel Schmidt (94416)

Raphael Schlameuß (100753)

2 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Agenda

Hardware (Sparc, X86) Prozessor-Features (Sparc, X86) Benchmark Probleme ?! Erwartete Ergebnisse Ergebnisse Zusammenfassung Fragen und Anregungen ?

3 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Benchmark - Hardware

SIMBA/SABRE-Chipsatz UltraSparc IIi, 360 MHz,

256 kB L2 2x 128 MB EDO JEDEC

DRAM, 75 MHz Bustakt MDMA-IDE-Controller,

16,7 MB/s 40GB HDD, 7200 min-1,

1863kB Cache ATI 3D Rage Pro PCI, 4MB Netzwerkkarte

HAPPY MEAL

ASUS P3B-F Mainboard Intel 440BX-Chipsatz Pentium II („Deschutes“),

350 MHz, 512 kB L2 2x 128 MB SDRAM,

100 MHz Bustakt UDMA33-IDE-Controller,

33 MB/s 40GB HDD, 7200 min-1,

1719kB Cache ATI 3D Rage Pro AGP, 8MB Netzwerkkarte

Realtek 8139

UltraSparc Pentium II

4 26.11.2006 - Axel Schmidt / Raphael Schlameuß

UltraSparc IIi – Features

Highly Integrated Superscalar-Processor

SPARC-V9 64-Bit-RISC Architektur

VISTM Instruction Set

1 UltraSparc IIi CPU mit 360 MHz Takt

externer Bus-Takt 90 MHz

5 26.11.2006 - Axel Schmidt / Raphael Schlameuß

UltraSparc IIi – Features

Je 16 kB D- und I-Cache (L1)

256 kB L2-Cache (extern, halber CPU-Takt)

4 Integer-, 3 Gleitpunkt- und 1 Graphic-Units

Block-Load/Store-Unit

Registerfile mit 64 Bit Registern

6 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Architektur UltraSparc IIi

7 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Pentium II – Features

Out-of-Order Superskalar Processor Core

CISC mit Dynamic Execution Microarchitecture

1 Intel Pentium II CPU mit 350 MHz Takt

externer Bus-Takt 100 MHz

8 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Pentium II – Features

Je 16 kB D- und I-Cache (L1)

512 kB L2-Cache (extern, halber CPU-Takt)

2 Integer- und 2 MMX-Units

1 Gleitpunkt- und 1 Jump-Unit

Load/Store-Unit

9 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Architektur Intel Pentium II

10 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Benchmark – Probleme ?! Unterschiedliche Hardware

(Mainboard, Grafikkarte, Speicher, Prozessor)

Betriebssystemwahl (Solaris, Debian, Gentoo, …)

Softwareauswahl (BLAS, LAPACK, LINPACK, Cachebench, Whetstone, Dhrystone)

Compileroptimierung ???

Benchmarkergebnisse vergleichbar ?

11 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Betriebssystem Sparc

Gentoo Linux (Base 1.6.13) Stage 1 Installation (32-Bit) CFLAGS: -march=ultrasparc -O2 -m32 -mvis Bootstrapping (Installation des Basissystems [32-Bit]) Update auf stable-Packages (32-Bit)

Kernel 2.6.13 (mit Gentoo-Patches [64-Bit]) Treiber und Konfigurationen

Compiler: gcc-3.4.5

12 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Betriebssystem x86

Gentoo Linux (Base 1.6.13) Stage 1 Installation (32-Bit) CFLAGS: -march=pentium2 -O2 -m32 -mmmx Bootstrapping (Installation des Basissystems [32-Bit]) Update auf stable-Packages (32-Bit)

Kernel 2.6.13 (mit Gentoo-Patches [32-Bit]) Treiber und Konfigurationen

Compiler: gcc-3.4.5

13 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Vorüberlegung Benchmark Whetstone 1972 (Kombination aus Integer-, Gleitpunkt- und Array-

Operationen, Ergebnis in MIPS)

Dhrystone 1984 (Integer- und Array-Operationen, Ergebnis in Dhrystone-Loops / s)

1000s / 1000d (LINPACK)

Benchmarken von CPU / Cache / Speicher durch Messen von Cache-Zugriffen Lösen Linearer Gleichungssysteme (xAXPY, xGEMV, xGEMM)

Compileroptimierung durch CFLAGS

14 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Erwartete Ergebnisse Cache-Zugriff: in etwa identisch (< 256 KByte)

Integer: x86 ≈ sparc

Single-Präzision: x86 ≈ sparc

Double-Präzision: sparc > x86, wegen 64-Bit Architektur, x86 nur wenige 64-Bit Register (MMX)

Compileroptimierung: x86 > sparc

15 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Software für Benchmark

Whetstone (floating-point-Operationen)

Dhrystone (integer-Operationen)

LINPACK veraltet, deshalb LAPACK(für sparc nicht verfügbar, LAPACK-ATLAS)

LLCBench (Cachebench, Blasbench)

BLAS (Basic Linear Algebra Subprograms)

16 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Whetstone 1972

Array-Funktionen (Anteil: 28,91%)

Bedingte Sprünge (Anteil: 15,53%)

Integer-Arithmetik (Anteil: 13,65%)

Trigonometrische Funktion (Anteil: 1,44%)

Funktionsaufrufe (Anteil: 40,47%)

17 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Dhrystone 1984

Array-Funktionen (Anteil: 12,62%)

Bedingte Sprünge (Anteil: 33,01%)

Integer-Arithmetik (Anteil: 37,86%)

Funktionsaufrufe (Anteil: 16,51%)

18 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Whetstone / Dhrystone

19 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Whetstone / Dhrystone Whetstone (floating-point-Operationen)

ohne Optimierung:

Beschleunigung x86 sparc: 1,94 mit Optimierung:

Beschleunigung x86 sparc: 1,37

Dhrystone (integer-Operationen) ohne Optimierung:

Beschleunigung x86 sparc: 1,63 mit Optimierung:

Beschleunigung x86 sparc: 0,79

20 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Benchmark LAPACK-ATLAS

ATLAS stellt Schnittstellen für C und Fortran zur Nutzung von LAPACK und BLAS zur Verfügung ATLAS - Automatically Tuned Linear Algebra

Software BLAS – Basic Linear Algebra Subprograms LAPACK - Linear Algebra PACKage

21 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Routinen aus LAPACK I

Treiber- und Rechen-Routinen

Treiber-Routinen zum Lösen von Problemen wie Lineare Gleichungssysteme Eigenwerte von realen symmetrischen Matrizen

Rechen-Routinen für einzelne Aufgaben werden von Treiber-Routinen genutzt

22 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Routinen aus LAPACK II

Beispiel einer Routine: SGEMV und DGEMV

S Single precision (32-Bit Gleitpunkt) D Double precision (64-Bit Gleitpunkt) GE General MVMatrix-Vektor-Operationen berechnet die Lösungen zu einem realen System

linearer Gleichungen der Form y=α*A*x+β*y, wobei α, β Skalare, A Matrix und x, y Vektoren sind.

23 26.11.2006 - Axel Schmidt / Raphael Schlameuß

LINPACK - SGEFA

Pseudocode SGEFA

DO k = 1, N find pivot DO j = k+1, N call SAXPY(N-k, -A[k,j], A[k+1,k], A[k+1,j], 1)

N=1000

SAXPY – Multiplikation von Skalar und Vektor, Addition von Vektoren

DO i = m, N y[i] = a * x[i] + y[i]

Skalar a, Vektor x, y

24 26.11.2006 - Axel Schmidt / Raphael Schlameuß

LINPACK – Auswertung I

Die Ergebnisse lassen sich folgendermaßen Interpretieren total: Ausführungszeit in Sekunden mflops: Millionen Gleitpunktoperationen pro Sekunde

Gewichtung der Operationen:

add, sub und mul 1 flopdiv und sqr 4 flopexp, sin, ... 8 flopif-Verzweigung 1 flop

Berechnung der mflops durch Division von Anzahl flop durch Laufzeit

25 26.11.2006 - Axel Schmidt / Raphael Schlameuß

1000s / 1000d

26 26.11.2006 - Axel Schmidt / Raphael Schlameuß

1000s / 1000d 1000s (single-precision)

ohne Optimierung:

Beschleunigung x86 sparc: 1,52 mit Optimierung:

Beschleunigung x86 sparc: 0,90

1000d (double-precision) ohne Optimierung:

Beschleunigung x86 sparc: 1,51 mit Optimierung:

Beschleunigung x86 sparc: 1,28

27 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Software Suite LLCbenchLow Level Architectural Characterization Benchmark Blasbench

xAXPY – Vektoraddition mit Skalar xGEMV – Matrix-Vektor-Multiplikation mit Skalar xGEMM – Matrix-Matrix-Multiplikation mit Skalar

Cachebench (Performance Cache) Cache read / hand tuned read Cache write / hand tuned write Cache read/modify/write und hand tuned

read/modify/write

28 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Blasbench SAXPY / DAXPY – Vektoraddition mit Skalar

y=A*x+y

SGEMV / DGEMV – Matrix-Vektor-Multiplikation mit Skalar

y=α*A*x+β*y

SGEMM / DGEMM – Matrix-Matrix-Multiplikation mit Skalar

C=α*op(A)*op(B)+β*C

Matrix A, B, C op(A) = mk-Matrix

Skalar α, β op(B) = kn-Matrix

Vektor x, y C = mn-Matrix

29 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Blasbench – SAXPY

30 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Blasbench - SGEMV

31 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Blasbench – SGEMM

32 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Blasbench - DAXPY

33 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Blasbench - DGEMV

34 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Blasbench - DGEMM

35 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Software Cachebench

Funktion Cache read Durchsatzmessung für verschiedene Vektorlängen Pseudo Code:

for all vector lengthtimer startfor iteration count

for I = 0 to vector lengthregister += memory[I]

timer stop

mit vector length = [256 Byte .. 1024 KByte]

36 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Software Cachebench

Funktion Cache write Durchsatzmessung für verschiedene Vektorlängen Pseudo Code:

for all vector lengthtimer startfor iteration count

for I = 0 to vector length memory[I] = register++

timer stop

mit vector length = [256 Byte .. 1024 KByte]

37 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Software Cachebench

Funktion Cache read / modify / write Durchsatzmessung für verschiedene Vektorlängen Pseudo Code:

for all vector lengthtimer startfor iteration count

for I = 0 to vector length memory[I]++

timer stop

mit vector length = [256 Byte .. 1024 KByte]

38 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Cachebench – read (single / double)

39 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Cachebench – write (single / double)

40 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Cachebench – read/modify/write (single / double)

41 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Software Cachebench

Funktionen HandCache read, HandCache read / modify / write und HandCache write

Handmodifizierter Code, um die Optimierung des Compilers zu testen

Jede Schleife referenziert 8 Memory-Elemente statt einem (Degree Eight Unrolling)

Jede Operation ist unabhängig von den vorherigen 7 Operationen (Dependency Analysis)

Register sind Speicherstellen zugewiesen und werden so oft wie möglich benutzt (Register Re-Use)

42 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Cachebench – hand read (single / double)

43 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Cachebench – hand write (single / double)

44 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Cachebench – hand read/modify/write (single / double)

45 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Whetstone / Dhrystone

46 26.11.2006 - Axel Schmidt / Raphael Schlameuß

CompileroptimierungWhetstone / Dhrystone

47 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Compileroptimierung x86Whetstone / Dhrystone

48 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Compileroptimierung sparcWhetstone / Dhrystone

49 26.11.2006 - Axel Schmidt / Raphael Schlameuß

CompileroptimierungWhetstone / Dhrystone (gcc-3.4.5 – gcc-4.0.2)

Whetstone [MIPS], Dhrystone [1000 Dhrystones/s]

50 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Zusammenfassung

51 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Zusammenfassung Unterschiedlich gute Unterstützung des Compilers für die

Architektur (trotz Optimierung)

Compiler selbst liefert je nach Version unterschiedliche Ergebnisse

Anwenderprogramme sind unterschiedlich gewichtet

Benchmarks nicht zwingend repräsentativ (beeinflussbar)

Unterschiedliche Philosophie der Hersteller von Prozessoren zeigen sich in Benchmarks (Anwendungsgebiete Software)

52 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Fragen und Anregungen ?

53 26.11.2006 - Axel Schmidt / Raphael Schlameuß

Quellen http://www.netlib.org/lapack/

http://www.netlib.org/atlas/ bzw. http://math-atlas.sourceforge.net/

http://www.netlib.org/blas/

http://en.wikipedia.org/wiki/SAXPY

http://icl.cs.utk.edu/projects/llcbench/index.html

http://www.netlib.org/linpack/

http://www.netlib.org/benchmark/

http://en.wikipedia.org/wiki/Whetstone_(benchmark)

http://en.wikipedia.org/wiki/Dhrystone http://gcc.gnu.org/onlinedocs/gcc-4.0.3/gcc/SPARC-Options.html#SPARC-Options http://gcc.gnu.org/onlinedocs/gcc-4.0.3/gcc/i386-and-x86_002d64-Options.html#i386-

and-x86_002d64-Options