[Mpi-forum] MPI_Type_create_struct vs. other datatype creation routines

Pavan Balaji balaji at mcs.anl.gov
Mon Aug 29 20:27:57 CDT 2011


Fab and Mohamad,

A plan to change all the datatype creation functions to take greater 
than int size arguments sounds like a good idea. However, the 
hindexed_block is a simpler and more trivial addition to the standard. 
So, while both can be pursued, I think they should be separate tickets.

  -- Pavan

On 08/29/2011 02:57 PM, Mohamad Chaarawi wrote:
> Hi Fab,
>
> On 08/29/2011 02:29 PM, Fab Tillier wrote:
>> Mohamad Chaarawi wrote on Mon, 29 Aug 2011 at 12:08:49
>>
>>> Hi Fab,
>>>
>>> On 08/29/2011 01:58 PM, Fab Tillier wrote:
>>>> Pavan Balaji wrote on Mon, 29 Aug 2011 at 07:21:32
>>>>
>>>>> Great. We have a use case for this as well, and we are essentially doing
>>>>> exactly what you are doing. Are you planning to do a formal reading for
>>>>> it at the next meeting?
>>>>>
>>>>> Btw, hindexed is not a real replacement for indexed as the MPI
>>>>> implementation can be better optimized for indexed than hindexed (e.g.,
>>>>> alignment checks). So the right solution would have been to allow
>>>>> indexed to take MPI_Aint arguments as well. But given that the
>>>>> performance difference would be so small, I'm not sure if we should
>>>>> create yet another set of routines for it.
>>>> IMO, there should be MPI_Count versions of all the datatype constructors,
>>>> and the existing ones deprecated.  I thought there was some work to that
>>>> effect going on.  That's not to say I wouldn't want to see hindexed_block in
>>>> the standard, I'd just rather it used MPI_Count than MPI_Aint...
>>>>
>>> I though datatype creation (and several other) functions that use int s
>>> for the count should have MPI_Count versions, but the H versions, that
>>> use byte displacements, should still use MPI_Aint, because it's not
>>> really a count of datatypes, but just an offset into memory.
>> Datatypes may represent data on a file, not just in memory.  How do you express an offset (byte displacement) in a file, when that offset can be larger than what can be represented by MPI_Aint?
>
> yea ok.. so you're saying MPI_Count should be able to handle large
> counts of oldtype, and large addresses into memory (MPI_Aint) and file
> (MPI_Offset). I though MPI_Count was just to handle larger than 32 bit
> integer count of "oldtypes".
>
> Mohamad
>
>> Cheers,
>> -Fab
>>
>>> Mohamad
>>>
>>>> -Fab
>>>>
>>>>>      -- Pavan
>>>>> On 08/29/2011 07:55 AM, Mohamad Chaarawi wrote:
>>>>>> Hi Pavan,
>>>>>>
>>>>>> actually I created a ticket for that about a month ago, #280 :)
>>>>>> https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/280
>>>>>>
>>>>>> we have a usecase were we use hindexed for MPI_Aint displacement, but
>>>>>> we really need 1 block length, so we end up passing an array of 1s :(
>>>>>>
>>>>>> Thanks,
>>>>>> Mohamad
>>>>>>
>>>>>> On 08/27/2011 08:34 PM, Pavan Balaji wrote:
>>>>>>> Ok, that makes sense. It would have been good if the ones where
>>>>>>> offsets are specified in datatype lengths also took MPI_Aint, to allow
>>>>>>> for MPI_BOTTOM.
>>>>>>>
>>>>>>> Using hindexed instead of indexed would have been OK, except the MPI
>>>>>>> implementation can optimize alignment checks for indexed (by
>>>>>>> checking only the first element), but can't do that for hindexed.
>>>>>>>
>>>>>>> Also, are we missing hindexed_block in the standard?
>>>>>>>
>>>>>>>      -- Pavan
>>>>>>> On 08/27/2011 10:04 AM, Rajeev Thakur wrote:
>>>>>>>> If the displacement is specified in multiples of the extent of
>>>>>>>> oldtype, it is defined as int. If the displacement is specified in
>>>>>>>> bytes it is defined as Aint.
>>>>>>>>
>>>>>>>> Rajeev
>>>>>>>>
>>>>>>>>
>>>>>>>> On Aug 27, 2011, at 7:08 AM, William Gropp wrote:
>>>>>>>>
>>>>>>>>> Look at the Fortran binding - to create Fortran interfaces that
>>>>>>>>> used MPI_ADDRESS_KIND, we first had to *have* an MPI_ADDRESS_KIND,
>>>>>>>>> which is possible in Fortran 90 and later.  MPI-1 could only
>>>>>>>>> provide a Fortran 77 binding.
>>>>>>>>>
>>>>>>>>> Bill
>>>>>>>>>
>>>>>>>>> On Aug 27, 2011, at 6:03 AM, Pavan Balaji wrote:
>>>>>>>>>
>>>>>>>>>> No, that can't be right.
>>>>>>>>>>
>>>>>>>>>> MPI_Type_hindexed was in MPI-1, and it had MPI_Aint for
>>>>>>>>>> displacement.
>>>>>>>>>>
>>>>>>>>>> MPI_Type_indexed on the other hand uses int.
>>>>>>>>>>
>>>>>>>>>> MPI_Type_struct in MPI-1 also used MPI_Aint.
>>>>>>>>>>
>>>>>>>>>> MPI_Type_create_indexed_block was added in MPI-2.1 (or 2.2?) and
>>>>>>>>>> uses int.
>>>>>>>>>>
>>>>>>>>>> It all seems arbitrary to me.
>>>>>>>>>>
>>>>>>>>>> -- Pavan
>>>>>>>>>>
>>>>>>>>>> On 08/27/2011 05:18 AM, Jeff Squyres wrote:
>>>>>>>>>>> An offhand guess: TYPE_CREATE_STRUCT was created in MPI-2,
>>>>>>>>>>> whereas the rest were created in MPI-1.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Aug 27, 2011, at 3:54 AM, Pavan Balaji wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Is there a reason why MPI_Type_create_struct was given the
>>>>>>>>>>>> special privilege of using MPI_Aint to store displacements, while
>>>>>>>>>>>> the remaining datatype creation routines use int? This would
>>>>>>>>>>>> essentially disallow creation of a datatype as an offset to
>>>>>>>>>>>> MPI_BOTTOM.
>>>>>>>>>>>>
>>>>>>>>>>>> -- Pavan
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Pavan Balaji
>>>>>>>>>>>> http://www.mcs.anl.gov/~balaji
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> mpi-forum mailing list
>>>>>>>>>>>> mpi-forum at lists.mpi-forum.org
>>>>>>>>>>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>>>>>>>>>> --
>>>>>>>>>> Pavan Balaji
>>>>>>>>>> http://www.mcs.anl.gov/~balaji
>>>>>>>>>> _______________________________________________
>>>>>>>>>> mpi-forum mailing list
>>>>>>>>>> mpi-forum at lists.mpi-forum.org
>>>>>>>>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>>>>>>>>> William Gropp
>>>>>>>>> Director, Parallel Computing Institute
>>>>>>>>> Deputy Director for Research
>>>>>>>>> Institute for Advanced Computing Applications and Technologies
>>>>>>>>> Paul and Cynthia Saylor Professor of Computer Science
>>>>>>>>> University of Illinois Urbana-Champaign
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> mpi-forum mailing list
>>>>>>>>> mpi-forum at lists.mpi-forum.org
>>>>>>>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>>>>>>>> _______________________________________________
>>>>>>>> mpi-forum mailing list
>>>>>>>> mpi-forum at lists.mpi-forum.org
>>>>>>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>>>>>> _______________________________________________
>>>>>> mpi-forum mailing list
>>>>>> mpi-forum at lists.mpi-forum.org
>>>>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>>>> _______________________________________________
>>>> mpi-forum mailing list
>>>> mpi-forum at lists.mpi-forum.org
>>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>>> _______________________________________________
>>> mpi-forum mailing list
>>> mpi-forum at lists.mpi-forum.org
>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>> _______________________________________________
>> mpi-forum mailing list
>> mpi-forum at lists.mpi-forum.org
>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum
>
> _______________________________________________
> mpi-forum mailing list
> mpi-forum at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum

-- 
Pavan Balaji
http://www.mcs.anl.gov/~balaji



More information about the mpi-forum mailing list