Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question