Designing the Future: How Successful Codesign Helps Shape Hardware - - PowerPoint PPT Presentation

designing the future how successful codesign helps shape
SMART_READER_LITE
LIVE PREVIEW

Designing the Future: How Successful Codesign Helps Shape Hardware - - PowerPoint PPT Presentation

Official Use Only Designing the Future: How Successful Codesign Helps Shape Hardware and Software Development Christian Trott SAND2014-19833 C Unclassified, Unlimited release Sandia National Laboratories is a multi-program


slide-1
SLIDE 1

Official ¡Use ¡Only

11/18/14

Sandia National Laboratories is a multi-program laboratory managed and operated by Sandia Corporation, a wholly owned subsidiary of Lockheed Martin Corporation, for the U.S. Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.

Designing the Future: How Successful Codesign Helps Shape Hardware and Software Development ¡

Christian Trott

Unclassified, ¡Unlimited ¡release

SAND2014-19833 C

slide-2
SLIDE 2

11/18/14 2

Mantevo

MiniApps

SST

Architecture SImulation

CoDesign ¡at ¡Sandia ¡

Runtimes

Portals, QThreads

Kokkos

Programming Model

Testbeds

Early Access Hardware

Post CMOS

New technological base

slide-3
SLIDE 3

11/18/14 3

Mantevo

MiniApps

SST

Architecture SImulation

CoDesign ¡at ¡Sandia ¡

Runtimes

Portals, QThreads

Kokkos

Programming Model

Testbeds

Early Access Hardware

Post CMOS

New technological base

Provides comprehensive platform coverage

  • test codes and algorithms on all platforms
  • helps developing portable code
  • typically 16-64 nodes

Access to pre-production level hard-/software

  • investigate potential issues with new products
  • early feedback for vendors
  • find issues in software before release
slide-4
SLIDE 4

11/18/14 4

Mantevo

MiniApps

SST

Architecture SImulation

CoDesign ¡at ¡Sandia ¡

Runtimes

Portals, QThreads

Kokkos

Programming Model

Testbeds

Early Access Hardware

Post CMOS

New technological base

slide-5
SLIDE 5

11/18/14 5

Mantevo

MiniApps

SST

Architecture SImulation

CoDesign ¡at ¡Sandia ¡

Runtimes

Portals, QThreads

Kokkos

Programming Model

Testbeds

Early Access Hardware

Post CMOS

New technological base

Complex parallel hardware simulator

  • used by many organisations
  • can run on clusters

Capabilities for wide range of fidelity

  • cores at instruction level
  • memory subsystem
  • full system network

Modular design

  • add new capabilities
slide-6
SLIDE 6

11/18/14 6

Mantevo

MiniApps

SST

Architecture SImulation

CoDesign ¡at ¡Sandia ¡

Runtimes

Portals, QThreads

Kokkos

Programming Model

Testbeds

Early Access Hardware

Post CMOS

New technological base

slide-7
SLIDE 7

11/18/14 7

Mantevo

MiniApps

SST

Architecture SImulation

CoDesign ¡at ¡Sandia ¡

Runtimes

Portals, QThreads

Kokkos

Programming Model

Testbeds

Early Access Hardware

Post CMOS

New technological base

Provide small, representative codes

  • no or little dependencies
  • can be used with simulators

Allow rapid modifications

  • test new programming models
  • test new algorithms
slide-8
SLIDE 8

11/18/14 8

Mantevo

MiniApps

SST

Architecture SImulation

CoDesign ¡at ¡Sandia ¡

Runtimes

Portals, QThreads

Kokkos

Programming Model

Testbeds

Early Access Hardware

Post CMOS

New technological base

slide-9
SLIDE 9

11/18/14 9

Mantevo

MiniApps

SST

Architecture SImulation

CoDesign ¡at ¡Sandia ¡

Runtimes

Portals, QThreads

Kokkos

Programming Model

Testbeds

Early Access Hardware

Post CMOS

New technological base

Programming model for hardware abstraction

  • Memory abstraction: spaces, access traits, layouts
  • Execution abstraction: spaces, policies

Design influenced by information about future architectures

  • interaction with all vendors allows for future-safe general

applicable abstractions

  • concepts in place to handle platforms in 2020

Influence hardware design for better programmability

  • what concepts work well for app developers
  • which capabilities are missing in architectures

Influencing C++ standard to adopt successful concepts

slide-10
SLIDE 10

11/18/14 10

Mantevo

MiniApps

SST

Architecture SImulation

CoDesign ¡at ¡Sandia ¡

Runtimes

Portals, QThreads

Kokkos

Programming Model

Testbeds

Early Access Hardware

Post CMOS

New technological base

slide-11
SLIDE 11

11/18/14 11

  • Primary ¡GPU ¡Testbed ¡
  • 32 ¡Dual ¡Sandy-­‑Bridge ¡nodes ¡
  • QDR ¡Infiniband ¡
  • 128 ¡GB ¡Ram: ¡experiment ¡with ¡RAMDisk ¡
  • November ¡2012: ¡64 ¡K20x ¡
  • November ¡2013: ¡K40s ¡
  • November ¡2014: ¡8 ¡nodes ¡with ¡2xK80s ¡

K80 ¡proper)es: ¡

  • mostly two K40s on a single board
  • increased register count 2x
  • increased L1/shared memory 2x
  • power limit 150W per GPU

5 10 15 20 25 30 35 MiniFE Lennard Jones SNA Potential

Runtime

K40 K80

Testbeds: ¡Shannon ¡

slide-12
SLIDE 12

11/18/14 12

Power ¡consump@on: ¡

  • n ¡previous ¡GPUs ¡most ¡applicaTons ¡pull ¡significantly ¡less ¡than ¡TDP ¡
  • use ¡that ¡knowledge ¡to ¡design ¡dual ¡GPU ¡with ¡no ¡performance ¡penalty ¡
  • K40 ¡TDP ¡of ¡230W, ¡K80 ¡TDP ¡of ¡150W ¡(single ¡GPU) ¡

¡

200 400 600 800 1000 miniFE Lennard Jones SNA Potential

Frequency

Frequency K40 Frequency K80

A ¡closer ¡look ¡at ¡NVIDIAs ¡K80 ¡

50 100 150 200 miniFE Lennard Jones SNA Potential

Power Consumption

Power K40 Power K80

slide-13
SLIDE 13

11/18/14 13

Hardware: ¡

  • 8 ¡nodes ¡of ¡dual ¡socket ¡Power ¡8 ¡
  • 2x ¡K20 ¡per ¡node ¡

¡ Cluster ¡is ¡running: ¡

  • CUDA ¡5.5 ¡+ ¡GCC ¡Toolchain ¡works ¡
  • A ¡lot ¡of ¡other ¡so^ware ¡expected ¡on ¡HPC ¡pla`orms ¡in ¡early ¡stages ¡

¡ ¡ ¡ ¡ ¡ ¡-­‑> ¡e.g. ¡no ¡CUDA ¡aware ¡MPI ¡

  • Gebng ¡CUDA ¡applicaTons ¡to ¡run ¡relaTvely ¡painless ¡
  • Performance ¡as ¡expected ¡(i.e. ¡the ¡same ¡as ¡on ¡X86 ¡based ¡systems ¡with ¡K20x) ¡

¡ ¡ ¡ ¡ ¡ ¡-­‑> ¡this ¡is ¡for ¡apps ¡running ¡exclusively ¡on ¡GPUs ¡ ¡ Goal: ¡ ¡

  • shake ¡out ¡problems ¡with ¡so^ware ¡stack ¡now ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡-­‑> ¡ready ¡for ¡Power ¡based ¡system ¡with ¡NVLink ¡in ¡2016 ¡ ¡

IBM ¡Power ¡8 ¡& ¡NVIDIA ¡K20x ¡

slide-14
SLIDE 14

11/18/14 14

C++ ¡Situa@on ¡2013: ¡

  • no ¡support ¡for ¡class ¡member ¡access ¡
  • not ¡able ¡to ¡call ¡class ¡member ¡funcTons ¡inside ¡kernels ¡
  • replace ¡all ¡members ¡with ¡temporaries ¡/ ¡explicit ¡inlining ¡
  • can’t ¡copy ¡up ¡class ¡instances ¡

¡ ¡ ¡

class SomeClass { int a; int *array; int n; void compute() { const int n_tmp = n; const int a_tmp = a; const int array_tmp = array #pragma acc parallel loop pcopy(array_tmp[0:n_tmp]) for(int i = 0; i< n_tmp ; i++) { array_tmp[i] = a_tmp + i; } }

OpenACC ¡and ¡C++ ¡

slide-15
SLIDE 15

11/18/14 15

C++ ¡Situa@on ¡2013: ¡

  • no ¡support ¡for ¡class ¡member ¡access ¡
  • not ¡able ¡to ¡call ¡class ¡member ¡funcTons ¡inside ¡kernels ¡
  • replace ¡all ¡members ¡with ¡temporaries ¡/ ¡explicit ¡inlining ¡
  • can’t ¡copy ¡up ¡class ¡instances ¡

¡ ¡ ¡

class SomeClass { int a; int *array; int n; void compute() { const int n_tmp = n; const int a_tmp = a; const int array_tmp = array #pragma acc parallel loop pcopy(array_tmp[0:n_tmp]) for(int i = 0; i< n_tmp ; i++) { array_tmp[i] = a_tmp + i; } }

OpenACC ¡and ¡C++ ¡

Temporaries needed since “this” pointer not valid in kernel.

slide-16
SLIDE 16

11/18/14 16 class SomeClass { int a; int *array; int n; void compute() { #pragma acc parallel loop pcopy(array[0:n]) for(int i = 0; i< n ; i++) { array[i] = a + i; } }

OpenACC ¡and ¡C++ ¡

C++ ¡Situa@on ¡now: ¡

  • worked ¡with ¡PGI ¡to ¡address ¡issues ¡
  • possibility ¡to ¡“ahach” ¡arrays ¡to ¡classes ¡ ¡
  • class ¡member ¡access ¡and ¡inline ¡funcTons ¡work ¡
  • nested ¡classes ¡sTll ¡problemaTc ¡
  • looking ¡at ¡C++11 ¡now ¡

¡ ¡ ¡

slide-17
SLIDE 17

11/18/14 17

Experimental, ¡undocumented ¡support ¡in ¡CUDA ¡6.5 ¡

  • LAMBDA ¡inside ¡of ¡Kernels ¡
  • auto, ¡decltype ¡ ¡
  • variadic ¡templates ¡
  • ther ¡misc ¡stuff ¡

¡ Official ¡support ¡in ¡CUDA ¡7.0 ¡ ¡ Enables ¡simpler ¡code, ¡faster ¡porTng ¡

  • parTcular ¡benefits ¡for ¡haevily ¡templated ¡codes ¡
  • deducTng ¡types ¡automaTcally ¡simplifies ¡user ¡interface ¡
  • lambda ¡support ¡enables ¡more ¡abstrac1ons ¡

¡

CUDA ¡and ¡C++11 ¡

slide-18
SLIDE 18

11/18/14 18 parallel_for parallel_for(TeamVectorPolicy TeamVectorPolicy<16>(n_bins,8), Functor()); struct Functor { KOKKOS_INLINE_FUNCTION void operator() (TeamMember t) { … parallel_for parallel_for( TeamRange TeamRange(t,n_items_k), [&] (int i) { auto item_i = load_item(bin_k,i); double sum_i; parallel_for parallel_for( VectorRange VectorRange(t,n_items_l), [&] (int j, double& sum) { sum += Calculation(item_i,load_item(bin_l,j); },sum_i); VectorSingle([&] () { accumulate(item_i,sum_i); }); }); } }

Kokkos: ¡hierarchical ¡parallelism ¡

slide-19
SLIDE 19

11/18/14 19 parallel_for parallel_for(TeamVectorPolicy TeamVectorPolicy<16>(n_bins,8), Functor()); struct Functor { KOKKOS_INLINE_FUNCTION void operator() (TeamMember t) { … parallel_for parallel_for( TeamRange TeamRange(t,n_items_k), [&] (int i) { auto item_i = load_item(bin_k,i); double sum_i; parallel_for parallel_for( VectorRange VectorRange(t,n_items_l), [&] (int j, double& sum) { sum += Calculation(item_i,load_item(bin_l,j); },sum_i); VectorSingle([&] () { accumulate(item_i,sum_i); }); }); } }

Kokkos: ¡hierarchical ¡parallelism ¡

Launch 3-level parallel kernel

  • teams, threads, vector (n_bins x 16 x 8)
  • on GPU: teams = blocks; threads = blockDim.y; vector = blockDim.x
  • on CPU: teams = e.g. threads on a core; vector = implicit for loop
slide-20
SLIDE 20

11/18/14 20 parallel_for parallel_for(TeamVectorPolicy TeamVectorPolicy<16>(n_bins,8), Functor()); struct Functor { KOKKOS_INLINE_FUNCTION void operator() (TeamMember t) { … parallel_for parallel_for( TeamRange TeamRange(t,n_items_k), [&] (int i) { auto item_i = load_item(bin_k,i); double sum_i; parallel_for parallel_for( VectorRange VectorRange(t,n_items_l), [&] (int j, double& sum) { sum += Calculation(item_i,load_item(bin_l,j); },sum_i); VectorSingle([&] () { accumulate(item_i,sum_i); }); }); } }

Kokkos: ¡hierarchical ¡parallelism ¡

slide-21
SLIDE 21

11/18/14 21 parallel_for parallel_for(TeamVectorPolicy TeamVectorPolicy<16>(n_bins,8), Functor()); struct Functor { KOKKOS_INLINE_FUNCTION void operator() (TeamMember t) { … parallel_for parallel_for( TeamRange TeamRange(t,n_items_k), [&] (int i) { auto item_i = load_item(bin_k,i); double sum_i; parallel_for parallel_for( VectorRange VectorRange(t,n_items_l), [&] (int j, double& sum) { sum += Calculation(item_i,load_item(bin_l,j); },sum_i); VectorSingle([&] () { accumulate(item_i,sum_i); }); }); } }

Kokkos: ¡hierarchical ¡parallelism ¡

Loop with threads in the team over a range

  • chunk on CPUs; give consecutive indicies on GPUs
  • on GPU threads with same threadIdx.x get same i
slide-22
SLIDE 22

11/18/14 22 parallel_for parallel_for(TeamVectorPolicy TeamVectorPolicy<16>(n_bins,8), Functor()); struct Functor { KOKKOS_INLINE_FUNCTION void operator() (TeamMember t) { … parallel_for parallel_for( TeamRange TeamRange(t,n_items_k), [&] (int i) { auto item_i = load_item(bin_k,i); double sum_i; parallel_for parallel_for( VectorRange VectorRange(t,n_items_l), [&] (int j, double& sum) { sum += Calculation(item_i,load_item(bin_l,j); },sum_i); VectorSingle([&] () { accumulate(item_i,sum_i); }); }); } }

Kokkos: ¡hierarchical ¡parallelism ¡

slide-23
SLIDE 23

11/18/14 23 parallel_for parallel_for(TeamVectorPolicy TeamVectorPolicy<16>(n_bins,8), Functor()); struct Functor { KOKKOS_INLINE_FUNCTION void operator() (TeamMember t) { … parallel_for parallel_for( TeamRange TeamRange(t,n_items_k), [&] (int i) { auto item_i = load_item(bin_k,i); double sum_i; parallel_for parallel_for( VectorRange VectorRange(t,n_items_l), [&] (int j, double& sum) { sum += Calculation(item_i,load_item(bin_l,j); },sum_i); VectorSingle([&] () { accumulate(item_i,sum_i); }); }); } }

Kokkos: ¡hierarchical ¡parallelism ¡

Do a vector loop

  • normal loop with auto vectorization from compiler on CPUs
  • Split range over threads in a warp with same threadIdx.y
slide-24
SLIDE 24

11/18/14 24 parallel_for parallel_for(TeamVectorPolicy TeamVectorPolicy<16>(n_bins,8), Functor()); struct Functor { KOKKOS_INLINE_FUNCTION void operator() (TeamMember t) { … parallel_for parallel_for( TeamRange TeamRange(t,n_items_k), [&] (int i) { auto item_i = load_item(bin_k,i); double sum_i; parallel_for parallel_for( VectorRange VectorRange(t,n_items_l), [&] (int j, double& sum) { sum += Calculation(item_i,load_item(bin_l,j); },sum_i); VectorSingle([&] () { accumulate(item_i,sum_i); }); }); } }

Kokkos: ¡hierarchical ¡parallelism ¡

slide-25
SLIDE 25

11/18/14 25

Talk, ¡Talk, ¡and ¡more ¡Talk ¡

  • ­‑

increased ¡understanding ¡of ¡each ¡other ¡at ¡every ¡level ¡essenTal ¡ ¡ Take ¡diverse ¡set ¡of ¡pla`orms ¡and ¡codes ¡into ¡consideraTon ¡

  • ­‑

supporTng ¡diverse ¡architectures ¡now ¡increases ¡flexibility ¡for ¡the ¡future ¡ ¡ Early ¡access ¡programs ¡very ¡posiTve ¡

  • ­‑

beher ¡chance ¡to ¡influence ¡design ¡decision ¡

  • ­‑

beta ¡features ¡are ¡useful ¡ ¡ People ¡with ¡cross ¡knowledge ¡are ¡needed ¡

  • ­‑

translate ¡between ¡hardware, ¡runTme ¡and ¡applicaTon ¡people ¡

  • ­‑

successful ¡at ¡Sandia: ¡split ¡a ¡person ¡between ¡CoDesign ¡/ ¡App ¡development ¡

Messages ¡

slide-26
SLIDE 26

11/18/14 26

Talk, ¡Talk, ¡and ¡more ¡Talk ¡

  • ­‑

increased ¡understanding ¡of ¡each ¡other ¡at ¡every ¡level ¡essenTal ¡ ¡ Take ¡diverse ¡set ¡of ¡pla`orms ¡and ¡codes ¡into ¡consideraTon ¡

  • ­‑

supporTng ¡diverse ¡architectures ¡now ¡increases ¡flexibility ¡for ¡the ¡future ¡ ¡ Early ¡access ¡programs ¡very ¡posiTve ¡

  • ­‑

beher ¡chance ¡to ¡influence ¡design ¡decision ¡

  • ­‑

beta ¡features ¡are ¡useful ¡ ¡ People ¡with ¡cross ¡knowledge ¡are ¡needed ¡

  • ­‑

translate ¡between ¡hardware, ¡runTme ¡and ¡applicaTon ¡people ¡

  • ­‑

successful ¡at ¡Sandia: ¡split ¡a ¡person ¡between ¡CoDesign ¡/ ¡App ¡development ¡

Messages ¡

“The best way to predict your future is to create it.”

Abraham Lincoln

slide-27
SLIDE 27

QuesTons ¡and ¡further ¡discussion: ¡crtroh@sandia.gov ¡