Threaded Code examples

AE provided


These samples are from Intel® application engineers.


OpenMP and Win32 Threads Usage Example
by Stanislav Bratanov
The code example computes a trigonometric formula for arrays of input coefficients and parallels the computation either using OpenMP directives or creating threads manually. The performance of both approaches is measured and compared.

  • Multi-thread apps for Multi-Core
  • Threaded Code examples
  • Informatique parallèle
  • Parallel while


    Introduction

    Example that uses parallel_while to do parallel preorder traversal of a sparse graph.
    Each vertex in the graph is called a "cell". Each cell has a value. The value is a matrix. Some of the cells have operators that compute the cell's value, using other cell's values as input. A cell that uses the value of cell x is called a successor of x.

    The algorithm works as follows.

     

  • Intel® Threading Building Blocks
  • Multi-thread apps for Multi-Core
  • Threaded Code examples
  • Informatique parallèle
  • Substring finder


    Introduction

    A simple example that uses the parallel_for template in a substring matching program. For each position in a string, the program displays the length of the largest matching substring elsewhere in the string. The program also displays the location of a largest match for each position. Consider the string "babba" as an example. Starting at position 0, "ba" is the largest substring with a match elsewhere in the string (position 3).

    ==============================================================================

  • Intel® Threading Building Blocks
  • Multi-thread apps for Multi-Core
  • Threaded Code examples
  • Informatique parallèle
  • Task - tree sum


    Introduction

    This is a simple example that sums values in a tree. The example exhibits some speedup, but not a lot, because it quickly saturates the system bus on a multiprocessor. For good speedup, there needs to be more computation cycles per memory reference. The point of the example is to teach how to use the raw task interface, so the computation is deliberately trivial.


    SerialSumTree.cpp

    ==============================================================================

    Copyright 2005-2006 Intel Corporation. All Rights Reserved.

  • Intel® Threading Building Blocks
  • Multi-thread apps for Multi-Core
  • Threaded Code examples
  • Informatique parallèle
  • Parallel for

    Parallel seismic simulation that demonstrates use of parallel_for.

     

    SeismicSimulation.h
    ==============================================================================
    Copyright 2005-2006 Intel Corporation. All Rights Reserved.
    ==============================================================================

  • Intel® Threading Building Blocks
  • Multi-thread apps for Multi-Core
  • Threaded Code examples
  • Informatique parallèle
  • S’abonner à Threaded Code examples