From owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org  Fri Mar 29 20:15:47 2024
Return-Path: <owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom9
Delivered-To: sc22wg5-dom9@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id EA873356DFB; Fri, 29 Mar 2024 20:15:47 +0100 (CET)
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 15857 seconds by postgrey-1.34 at www5.open-std.org; Fri, 29 Mar 2024 20:15:47 CET
Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22])
	by www.open-std.org (Postfix) with ESMTP id ADE42356DF5
	for <sc22wg5@open-std.org>; Fri, 29 Mar 2024 20:15:46 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
	s=protonmail3; t=1711739745; x=1711998945;
	bh=VhGnnY36BkylZtCGuZjE/ME9VxnutksaHrbPRaSmOIA=;
	h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
	 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
	 Message-ID:BIMI-Selector;
	b=XtxL4UovTCAE5Vv6ipHKQVug9y7GjCiyPu2qGy5+cXIPzixrCtGVNdWfAs4WLdGPN
	 SFvVLxP8dsEE5SJKt3XuzzyXfy/phbcFML3K3oj0vOvzJg4yIImr9OPP1RiyT3Bczr
	 teA1epXUjnxHYHoKQxxEYS5N1EMVR46q60oVJ2Uk8N1fA9SQeYcyZy/Y+q5XNjrtAH
	 q85e5qIjIuUA86kU/WdLXrTBHuMjbCjnggxG+uIE8aL2Irj0uX8mQEdGZx/q4F6UV2
	 vSIJ9FJ1HTknSGGNKyETmV1ZnvXY5Vp9/RAEAF7+5UioiiIxQNWMlNoyQ71ZRX3eqz
	 Ivl4iWdTT0EmQ==
Date: Fri, 29 Mar 2024 19:15:33 +0000
To: General J3 interest list <j3@mailman.j3-fortran.org>, =?utf-8?Q?Thomas_K=C3=B6nig?= <tk@tkoenig.net>
From: Brad Richardson <everythingfunctional@protonmail.com>
Cc: Jeff Hammond <jehammond@nvidia.com>, WG5 <sc22wg5@open-std.org>
Subject: Re: [J3] [SC22WG5.6583] Fortran type sizes - please help with MPI Fortran
Message-ID: <dcbeb308c331a7a92f6a209098ed477cbde2e491.camel@protonmail.com>
In-Reply-To: <20240329175417.C02A4356DF4@www.open-std.org>
References: <DM6PR12MB3130E37E952301B9994A9BBBCB3A2@DM6PR12MB3130.namprd12.prod.outlook.com> <20240329145655.E8CFB356DD2@www.open-std.org> <1DFBC5F5-0300-419B-AD1D-C49E73E066A9@nvidia.com> <cb67f56d-cee1-4fd0-8cfb-cb60ec165534@tkoenig.net> <20240329175417.C02A4356DF4@www.open-std.org>
Feedback-ID: 13174433:user:proton
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

Hi Jeff,

It is my expectation that there is virtually no existing code using MPI
where "INTEGER is INTEGER(kind=3Dc_int)" is not the case, else it
wouldn't have worked in the first place. Unless you're telling me that
somebody is building a version of an MPI library and the Fortran
interface to it where that isn't the case, but if so I have faith they
could figure out how to continue doing weird things with the right
compiler options.

Brad

On Fri, 2024-03-29 at 17:54 +0000, Jeff Hammond via J3 wrote:
> MPI has three types of Fortran support.=C2=A0 The (deprecated) mpif.h and
> MPI.mod support an old-fashioned API, where we only use the primitive
> types of Fortran 77.=C2=A0 At least with MPI.mod, the compiler can do
> interface checking, although the type-safety is quite weak given most
> arguments are INTEGER.=C2=A0 The newer MPI_F08.mod, which Bill Long was
> instrumental in creating and which WG5 made possible with the Fortran
> 2018 CFI extensions, is a properly typed, modern Fortran API.
>=20
> The idea that "it will work" is equivalent to MPI asserting that
> INTEGER is INTEGER(kind=3Dc_int) or the MPI ABI doesn=E2=80=99t work, whi=
ch
> certain people will not accept unless WG5 provides some sort of
> evidence that I am not a lunatic for wanting to assert this.
>=20
> Jeff
>=20
> > On 29. Mar 2024, at 19.33, Thomas K=C3=B6nig <tk@tkoenig.net> wrote:
> >=20
> > External email: Use caution opening links or attachments
> >=20
> >=20
> > Am 29.03.24 um 16:24 schrieb Jeff Hammond via J3:
> > > The issue is, we have 30 years of MPI Fortran code that does
> > > things
> > > that are correct according to MPI and Fortran, but which are
> > > broken if
> > > we do certain things that are otherwise very nice from a software
> > > design perspective.=C2=A0 Breaking user code is bad for business, as
> > > everybody here knows :-)
> > >=20
> > > If we could redefine MPI Fortran to use ISO_C_BINDING types, we=
=E2=80=99d
> > > have
> > > zero problems, but ISO_C_BINDING came a decade after MPI was
> > > created
> > > and Fortran 2003 compilers weren=E2=80=99t widely available until wel=
l
> > > after 2003.
> >=20
> > How does MPI define its interfaces?=C2=A0 Does it use Fortran modules o=
r
> > the traditional F77-style ABI (with no checking) that f2c etc use?
> >=20
> > For the former, C interoperable types could be used; I think all
> > major compilers support it by now.
> >=20
> > For Linux and at least some BSD variants on AMD64, the latter is
> > defined in the x86-64-ABI psABI, which can be found at
> > https://gitlab.com/x86-psABIs/x86-64-ABI=C2=A0(section 9.2),
> > and major other architectures and operating systems effectively do
> > the same.
> >=20
> > Maybe defining the MPI interface with respect to an existing ABI
> > would be less onerous than just saying "it will work".
> >=20
> > Best regards
> >=20
> > =C2=A0=C2=A0 Thomas
> >=20
>=20


