Difference between revisions of "Programming Multi-core using FastFlow"

From Gridkaschool
(Training materials and documentation)
(Session Agenda)
Line 69: Line 69:
 
** A simple parallel work-flow computation
 
** A simple parallel work-flow computation
 
** Proposed exercise: matrix multiplication using [http://en.wikipedia.org/wiki/Strassen_algorithm Strassen's algorithm].
 
** Proposed exercise: matrix multiplication using [http://en.wikipedia.org/wiki/Strassen_algorithm Strassen's algorithm].
  +
  +
'''Exercise1 (stream parallel computation) '''
  +
  +
Consider the simplecomp.cpp file implementing a very naive file compressor
  +
using the miniz routines. It compresses the entire file in memory and then
  +
writes the compressed memory file into disk.
  +
  +
Modify the sequential code in order to implement a 3-stage pipeline:
  +
** the first stage reads files from disk (file names are passed in the command line);
  +
** the second stage compresses each input file in memory;
  +
** the third stage writes the compressed memory file onto the disk.

Revision as of 15:18, 2 September 2014

FastFlow

FastFlow is an open-source, structured parallel programming framework originally conceived to support efficient stream parallel computation while targeting shared memory multi-core. It provides the parallel applications programmer with a set of ready-to-use, parametric algorithmic skeletons modelling the most common parallelism exploitation patterns. The skeletons provided may be almost freely nested to model more and more complex parallelism exploitation patterns.

FastFlow is provided as a set of header files. The last version of the FastFlow code can be download from the Sourceforge svn repository this way:

svn co https://svn.code.sf.net/p/mc-fastflow/code fastflow

Project Home

The FastFlow project web site is: http://calvados.di.unipi.it/fastflow

Requirements

  • Linux operating system (it is possible to use also a Mac OS and Windows OSs but it is not recommended for the tutorial session).
  • A c++11 compiler (gcc 4.7.x or icc 13.x).
  • For running some of the tests provided in the tutorial session it is need OpenCV and ImageMagick.

Everything you need to compile and run the tests is prepared in the Virtual Machine provided during the session.

VM access

ssh -p 24 fastflow@gks-XXX.scc.kit.edu

the password will be provided during the tutorial session.

VM machines

gks-137

gks-138

gks-139

gks-141

gks-143

gks-144

gks-145

gks-146

gks-196

Training materials and documentation

Session Agenda

Hands-on slides available here.

  • Introduction to FastFlow
  • Stream concept
  • FastFlow's building blocks
  • FastFlow's core streaming patterns: pipeline and task-farm
    • How to build a pipeline based application
    • How to build a task-farm based application
    • The image filtering application example using ImageMagick
    • Proposed exercise: simple files compressor using miniz.c
  • High-level data-parallel patterns
    • ParallelFor ParallelForReduce and Map
    • Sobel filter apllication example
    • Proposed exercise: a simple matrix-based computation
  • High-level data-flow pattern
    • The ff_mdf pattern
    • A simple parallel work-flow computation
    • Proposed exercise: matrix multiplication using Strassen's algorithm.

Exercise1 (stream parallel computation)

Consider the simplecomp.cpp file implementing a very naive file compressor using the miniz routines. It compresses the entire file in memory and then writes the compressed memory file into disk.

Modify the sequential code in order to implement a 3-stage pipeline:

    • the first stage reads files from disk (file names are passed in the command line);
    • the second stage compresses each input file in memory;
    • the third stage writes the compressed memory file onto the disk.