Search code examples
pythoncparallel-processingmpiopenmp

Looking for Flynn's taxonomy code example for OpenMP and MPI


Looking for all Flynn's Taxonomy example code for C/C++ or Python code for understanding

Any code can, I just want to learn something. I try to find some of them but no result.

SIMD
SISD
MISD
MIMD

Solution

  • Looking for all Flynn's Taxonomy example code for C/C++ or Python code for understanding

    The Taxonomy is more about computer architecture per se.

    Let us start SIMD, from Wikipedia one can read:

    Single instruction, multiple data (SIMD) is a class of parallel computers in Flynn's taxonomy.It describes computers with multiple processing elements that perform the same operation on multiple data points simultaneously. Such machines exploit data level parallelism, but not concurrency: there are simultaneous (parallel) computations, but only a single process (instruction) at a given moment.

    in OpenMP you can use the SIMD directive, namely:

    #pragma omp simd
    for ( i = 0; i < n; i++ )
        a[i] = b[i] * c[i];
    

    Regarding SISD, from the Wikipedia one can read:

    In computing, SISD (single instruction stream, single data stream) is a computer architecture in which a single uni-core processor executes a single instruction stream, to operate on data stored in a single memory.

    This is not such much about the code but rather how it will be executed in the underlying architecture. A code that reflect this concept would be:

    for(int i = 0; i < N; i++)
       a[i]++;
    

    Regarding MISD, from the Wikipedia one can read:

    In computing, MISD (multiple instruction, single data) is a type of parallel computing architecture where many functional units perform different operations on the same data. Pipeline architectures belong to this type, though a purist might say that the data is different after processing by each stage in the pipeline.

    for(int i = 0; i < N; i++)
       a[i] = 10 * a[i] + a[i] / 2;
    

    Regarding MIMD, from the Wikipedia one can read:

    In computing, MIMD (multiple instruction, multiple data) is a technique employed to achieve parallelism. Machines using MIMD have a number of processors that function asynchronously and independently.

    For this you could have a MPI application with two processes where each processes executes two different applications.