GSoC'22 : Fortran playground - LIVE NOW

Greetings of the day everyone,

Over the last few months we had been working on creating a playground for Fortran, that can be offered as an extension to the offiicial fortran-lang website. The purpose of this playground is to showcase Fortran features to new users and make it easy for them to pickup the language. The playground also offers the capability of trying out new libraries(we currently only support stdlib but it can be expanded very easily as we use FPM). The playground is now LIVE, I would urge you to visit and ‘play’ around with it.

Note this is an early version of the playground and we will be constantly working to improve it even after the GSoC period. If you find any issues or have any suggestions to improve it, create an issue on the repo or drop them here.
We can definitely use your support to improve the tutorial and decide what libraries to incorporate.

I would like to thank @milancurcic @everythingfunctional @Arjen and everyone else who was involved in the process of creating it over the summer. It wouldn’t have been possible without your help. I have also created the final report for the project which you can check out here.

Let’s build together.

Regards,
Ashirwad Mishra

30 Likes

Great work! I hope it will serve the Fortran community and particularly newcomers well in the future.

It’s really nice to see the stdlib modules available:

program main
  use stdlib_sorting
  implicit none
  
  real :: a(3)
  
  a = [3,2,1]
  call ord_sort(a)
  print *, a
  
 end program

(For anyone interested, the documentation of stdlib_sorting is here.)

Output
1.00000000 2.00000000 3.00000000

4 Likes

This is AMAZING! Great work!

5 Likes

Impressive work.
A few improvement suggestions:

  1. A link to the Fortran-lang main page and tutorials on the playground page would be helpful for beginners.
  2. An explicit visible link to the playground from the Fortran-lang main page would also be quite valuable for beginners and everyone.
    again, great work!
6 Likes

Absolutely brilliant, @ashirrwad , congratulations on great work. And kudos to @milancurcic and @Arjen for their contributions to the creation.

A question, on this cc: to @milancurcic and @Arjen

If one of the major goals is as you state to “to showcase Fortran features to new users” then is it possible to allow for an option to select a Fortran processor in the “playground” and perhaps even default the choice of the processor to the one that comes closest to a current Fortran standard?

The reason for my inquiry is this: I tried a few very simple cases and they worked flawlessly in the playground. Then I arbitrarily tried a case in this thread and I got the same error in the Fortran playground as with gfortran. However to the best of my knowledge, the example therein conforms to the Fortran standard and it works as expected with two other processors including Intel oneAPI IFORT. Now IFORT is a Fortran 2018 compiler (yeah I know about the outstanding bugs and some missing support like an additional character kind).

But it will be nice if the Fortran playground can use some other processors also so that it can be showcased more broadly with a current edition of the Fortran standard.

4 Likes

Nice. It seems that concentrating on fpm integration would be a great differentiator and support other fortran-lang projects so I like the track you are on. Comparing it to other online compiler interfaces (many of which are multi-lingual and not concentrated on Fortran, let alone fortran-lang) and looking at what can further differentiate this, and some nice features to add I was wondering if any of these additions are on the horizon?

Differentiate:

  • load fpm sites
  • links into Fortran Discourse
  • draw on import of hosted code such as code examples from intrinsics, etc.
  • links to associated Fortran documentation on fortran-lang

Examples from other online services

  • beautify codes
  • modernize code
  • various compilers (and compiler options)
  • gprof, gdb
  • various editors
  • upload and download files and shareable project hosting
  • training classes

Picturing being able to put code into a shareable project that others could run an modify as part of a discussion in Fortran Discourse or other pie-in-the-sky ideas for the future capabilities and other possibilities makes me excited to see where this goes. I strongly second the suggestion to have a link on the top of Fortran-lang for this soon if it has not already been done.

6 Likes

@urbanjost Sure sir, We would be opening a PR for the link today itself.

2 Likes

@shahmoradi I’ve already linked the Fortran learn page and the main fortran-lang.org site, I worded it as ‘Home’ as we were expecting users to visit this page from the main site. I’ll work with @henilp105 to see the possible placement for the playground link on the fortran-lang homepage.

@FortranFan Yes, adding options for multiple compilers is on our list and we will be adding IFort soon. As @urbanjost stated we can offer different editors as well but Ace itself supports keybindings for various other editors VIM, Emac etc. So implementing that would be the first step. Shareable code instances was also one of the features I had planned in the earlier proposal and I will be starting the work for it soon. File upload and download will make the experience even better.

I was also planning to create an API for clickable snippets, where the user can click on a snippet and it will launch the playground with that same code.
These all suggestions can be incorporated once we refine the current version.

8 Likes

I am curious to know the compiler behind the Fortran Playground. Is it GFortran? LFortran? Another?

You can run

use iso_fortran_env
print *, compiler_version()
end

on it. It’s GFortran 11.2.1.

You can try LFortran at https://dev.lfortran.org/, it runs in the browser.

5 Likes

@milancurcic , @ashirrwad et al.,

Re: the compiler behind the Fortran playground, please consider making it the latest Intel Fortran i.e., IFORT version 2021.7 as part of freely downloadable 2022.3 Intel oneAPI HPC toolkit.

As a matter of practice, it will be good for the playground audience if the compiler behind the playground is that providing the “best” implementation of a current standard.

That is what will showcase best the Fortran language to its fullest capabilities on the playground. I would expect that is the primary purpose of the playground.

Currently Intel Fortran is the only compiler which passes the current standard 2018 conformance check (within a certain liberal tolerance toward outstanding bugs, of course).