Newsgroups: comp.parallel.mpi
From: thakur@abacus.mcs.anl.gov (Rajeev Thakur)
Subject: Re: MPI-2: MPI_TYPE_CREATE_SUBARRAY (Fortran binding issue)
Organization: MCS, Argonne National Laboratory
Date: Tue, 10 Mar 1998 17:12:40 GMT
Message-ID: <8895499602758@abacus.mcs.anl.gov>

In article <35056083.B5F717B2@cranfield.ac.uk>,
Yon Han CHONG  <Y.H.Chong@cranfield.ac.uk> wrote:
>In MPI-2 it is defined that the begining of subarrary index should be 
>a positive numbers. In C, this does make sense. You do not want to go 
>over the boundary. In Fortran, this is restrictive because sometimes 
>it is more convient to define an array as following:
>   
>   integer, parameter :: N=5
>   real, dimension(-1:N+2) :: a_local
>
>"a_local" cannot be a subarray since the index start from a negative 
>number.

This is one of the reasons why MPI_Type_create_subarray
uses 0-based indexing for the subarray index. It is natural in C for
one. In Fortran, since an array could be defined in many ways, for
example, 1 to 200 or -100 to 100, we need to select one
way to specify the subarray. We chose 0-based. So if your Fortran
array is (-1:N+2), and the subarray you want out of it is (5:10),
specify it as (6:11) to MPI_Type_create_subarray.

Rajeev



