0

I am quite new in using MPI parallel process.

I am dealing with the following problem related to the MASTER/SLAVE approach.

I have a 2D-squared array of SIZE=500, and I need to break it into several blocks of dimension:

D < SIZE.

I should implement a Master/Slave MPI where each processor receives, and sends back to the master N blocks, where N depends on the number of processors involved and the dimension D of the subblocks.

I managed to solve the problem by dividing the original array in stripes, but I don't know how to deal with squares!

2 Answers 2

0

In order to simplify your problem, D must be a divider of 500. Now, the total number of blocks should be blocks = sqr(500/D). and N should be something along the lines n = blocks/cpus.

IMHO simplest way would be to create a square of DxD elements from the array and send that chunk of data to the client. Depending on the language and method, you can build small objects and send them to the client or just replicate the full matrix and send the coordinates for the chunk.

Sign up to request clarification or add additional context in comments.

Comments

0

An other option is to use MPI_Type_create_subarray() in order to create a derived datatype for a given (sub) square/rectangle of your array.

On the down side, this derived datatype cannot be used with collective operations such as MPI_Scatter[v]() and MPI_Gather[v](), which is usually the "natural" MPI way of distributing / re-assembling data.

1 Comment

Could you give me link a reference where I can find how to use that? Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.