HI Elias,
thanks for the quick reply. Yeah, I figured that was one option to go
with but I guess I don't like the way the matrix elements are being called,
however, I guess if there is any significant improvement in comm. time maybe
that is the way to go!
Thanks again and cheers,
C.S.N
On Thu, Oct 29, 2009 at 11:36 AM, Elias SantAna
<lordcinneris_at_[hidden]>wrote:
> 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] <http://mc/compose?to=lam@lam-mpi.org>
>
> 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] <http://mc/compose?to=lam-request@lam-mpi.org>
>
> You can reach the person managing the list at
> lam-owner_at_[hidden] <http://mc/compose?to=lam-owner@lam-mpi.org>
>
> 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)
>
>
> ------------------------------
> Veja quais são os assuntos do momento no Yahoo! + Buscados: Top 10<http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/>-
> Celebridades<http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/celebridades/>-
> Música<http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/m%C3%BAsica/>-
> Esportes<http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/esportes/>
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
|