CSC/ECE 506 Spring 2010/ch 2 maf: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|+'''Comparison between shared memory, message passing, and data parallel programming models (adapted from Solihin 2008).'''
|+'''Comparison between shared memory, message passing, and data parallel programming models (adapted from Solihin 2008, page 22).'''
|-
|-
! Aspects
! Aspects
Line 42: Line 42:


==A Code Example==
==A Code Example==
  // ''Simple sequential code from Solihin 2008, page 25.''
 
  '''for''' (i = 0; i < 8; i++)
    a[i] = b[i] + c[i];
  sum = 0;
  '''for''' (i = 0; i < 8; i++)
    '''if''' (a[i] > 0)
      sum = sum + a[i];
  Print sum;


==Hardware Examples==
==Hardware Examples==

Revision as of 04:51, 27 January 2010

The Data Parallel Programming Model

Overview

Comparing the Data Parallel Model with the Shared Memory and Message Passing Models

Comparison between shared memory, message passing, and data parallel programming models (adapted from Solihin 2008, page 22).
Aspects Shared Memory Message Passing Data Parallel
Communication implicit (via loads/stores) explicit messages implicit
Synchronization explicit implicit (via messages) implicit
Hardware support typically required none
Development effort lower higher higher
Tuning effort higher lower

A Code Example

 // Simple sequential code from Solihin 2008, page 25.
 
 for (i = 0; i < 8; i++)
   a[i] = b[i] + c[i];
 sum = 0;
 for (i = 0; i < 8; i++)
   if (a[i] > 0)
     sum = sum + a[i];
 Print sum;

Hardware Examples