R
R
Ruzel Davletyarov2014-06-19 20:25:47
C++ / C#
Ruzel Davletyarov, 2014-06-19 20:25:47

How to distribute an arbitrary binary array among processes in MPICH?

Hello.
Through a stream, writes an arbitrary number of binary data to a file, from 100,000 or more.
There is a program (in ANSI-C) using the MPICH 3.1 library, I parallelized it.
The server has a processor with 4 cores (2 ALUs + 1 FPU).
I parallelized the software into 8 threads. Here's the catch. I found an artifact, if my buffer does not have a multiple number of elements (maybe even an odd number), jambs are detected, including (some threads do not receive their data, although they are running).
Help with ideas, the course of the solution, show the track :)
OK, how to divide (distribute) the data among the processes?
The code in the studio can not (non-disclosure agreement).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fedor Laktionov, 2015-06-10
@megat72

And what's the problem, leaving the rest to the last thread?

elements_per_thread = elements_count / threads_count;
for( i = threads_count ; i-- ; ){
  thread[i].count = elements_per_thread;
}
thread[threads_count - 1].count += elements_count % threads_count;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question