Hello all,
I have the following simple MPI code. I was
wondering if there was a workaround for sending a dynamically allocated
2-D matrix? Currently I can send the matrix row-by-row, however, since
rows are not contiguous I cannot send the entire matrix at once. I
realize one option is to change the malloc to act as one contiguous
block but can I keep the matrix definition as below and still send the
entire matrix in one go?
You could just use a malloc to create a dynamic array and treat it as a matrix:
int* pseudmatrix
pseudomatrix = (int*)malloc(sizeof(int)*rows*collums);
and then, to access row i and collum j:
result = pseudomatrix[i+j*rows];
This matrix can be easily sent in just one message
--- Em qui, 29/10/09, lam-request_at_[hidden] <lam-request_at_[hidden]> escreveu:
De: lam-request_at_[hidden] <lam-request_at_[hidden]>
Assunto: lam Digest, Vol 1286, Issue 1
Para: lam_at_[hidden]
Data: Quinta-feira, 29 de Outubro de 2009, 14:00
Send lam mailing list submissions to
lam_at_[hidden]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.lam-mpi.org/mailman/listinfo.cgi/lam
or, via email, send a message with subject or body 'help' to
lam-request_at_[hidden]
You can reach the person managing the list at
lam-owner_at_[hidden]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of lam digest..."
Today's Topics:
1. Re: lam Digest, Vol 1285, Issue 1 (Elias SantAna)
2. Passing dynamic array as whole? (Natarajan CS)
3. execution time of a parallel program (madhuri gupta)
|