Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
172 views
in Technique[技术] by (71.8m points)

python - 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
question from:https://stackoverflow.com/questions/65952780/looking-for-flynns-taxonomy-code-example-for-openmp-and-mpi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...