-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic processing of assumed rank objects #144
Comments
Having read your proposal, I am inclined towards the ASSOCIATE alternative - it feels more inline with the newer constructs. I guess it also be possible to do: |
While permission of multi-rank mappings could certainly be allowed, it is not really germane to the use-case at hand. I also prefer the ASSOCIATE, but the rank-remapped pointer conveys the idea, since it is already in the language. The bounds specs, I think, are necessary. Especially for the rank "*" case. |
I think, this possibility could/should be combined with the possibility of returning an array of arbitrary rank in a function, and a generic way to access the indexing of the arrays, similar how it can be already in C since Fortran 2018.
This possibility, combined with the multi-rank mapping as suggested by @arjenmarkus would eliminate a lot of the Fypp-magic in the stdlib-statistical functions. |
Has the concept of type(slice) already been submitted as an issue? |
I've now created issue #153 for that in order not to pollute this issue. |
Paul Thomas has suggested to also permit RESHAPE with an assumed-rank argument. For this, the CONTIGUOUS attribute would not be needed. Also, it appears that the feature is relatively easy to implement, so would give good bang for the buck. |
Poor Reinhold did not have time enough on this Earth to continue the conversation. May he rest in peace. I have attached the files that I sent him, including a provisional implementation for gfortran. I intend to take this further since I find this approach to generic rank objects to be highly intuitive. I had been testing the algorithm for the reduce intrinsic function, which is not yet implemented in gfortran. The commented out rank-ology has been neatly replaced by reshape. |
@PaulThomas1000 excellent. If you know how to prototype this in GFortran, please go ahead and definitely pursue that. That is what we need to be doing for every proposed feature. It will also greatly improve the chances of it being accepted. |
Hi Ondrej,
My instinct is to prepare the correct documentation, finish the patch for
gfortran and submit it as a non-standard, experimental feature. That way,
it will outlive my association with gfortran and, possibly, outlive me :-(
I will introduce -std=202y, while I am about it.
Maintaining collective memory is a very real problem with volunteer based
compiler projects. I don't know another way to do it.
Regards
Paul
…On Wed, 3 Jul 2024 at 17:56, Ondřej Čertík ***@***.***> wrote:
@PaulThomas1000 <https://github.com/PaulThomas1000> excellent. If you
know how to prototype this in GFortran, please go ahead and definitely
pursue that. That is what we need to be doing for every proposed feature.
It will also greatly improve the chances of it being accepted.
—
Reply to this email directly, view it on GitHub
<#144 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BJUEYWHVDQEJXNHMCMH5KP3ZKQUKPAVCNFSM6AAAAABI5B67CKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBWG44TIOJXHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@PaulThomas1000 Perfect, I think that's a great plan. Thank you for doing that. |
Paul,
Thank you for your followup.
On another note, will it possible for you to post on Fortran Discourse site
and AGAIN offer some summary on how other users of gfortran can take up
work on gfortran, perhaps submit patches, develop some new capabilities,
etc ?
Reading your input may prove very useful with the gfortran users,
especially the younger Fortranners:
https://fortran-lang.discourse.group/
Best Regards,
Vipul Parekh
P.S.> I had worked with you and Damian Rouson on PDTs in gfortran circa
2017, if you recall
On Wed, Jul 3, 2024, 4:41 PM PaulThomas1000 ***@***.***>
wrote:
… Hi Ondrej,
My instinct is to prepare the correct documentation, finish the patch for
gfortran and submit it as a non-standard, experimental feature. That way,
it will outlive my association with gfortran and, possibly, outlive me :-(
I will introduce -std=202y, while I am about it.
Maintaining collective memory is a very real problem with volunteer based
compiler projects. I don't know another way to do it.
Regards
Paul
On Wed, 3 Jul 2024 at 17:56, Ondřej Čertík ***@***.***> wrote:
> @PaulThomas1000 <https://github.com/PaulThomas1000> excellent. If you
> know how to prototype this in GFortran, please go ahead and definitely
> pursue that. That is what we need to be doing for every proposed
feature.
> It will also greatly improve the chances of it being accepted.
>
> —
> Reply to this email directly, view it on GitHub
> <
#144 (comment)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/BJUEYWHVDQEJXNHMCMH5KP3ZKQUKPAVCNFSM6AAAAABI5B67CKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBWG44TIOJXHA>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#144 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACREMXYCPO2HWKUMSIR4BZTZKROZJAVCNFSM6AAAAABI5B67CKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBXGIZTENRVHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hi Vipul,
It's good to hear from you. I have been slow to reply, mainly because of
daytime work but also due to the push to get regressions fixed before the
14.2 release. Please accept my apologies.
I will wait until after the 14.2 release before having the conversation
about F202y features. There are other low hanging fruit there but generic
programming is a wholly different ballgame, especially if dynamic dispatch
were required.
Of course I remember you :-) The PDT implementation is something of an
embarrassment to me because the representation is plain wrong. It's
become a bit like the Jews' "next year Jerusalem". I am clearing the decks
to try and get it done this fall.
I'll take a look at the fortan-lang group to get some feel for what to say
and how to say it.
Best regards
Paul
…On Sat, 6 Jul 2024 at 20:21, FortranFan ***@***.***> wrote:
Paul,
Thank you for your followup.
On another note, will it possible for you to post on Fortran Discourse
site
and AGAIN offer some summary on how other users of gfortran can take up
work on gfortran, perhaps submit patches, develop some new capabilities,
etc ?
Reading your input may prove very useful with the gfortran users,
especially the younger Fortranners:
https://fortran-lang.discourse.group/
Best Regards,
Vipul Parekh
Message ID: ***@***.***
com>
|
The concept of assumed rank permits definition of interfaces that are rank-agnostic.
The addition of the SELECT RANK block construct permits definitions and references to the object by resolving at run time to whatever rank the actual argument has. This is fine in case the array rank e.g. reflects different problem dimensions, requiring different algorithms for its solution. However, there are also cases in which uniform treatment of the argument's data irrespective of its rank is required. This is currently cumbersome to do.
This proposal suggests supporting this at least for the case of a CONTIGUOUS argument by remapping to a suitable rank-1 entity.
Variant 1: Permit pointer assignment
Assuming declarations
REAL, CONTIGUOUS, TARGET :: X(..)
REAL, POINTER :: XP(:)
it should be permissible to write
XP(1:SIZE(X)) => X
Note that for X assumed shape and any rank, this is already permitted. Some words would be needed to treat the rank 0 and rank "*" cases. The data in X could then be processed via XP.
Variant 2: Extend ASSOCIATE semantics
Assuming a declaration
REAL, CONTIGUOUS :: X(..)
it should be permissible to write
ASSOCIATE(XA(1:SIZE(X)) => X)
... ! definitions and references to XA
END ASSOCIATE
This variant would not require the TARGET attribute on X. Inside the ASSOCIATE block, the data could be processed via XA.
Requiring the CONTIGUOUS attribute imposes no limitation on functionality. Users need to be made aware of the potential performance impact for copy-in/out.
The text was updated successfully, but these errors were encountered: