The Numerical Reproducibility Fair Trade: Facing the - - PowerPoint PPT Presentation
The Numerical Reproducibility Fair Trade: Facing the - - PowerPoint PPT Presentation
The Numerical Reproducibility Fair Trade: Facing the Concurrency Challenges at the Extreme Scale Michela Taufer University of Delaware Michela Becchi
From ¡MulD-‑core ¡to ¡Many ¡Cores ¡
1 ¡
From ¡hGp://wccIech.com/nvidia-‑tesla-‑ k20-‑gk110-‑specificaDons-‑unveiled/ ¡
Intel’s Xeon Phi – 50 x86 core
From: ¡hGp://www.altera.com/technology/system-‑design/ arDcles/2012/mulDcore-‑many-‑core.html ¡
NVIDIA K20 - 2,496 CUDA cores
SoIware ¡ExecuDon ¡on ¡Many ¡Cores ¡
2 ¡ From http://www.pgroup.com/lit/articles/insider/v2n4a1.htm
Plea ¡for ¡Joint ¡Effort ¡
- Homogenous ¡architectures ¡with ¡large ¡number ¡of ¡cores ¡
§ Intel ¡Xeon ¡Phi ¡with ¡50 ¡x86 ¡cores ¡ § NVIDIA ¡K20/K40 ¡with ¡2,496 ¡CUDA ¡cores ¡
- Dynamic ¡mapping ¡of ¡tasks ¡to ¡cores ¡make ¡the ¡predicDon ¡of ¡
which ¡thread ¡is ¡assigned ¡to ¡which ¡core ¡not ¡feasible ¡
- While ¡computer ¡architects ¡focus ¡on ¡power, ¡bandwidth, ¡
energy ¡impacts, ¡…. ¡
3 ¡
The ¡computer ¡science ¡and ¡mathemaDcal ¡communiDes ¡must ¡join ¡ effort ¡to ¡study ¡and ¡miDgate ¡the ¡impact ¡of ¡rounding ¡errors ¡on ¡ result ¡reproducibility ¡when ¡concurrent ¡execuDons ¡burst ¡and ¡ workflow ¡determinism ¡vanishes ¡in ¡massively ¡parallel ¡systems ¡ ¡
A ¡Case ¡Study: ¡Molecular ¡Dynamics ¡SimulaDons ¡
- MD ¡simulaDons ¡are ¡iteraDve ¡execuDons ¡of ¡MD ¡steps ¡
§ Given ¡iniDal ¡atomic ¡posiDons ¡and ¡velociDes, ¡obtain ¡those ¡at ¡ later ¡Dmes ¡by ¡integra(ng ¡ordinary ¡differen(al ¡equa(ons ¡
- IteraDve ¡steps ¡compute ¡forces ¡on ¡each ¡parDcle ¡due ¡to: ¡
§ Bonded ¡interacDons ¡ ¡ § Non-‑bonded ¡interacDons ¡ ¡
- Different ¡flavors ¡of ¡MD ¡simulaDons: ¡
§ Constant ¡energy ¡(NVE) ¡dynamics ¡is ¡the ¡original ¡method ¡of ¡ molecular ¡dynamics ¡and ¡is ¡performed ¡in ¡a ¡closed ¡environment ¡ with ¡a ¡constant ¡number ¡of ¡atoms, ¡volume, ¡and ¡energy ¡ § Constant ¡temperature ¡(NVT) ¡dynamics ¡ ¡use ¡velocity ¡ reassignment ¡to ¡changes ¡system ¡energy ¡states ¡at ¡specified ¡ intervals ¡and ¡is ¡performed ¡ ¡with ¡a ¡constant ¡number ¡of ¡atoms, ¡ volume, ¡and ¡temperature ¡
4 ¡
MD ¡on ¡Many ¡Core ¡Plaforms ¡
5 ¡
Force ¡-‑> ¡AcceleraDon ¡-‑> ¡Velocity ¡ ¡ ¡-‑> ¡ ¡PosiDon ¡
MD ¡simulaDon ¡step: ¡
- Each ¡GPU-‑thread ¡computes ¡forces ¡
- n ¡single ¡atoms ¡
§ E.g., ¡bond, ¡angle, ¡dihedrals ¡
and, ¡nonbond ¡forces ¡
- Forces ¡are ¡added ¡to ¡compute ¡
acceleraDon ¡
- AcceleraDon ¡is ¡used ¡to ¡update ¡
velociDes ¡ ¡
- VelociDes ¡are ¡used ¡to ¡update ¡the ¡
posiDons ¡
Moving ¡MD ¡onto ¡Accelerators ¡
- ‑-‑-‑-‑-‑ ¡Single ¡precision ¡
- Enhancing ¡performance ¡of ¡MD ¡simulaDons ¡allows ¡simulaDons ¡
- f ¡larger ¡Dme ¡scales ¡and ¡length ¡scales ¡
- GPU ¡compuDng ¡enables ¡large-‑scale ¡MD ¡simulaDon ¡
§ SimulaDons ¡exhibit ¡speed-‑up ¡factors ¡of ¡X10-‑X30 ¡ ¡
- MD ¡simulaDon ¡of ¡NaI ¡soluDon ¡system ¡
containing ¡988 ¡waters, ¡18 ¡Na+, ¡and ¡ 18 ¡I−: ¡GPU ¡is ¡X15 ¡faster ¡than ¡CPU ¡
Constant ¡energy ¡MD ¡simula(on ¡ ¡
6 ¡
Moving ¡MD ¡onto ¡Accelerators ¡
- ‑-‑-‑-‑-‑ ¡Single ¡precision ¡
- Enhancing ¡performance ¡of ¡MD ¡simulaDons ¡allows ¡simulaDons ¡
- f ¡larger ¡Dme ¡scales ¡and ¡length ¡scales ¡
- GPU ¡compuDng ¡enables ¡large-‑scale ¡MD ¡simulaDon ¡
§ SimulaDons ¡exhibit ¡speed-‑up ¡factors ¡of ¡X10-‑X30 ¡ ¡
- MD ¡simulaDon ¡of ¡NaI ¡soluDon ¡system ¡
containing ¡988 ¡waters, ¡18 ¡Na+, ¡and ¡ 18 ¡I−: ¡GPU ¡is ¡X15 ¡faster ¡than ¡CPU ¡
Constant ¡energy ¡MD ¡simula(on ¡ ¡
7 ¡
Moving ¡MD ¡onto ¡Accelerators ¡
- ‑-‑-‑-‑-‑ ¡Single ¡precision ¡
- Enhancing ¡performance ¡of ¡MD ¡simulaDons ¡allows ¡simulaDons ¡
- f ¡larger ¡Dme ¡scales ¡and ¡length ¡scales ¡
- GPU ¡compuDng ¡enables ¡large-‑scale ¡MD ¡simulaDon ¡
§ SimulaDons ¡exhibit ¡speed-‑up ¡factors ¡of ¡X10-‑X30 ¡ ¡
- MD ¡simulaDon ¡of ¡NaI ¡soluDon ¡system ¡
containing ¡988 ¡waters, ¡18 ¡Na+, ¡and ¡ 18 ¡I−: ¡GPU ¡is ¡X15 ¡faster ¡than ¡CPU ¡
GPU single precision GPU single precision GPU double precision
8 ¡
Moving ¡MD ¡onto ¡Accelerators ¡
- Enhancing ¡performance ¡of ¡MD ¡simulaDons ¡allows ¡simulaDons ¡
- f ¡larger ¡Dme ¡scales ¡and ¡length ¡scales ¡
- GPU ¡compuDng ¡enables ¡large-‑scale ¡MD ¡simulaDon ¡
§ SimulaDons ¡exhibit ¡speed-‑up ¡factors ¡of ¡X10-‑X30 ¡ ¡
- MD ¡simulaDon ¡of ¡NaI ¡soluDon ¡system ¡
containing ¡988 ¡waters, ¡18 ¡Na+, ¡and ¡ 18 ¡I−: ¡GPU ¡is ¡X15 ¡faster ¡than ¡CPU ¡
9 ¡
GPU double precision
Code ¡Accuracy: ¡ ¡ Energy ¡FluctuaDons ¡
- A ¡plot ¡of ¡the ¡energy ¡
fluctua(ons ¡versus ¡(me ¡step ¡ size ¡should ¡follow ¡an ¡ approximately ¡logarithmic ¡ trend ¡1 ¡
- Energy ¡fluctuaDons ¡are ¡
proporDonal ¡to ¡Dme ¡step ¡size ¡ for ¡large ¡Dme ¡step ¡size ¡ § Larger ¡than ¡0.5 ¡fs ¡
- A ¡different ¡behavior ¡for ¡step ¡
size ¡less ¡than ¡0.5 ¡fs ¡is ¡consistent ¡ with ¡results ¡previously ¡ presented ¡and ¡discussed ¡in ¡
- ther ¡work ¡2 ¡
1 Allen and Tildesley, Oxford: Clarendon Press, (1987) 2 Bauer et al., J. Comput. Chem. 32(3): 375 – 385, 2011
Composite ¡Precision ¡ArithmeDc ¡
- Numerical ¡reproducibility ¡CANNOT ¡be ¡guaranteed ¡in ¡large-‑
scale ¡simulaDons ¡on ¡ANY ¡massively ¡parallel ¡plaform ¡1, ¡2 ¡
- High ¡precision ¡calculaDons ¡can ¡be ¡achieved ¡using ¡arbitrary ¡
precision ¡libraries ¡1 ¡
§ One ¡criDcal ¡aspect ¡of ¡many ¡libraries ¡is ¡their ¡complexity ¡
- Composite ¡precision ¡arithmeDc ¡provides ¡a ¡simpler ¡soluDon ¡
§ Composite ¡precision ¡represents ¡values ¡(results) ¡as ¡the ¡sum ¡of ¡floaDng-‑ point ¡numbers ¡of ¡arbitrarily ¡varying ¡orders ¡of ¡magnitude ¡3, ¡4 ¡
- Our ¡goal: ¡use ¡composite ¡precision ¡to ¡improve ¡numerical ¡
reproducibility ¡of ¡simulaDons ¡on ¡many ¡core ¡systems ¡ ¡
¡
11 ¡
1 Bailey (2005) 2 He and Ding (2000) 3 Thall (2006) 4 Taufer et al. (2010)
Composite ¡Precision: ¡Data ¡Structure ¡
- In ¡2010, ¡double ¡operaDons ¡>> ¡float ¡operaDons ¡on ¡GPUs ¡
- Our ¡iniDal ¡representaDon ¡of ¡composite ¡precision ¡used ¡two ¡
float ¡numbers ¡(float2) ¡to ¡represent ¡a ¡floaDng ¡point ¡value ¡ ¡
- Each ¡arithmeDc ¡operaDon ¡takes ¡float2s ¡as ¡parameters ¡and ¡
returns ¡float2s ¡
§ Error ¡carried ¡through ¡each ¡operaDon ¡ ¡ § OperaDons ¡rely ¡on ¡self-‑compensaDon ¡of ¡rounding ¡errors ¡
12 ¡
struct float2{ float val; // Value float err; // Error } x2; float2 x2 = x2.val + x2.err
Composite ¡Precision: ¡AddiDon ¡
- MathemaDcally ¡z2.err ¡should ¡be ¡0 ¡
§ But ¡errors ¡introduced ¡by ¡floaDng-‑point ¡operaDons ¡usually ¡result ¡in ¡ z2.err ¡being ¡non-‑zero ¡
- SubtracDon ¡is ¡the ¡same ¡as ¡addiDon, ¡but ¡y2.val ¡= ¡–y2.val ¡ ¡and ¡
y2.err ¡ ¡ ¡= ¡ ¡-‑y2.err ¡ ¡
13 ¡ Pseudo-‑code ¡ float2 x2, y2, z2
- z2 = x2 + y2
Implementa(on ¡ float2 x2, y2, z2 float t Z2.val = x2.val + y2.val t = z2.val - x2.val Z2.err = x2.val - (z2.val – t) + (y2.val – t) + x2.err + y2.err
Composite ¡Precision: ¡MulDplicaDon ¡and ¡Division ¡
14 ¡ Pseudo-‑code ¡ float2 x2, y2, z2
- z2 = x2 * y2
Implementa(on ¡ float2 x2, y2, z2 Z2.val = x2.val * y2.val Z2.err = (x2.val * y2.err) + (x2.err * y2.val) + (x2.err * y2.err) Pseudo-‑code ¡ float2 x2, y2, z2
- z2 = x2 / y2
Implementa(on ¡ ¡
- float2 x2, y2, z2
float t, s, diff t = (1 / y2.val) s = t * x2.val diff = x2.val - (s * y2.val ) Z2.val = s Z2.err = t * diff
MulDplicaDon ¡ Division ¡
Suite ¡Overview ¡
- MD ¡codes ¡are ¡very ¡complex ¡
§ We ¡created ¡a ¡syntheDc ¡test ¡suite ¡that ¡mimics ¡the ¡MD ¡behavior ¡ § IteraDve ¡calculaDons ¡of ¡energy ¡terms ¡including ¡their ¡fluctuaDons ¡and ¡ driIing ¡
- Global ¡summaDon: ¡
§ Reproduce ¡errors ¡in ¡total ¡energy ¡summaDons ¡in ¡MD ¡
- Do/Undo ¡code: ¡
§ Reproduce ¡driIing ¡in ¡single ¡energy ¡computaDons ¡in ¡MD ¡
15 ¡
Suite ¡Overview ¡
- MD ¡codes ¡are ¡very ¡complex ¡
§ We ¡created ¡a ¡syntheDc ¡test ¡suite ¡that ¡mimics ¡the ¡MD ¡behavior ¡ § IteraDve ¡calculaDons ¡of ¡energy ¡terms ¡including ¡their ¡fluctuaDons ¡and ¡ driIing ¡
- Global ¡summaDon: ¡
§ Reproduce ¡errors ¡in ¡total ¡energy ¡summaDons ¡in ¡MD ¡
- Do/Undo ¡code: ¡
§ Reproduce ¡driIing ¡in ¡single ¡energy ¡computaDons ¡in ¡MD ¡
16 ¡
Global ¡SummaDon ¡
- Randomly ¡generate ¡an ¡array ¡filled ¡with ¡very ¡large ¡– ¡e.g., ¡
O(106) ¡-‑ ¡and ¡very ¡small ¡– ¡e.g., ¡O(10-‑6) ¡-‑ ¡numbers ¡
§ Whenever ¡you ¡generate ¡a ¡number, ¡the ¡next ¡number ¡should ¡be ¡its ¡ negaDve ¡ § The ¡total ¡sum ¡should ¡be ¡0 ¡
¡
17 ¡ Very ¡small ¡values ¡ Very ¡large ¡values ¡
Assessing ¡SummaDon ¡Results ¡
- Type ¡of ¡execuDons: ¡
§ A ¡sequenDal ¡run ¡on ¡the ¡CPU ¡ § A ¡parallel ¡run ¡on ¡GPU, ¡with ¡final ¡sum ¡on ¡CPU ¡-‑ ¡the ¡number ¡of ¡ elements ¡summed ¡on ¡CPU ¡is ¡equal ¡to ¡the ¡number ¡of ¡threads ¡ run ¡on ¡GPU ¡ § A ¡parallel ¡run ¡on ¡GPU, ¡with ¡atomic ¡operaDons ¡-‑ ¡all ¡values ¡are ¡ computed ¡on ¡GPU ¡and ¡the ¡final ¡sum ¡is ¡performed ¡on ¡GPU ¡
- Type ¡of ¡precisions: ¡ ¡
§ Float, ¡double, ¡and ¡composite ¡precision ¡ § With ¡composite ¡precision ¡both ¡value ¡and ¡error ¡are ¡collected ¡
18 ¡
Assessing ¡SummaDon ¡Results ¡
- Type ¡of ¡data: ¡
§ Size ¡of ¡the ¡array ¡with ¡floaDng-‑point ¡(FP) ¡values ¡ § Number ¡of ¡threads ¡ ¡ § Amount ¡of ¡work ¡for ¡each ¡thread ¡ § Intervals ¡used ¡to ¡generate ¡the ¡numbers ¡in ¡the ¡array-‑ ¡small ¡and ¡ large ¡numbers ¡
- Type ¡of ¡data ¡sorDng: ¡
§ Random ¡shuffling ¡of ¡the ¡array ¡ § Increasing ¡and ¡decreasing ¡sorDng ¡
- Range ¡of ¡numbers: ¡
§ Very ¡large ¡and ¡very ¡small ¡numbers ¡
19 ¡
Assessing ¡SummaDon ¡Costs ¡
- Time ¡ONLY ¡the ¡parallel ¡kernel ¡for ¡float, ¡double, ¡and ¡
composite ¡precision ¡
- Each ¡kernel ¡runs ¡for ¡a ¡short ¡Dme: ¡
§ Add ¡a ¡loop ¡inside ¡the ¡kernel ¡to ¡repeat ¡the ¡operaDons ¡for ¡ NUMBER_OF_ITERATIONS ¡ § Divide ¡the ¡execuDon ¡Dme ¡by ¡the ¡number ¡of ¡iteraDons ¡to ¡ provide ¡more ¡stable ¡results ¡
20
Results ¡on ¡Old ¡GeneraDon ¡GPUs ¡
- Composite ¡precision ¡corrects ¡results ¡between ¡4 ¡and ¡5 ¡orders ¡
- f ¡magnitude ¡(beGer ¡than ¡single ¡precision) ¡
21 ¡
- Tests ¡performed ¡on ¡old ¡generaDon ¡of ¡GPUs ¡(C2070) ¡1 ¡
float double float2 Array size: 1,000 - 10 threads Unsorted, shuffled (1)
- 1.38E+000
- 5.03E-008
4.88E-003 Unsorted, shuffled (2) 8.00E+000 8.20E-008 9.77E-004 Unsorted, shuffled (3) 2.40E+001 0.00E+000 2.72E-003 Unsorted, shuffled (4) 0.00E+000
- 2.24E-008
1.46E-003 Sorted, descending
- 6.40E+001
- 7.15E-007
4.88E-004 Sorted, increasing 6.40E+001 7.15E-007
- 4.88E-004
Array size: 1,000 - 100 threads Unsorted, shuffled (1) 1.40E+001 3.54E-008 2.08E-003 Unsorted, shuffled (2)
- 4.00E+000
- 7.45E-009
- 3.66E-004
Unsorted, shuffled (3)
- 2.75E+001
7.17E-008
- 1.34E-003
Unsorted, shuffled (4)
- 7.50E+000
1.58E-008 0.00E+000 Sorted, descending
- 1.04E+002
- 1.79E-007
0.00E+000 Sorted, increasing 1.04E+002 1.79E-007 0.00E+000
1 Taufer et al. (2010)
OpenCL ¡Results ¡
- Randomly ¡shuffled ¡array ¡of ¡1,000 ¡values ¡on ¡a ¡broad ¡range ¡of ¡
mulD-‑core ¡plaforms ¡
22
- Double ¡precision ¡error ¡
is ¡very ¡small, ¡on ¡the ¡
- rder ¡of ¡10−8 ¡to ¡10−9 ¡
- Single ¡precision ¡error ¡is ¡
large, ¡on ¡the ¡order ¡of ¡ 10+0. ¡ ¡
- Composite ¡precision ¡
errors ¡is ¡close ¡to ¡the ¡ double ¡precision, ¡on ¡the ¡
- rder ¡of ¡10−6 ¡to ¡10−7 ¡ ¡
Results ¡on ¡New ¡GPUs: ¡Kepler ¡
- Consider ¡different ¡unsorted ¡arrays ¡of ¡1000 ¡elements ¡each ¡
23
Expected ¡result ¡
Trial-1: Trial-2: Trial-3: Trial-4:
- 10
10 20 30 40 50 60 70 result float double float2
- Confirm ¡that ¡
composite ¡precision ¡ corrects ¡results ¡ between ¡4 ¡and ¡5 ¡
- rders ¡of ¡
magnitude ¡(beGer ¡ than ¡single ¡ precision) ¡
Results ¡on ¡New ¡GPUs: ¡Kepler ¡
- Consider ¡different ¡unsorted ¡arrays ¡of ¡1000 ¡elements ¡each ¡
24
- Confirm ¡that ¡
composite ¡ precision ¡corrects ¡ results ¡between ¡4 ¡ and ¡5 ¡orders ¡of ¡ magnitude ¡(beGer ¡ than ¡single ¡ precision) ¡
Trial-1: Trial-2: Trial-3: Trial-4: 1E-8 1E-7 1E-6 1E-5 1E-4 1E-3 1E-2 1E-1 1E+0 1E+1 1E+2 result float double float2
Logarithmic ¡scale ¡
Number ¡of ¡Threads ¡and ¡Elements ¡per ¡Threads ¡
- Consider ¡different ¡number ¡of ¡threads; ¡amount ¡of ¡elements ¡per
¡ threads; ¡type ¡of ¡execuDons, ¡i.e., ¡CPU, ¡GPU+CPU, ¡and ¡GPU ¡
25
Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 1000 1000 1 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 1000 100 10 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 1000 10 100 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) Sequential (CPU) 1000 1 1000
- 10
10 20 30 40 50 60 70 result float double float2
Expected ¡result ¡
Array of 1000 elements
Number ¡of ¡Threads ¡and ¡Elements ¡per ¡Threads ¡
- Consider ¡different ¡number ¡of ¡threads; ¡amount ¡of ¡elements ¡per
¡ threads; ¡type ¡of ¡execuDons, ¡i.e., ¡CPU, ¡GPU+CPU, ¡and ¡GPU ¡
26
Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 1000 1000 1 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 1000 100 10 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 1000 10 100 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) Sequential (CPU) 1000 1 1000 1E-10 1E-9 1E-8 1E-7 1E-6 1E-5 1E-4 1E-3 1E-2 1E-1 1E+0 1E+1 1E+2 result float double float2
Logarithmic ¡scale ¡
Array of 1000 elements
Number ¡of ¡Threads ¡and ¡Elements ¡per ¡Threads ¡
- Consider ¡different ¡number ¡of ¡threads; ¡amount ¡of ¡elements ¡per
¡ threads; ¡type ¡of ¡execuDons, ¡i.e., ¡CPU, ¡GPU+CPU, ¡and ¡GPU ¡
27
Expected ¡result ¡
Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 1000 10000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 100 100000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 10 1000000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) Sequential (CPU) 10000000 1 10000000
- 20000
20000 40000 60000 80000 100000 120000 140000 160000 180000 result float double float2
Array of 10,000,000 elements
Number ¡of ¡Threads ¡and ¡Elements ¡per ¡Threads ¡
- Consider ¡different ¡number ¡of ¡threads; ¡amount ¡of ¡elements ¡per
¡ threads; ¡type ¡of ¡execuDons, ¡i.e., ¡CPU, ¡GPU+CPU, ¡and ¡GPU ¡
28
Expected ¡result ¡
Array of 10,000,000 elements
Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 1000 10000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 100 100000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 10 1000000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) Sequential (CPU) 10000000 1 10000000
- 8
- 6
- 4
- 2
2 4 result double float2
Number ¡of ¡Threads ¡and ¡Elements ¡per ¡Threads ¡
- Consider ¡different ¡number ¡of ¡threads; ¡amount ¡of ¡elements ¡per
¡ threads; ¡type ¡of ¡execuDons, ¡i.e., ¡CPU, ¡GPU+CPU, ¡and ¡GPU ¡
29
Expected ¡result ¡
Array of 10,000,000 elements
Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 1000 10000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 100 100000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 10 1000000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) Sequential (CPU) 10000000 1 10000000
- 0.0006 -0.0005 -0.0004 -0.0003 -0.0002 -0.0001
double
Number ¡of ¡Threads ¡and ¡Elements ¡per ¡Threads ¡
- Consider ¡different ¡number ¡of ¡threads; ¡amount ¡of ¡elements ¡per
¡ threads; ¡type ¡of ¡execuDons, ¡i.e., ¡CPU, ¡GPU+CPU, ¡and ¡GPU ¡
30
Expected ¡result ¡
Array of 10,000,000 elements
Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 1000 10000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 100 100000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) 10000000 10 1000000 Parallel (only GPU - atomic) Parallel (GPU + CPU final sum) Sequential (CPU) 10000000 1 10000000
- 0.0006 -0.0005 -0.0004 -0.0003 -0.0002 -0.0001
double
Range ¡of ¡Numbers ¡
31
- Consider ¡different ¡range ¡of ¡numbers ¡-‑ ¡very ¡large ¡and ¡very ¡
small ¡numbers ¡
Parallel (GPU + CPU final sum) ( 1.00e-07, 1.00e-06) & ( 1.00e+06, 1.00e+07) Parallel (GPU + CPU final sum) ( 1.00e-06, 1.00e-05) & ( 1.00e+05, 1.00e+06) Parallel (GPU + CPU final sum) ( 1.00e-05, 1.00e-04) & ( 1.00e+04, 1.00e+05) Parallel (GPU + CPU final sum) ( 1.00e-04, 1.00e-03) & ( 1.00e+03, 1.00e+04)
- 0.1
0.1 0.2 0.3 0.4 0.5 0.6 result double float2
Expected ¡result ¡
Array of 10,000,000 elements
SummaDon ¡Costs ¡
32
array-size=1000/num_threads=1: array-size=1000/num_threads=10: array-size=1000/num_threads=100: array-size=1000/num_threads=1000: 0.001 0.01 0.1 1 time (sec) float double float2
- GOOD ¡NEWS: ¡summaDon ¡costs ¡of ¡single, ¡double, ¡and ¡
composite ¡precisions ¡are ¡in ¡the ¡same ¡range ¡
Lesson ¡Learned ¡ ¡
- The ¡size ¡of ¡the ¡array ¡affects ¡the ¡precision ¡even ¡of ¡sequenDal ¡
code ¡à ¡Need ¡to ¡plan ¡solu(ons ¡that ¡take ¡into ¡account ¡sizes ¡
- Number ¡of ¡threads ¡and ¡work ¡per ¡thread ¡affect ¡the ¡precision ¡
even ¡of ¡sequenDal ¡code ¡à ¡Need ¡to ¡plan ¡solu(ons ¡that ¡take ¡ into ¡thread-‑related ¡features ¡
- Range ¡of ¡numbers ¡affect ¡driIing ¡from ¡expected ¡result ¡à ¡
Need ¡to ¡plan ¡solu(ons ¡that ¡take ¡into ¡account ¡range ¡of ¡ numbers ¡
- Performance ¡of ¡double ¡precision ¡operaDons ¡have ¡