<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Hi Matthieu,</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">These functions only copy all the data of the datatype into a contiguous memory region. They don't do any further action. I'd say these are a more natural and efficient solution for your problem than the self send-receive approach. Note that the send is internally performing the pack before sending, so you'd effectively do the same but avoiding the send/receive step.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">  Antonio</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">On Thursday, July 18, 2013 04:35:28 PM Matthieu Dorier wrote:<br /></p>
<p style=" margin-top:12px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;">Hi,</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;"><br /></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;">I'd like some clarification on MPI_Pack/Unpack: the standard only says that "some communication libraries provide pack/unpack functions for sending non-contiguous data", but it's not clear to me what MPI_Pack/Unpack are supposed to do. For example, if I have a MPI_Datatype representing a structure with holes between fields, is MPI_Pack just supposed to put the elements of the structure close to each other so that there is no more holes, or can it do something different (compressing, adding metadata, etc.)?</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;"><br /></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;">The reason I'm asking this is because I'm designing a code to extract chunks of multi-dimentional arrays (basically a big array has ghost zones and I want to extract the non-ghost data from this big array into a smaller array, contiguous in memory). This extraction is local and does not involve communication so right now after using MPI_Type_create_subarray to create a datatype adapted to my need, I post an MPI_Irecv with a contiguous array of MPI_CHAR as type, and then an MPI_Send with one element of the type I just created. I was wondering if MPI_Pack would be equivalent (and maybe more efficient)?</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;"><br /></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;">Thanks<br /><br /></span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;">Matthieu Dorier<br /></span><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;">PhD student at ENS Cachan Brittany and IRISA<br /></span><a href="http://people.irisa.fr/Matthieu.Dorier"><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; text-decoration: underline; color:#0057ae;">http://people.irisa.fr/Matthieu.Dorier</span></a><span style=" font-family:'times new roman,new york,times,serif'; font-size:12pt; color:#000000;"><br /></span></p></body></html>