Fortran playground

Hey so I wanted to play around with the editor on the website that has the tutorial feature, but when I click the ‘play’ button it just loops in a never ending way and nothing - from the standard template of the tutorial, to my own tinkering input, ever displays.

1 Like

I get the same error - I’ve tried with adblock on/off and it made no difference. Perhaps there is a bug @certik @milancurcic (I’m not really sure who is in charge of the website)…

EDIT: For now, try for a web-interactive Fortran development experience.


thanks I think I will use the resource to copy and paste from the tutorial into the compiler and I think I will get the necessary information just without of tab switching

so my latest problem is that I wanted to download a compiler and play around with the tutorials but I tried installing cygwin and getting it to work and nothing at all is working and the information is basically not there

Sorry @fortranewb, the playground backend runs on a free AWS instance that provides 10% of a small vCPU. The backend often gets “busy” and unresponsive. I also encourage you to try instead.

Thanks for tagging me. It is indeed a known bug on the playground backend–currently the server code allows long-running processes to run in the background, so if any user submits a long-running program (via execute_command_line, system or otherwise), this will eat up the free vCPU allowance and bog down the system. There are a few issues here that if addressed would go a long way to improve the reliability of the backend. @ashirrwad did great work building the playground during the GSoC '22 program, but the time was limited and he could only get so far. The playground is very much at a “proof of concept” stage of maturity and needs more work.

I’m also the only one managing the instance on AWS. When I notice it down or see reports like this, I go in and reboot the instance. For example, I just did it and the playground now responds in a few seconds. If anyone would like to help manage the instance on AWS besides me, please let me know.

@milancurcic , @certik, et al.,

Would you have any thoughts on what it would take to create a Fortran Software Foundation a la PSF (you will know this link) that within the US is also recognized as 501(c)(3) and make Fortran-lang part of FSF and which can seek and gain funding and have administrative staff who can maintain infrastructure as part of official duties such as the Fortran playground?

Ideally the infrastructure such as Fortran playground that are your great ideas will also be accepted as needing professional, full-time hands to take to next level and be maintained.

1 Like

Yes, it’s a LOT of work. Since none of us currently has such time to managed that, we use NumFOCUS for that, and fortran-lang got recently accepted there, LFortran has already been there for a few years. They have administrative staff, can accept donations, they do contracts, accounting, etc.

Regarding the Fortran playground, I recommend we do not use a solution that requires a full time professional, but rather a solution that we can manage for free, if there is one. I am offering which is maintenance free (hosted at static github pages) and fast, with the only downside that LFortran is alpha. As we reach beta hopefully in less than a year, it will be very usable to use online. And use the saved money to pay a full time professional to advance some of our core libraries like fpm.

@certik, that’s great but note there are two use cases at play which do have differences:

  1. the site for LFortran can showcase LFortran and it will be a while before LFortran becomes Fortran 2023-compliant,
  2. in the meantime, a site to showcase Fortran generally where the default processor - behind the “curtain” - is the one closest to being fully standard-compliant can be a major boost for the language with newcomers being to use it as a playground.

Eventually the two might converge but that is likely a while away.

Ultimately though there is no substitute ever for focused and intense effort to staff people toward tasks and to pay them to complete duties and to maintain and nurture them. Few can do over the long run what @milancurcic is doing with, “I’m also the only one managing the instance on AWS. When I notice it down or see reports like this, I go in and reboot the instance.” Such efforts will inevitably die off.

With 501(c)(3), I can be motivated to contribute an annual amount, in say low 4 figures, and perhaps others might also. Additionally, many orgs can be influenced to fund as well, possibly with some marketing angle. This can expand over time to bigger things. @awvwgk and you are already doing this to some extent with STF.

The gist being I am a small ideas person and I can offer some microfunding and, when there is interest, some interps on the standard and comments on the language application toward applied efforts. That’s my limit. I will absolutely not do administrative work, etc. - don’t have the time nor any inclination for it. I suspect there are others like me. So the question is whether there is any value to leveraging such readers. If not, oh well … this was all just some thoughts I had given some better showcasing that can come out of the Fortran playground - can be ignored.

1 Like

Yes, I think gfortran and flang developers should also get their compilers online. In the meantime, there is also, where you can use both gfortran and flang.

The playground doesn’t need maintainers, especially not the full-time kind. It needs open-source contributors to improve the backend. Once the backend is robust, there’s virtually no maintenance needed.

My point is about infrastructure in general and being able to support simple, clear vision and mission.

Ideally with the playground, it will be to showcase Fortran language as fully as possible.

It does not do so now, and an appreciable upgrade is needed.

Because what is there now is a flavor of an anonymous processor in the backend that does not yet support a significant fraction of the current standard. And I know of at least 3 people at work over the last few months who haven’t gotten the playground to respond successfully or in an agile fashion on simple attempts.

If you really think you can keep any of the infrastructure going for any reasonable period on volunteers - even the “virtually no maintenance” playground once the backend becomes robust that may be never nor stay forever - it’s time for back to school and a lesson in economics.

Sure, and my point was strictly about the playground backend.

Please don’t be condescending to me–I didn’t ask for education advice. What I wrote about server maintenance was based on my personal experience, not a textbook or a class.

If someone just wants to run some Fortran code and is not interested in looking at the resulting assembly, searching “online fortran compiler” yields various sites that use gfortran, such as OnlineGDB. The sites offer many languages besides Fortran.

1 Like

@FortranFan the playground uses GFortran. What part of the standard is not supported well in gfortran? I know there are some limitations in parametrized derived types. Is there anything else?

I am personally just focusing on getting LFortran to compile all codes. Then you get the online playground for free (fast, robust, maintenance free due to using static pages), and many other advantages. Yes, today you only get alpha, but there is no other way to get a production compiler than several years of development.

1 Like

There may be other features I’m not aware of, but IMO coarrays, teams, events, and collectives are also not usable on multiple images without a 3rd party runtime such as OpenCoarrays.

It may be a lower priority than other standard features, but I think that down the road it would be important for LFortran to provide distributed memory parallel features out of the box, without a 3rd party library.

1 Like

Indeed, this is the main strength of the LFortran playground–that it runs in the browser and doesn’t require a backend. As you know, I recommend it myself to others, and I even promoted it in my job interview seminar in May. For code that is supported, and if other compilers are not needed, it’s the way to go.

The key differentiator of a playground backend server (once it works well), is the ability to run any compiler available. Whether and how important that is is debatable, and I’m not clear myself what the answer is.

My perspective on these efforts and mini-projects (e.g. playgrounds) is not that one or the other is the end-all. I see both as having value and advantages rather than competing. I know that for many people the mission here is to provide robust, production-grade services that people can rely on. That’s admirable but also not how I can best help. Rather, my efforts are more oriented toward exploring, experimenting, and providing opportunities and space for other contributors to build upon and take them in directions of highest perceived need, excitement, or both.

Sorry, long tangent but I thought relevant to the conversation.


Indeed, I also don’t have a clear cut answer today. Each solution has pros and cons. Ask me in 2 years, I think I will have an answer. :slight_smile: Thanks for pointing people to the LFortran demo, I appreciate it.


Live Fortran pages (Online Compilers)

Just regarding an on-line playground and possible additional functionality, as has come up in bits in pieces in other discussions having one that can be customized allows not just for multiple compilers such as gfortran and lfortran to be supported, but to allow support of the fpm repository, for fortran snippets in this forum to be automatically runnable, as well as example programs in the documentation such as in the intrinsic descriptions, even some graphics capabilities, … I picture someone making a post of executable code, clicking on it and automatically having the code in an editor in a live fortran environment; running and modifiying it and reposting it; even having a version editable by the group and that the community can add examples to ala Rosetta Code like

Sites for gathering programming idioms and programming chrestomathy

Perhaps if a wish-list is gathered here or as an extension of the original playground project it could act as a seed project for testing the funding method(s) such as mentioned above; pending review of the resulting proposals? Direct funding, donation of time and technical skills, creation of useful documentation and examples, and incorporation of the results into development processes are all in some form of progress but do not yet feel easily accessible or easy to contribute to in all cases.

Wish: playground integration with fpm packages

A live Fortran site with access to fpm repository packages (and maybe git repositories as well) touched upon at 0.8.2 fpm registry release

Wish: Integration of the playground with Discourse postings and fortran-lang documentation

So one wish is that a self-contained fortran post on this forum could automatically load on
the live Fortran pages. On the playground that is simple up to the point of the size allowed
in theory.

A manual example using a code snippet example:

recursive example code
! jkd2022
! How many ways can you change N dollars into coins (cents, dimes, nickels, quarters, 50 cent and dollar coins)?
! Here’s a nice compact solution using Fortran’s recursion feature.

program change_for_dollars
implicit none
integer ndollars,ncents

write(*,'("Enter number of dollars : ")',advance='NO')
read(*,*) ndollars
! convert to cents

write(*,'("Number of ways ",I4," dollars can be changed to coins is")') ndollars
write(*,'(I8)') nways(ncents,6)


recursive function nways(ncents,ncoins) result(nw)
implicit none
! arguments
integer, intent(in) :: ncents,ncoins
integer nw
! local variables
integer c,i
! cent, nickel, dime, quarter, 50 cent and dollar coin
integer, parameter :: coin(6)=[1,5,10,25,50,100]
if (ncoins.eq.0) then
end if
if ( return
do i=1,ncents/c
end do
if (mod(ncents,c).eq.0) nw=nw+1
end function

end program

I tried to use some of the mentioned online compilers so see if they have all the features of Fortran 2003. Seems not all of them can execute the Fortran 2003 code.

simple example

program main
    implicit none
    integer:: i,j
    real:: r(4)
    print *, "hello, world"
    r =[1,2,3,4]

    print*, r



6 |     r =[1,2,3,4]
  |         1

Error: Fortran 2003: […] style array constructors at (1)

However, LFortran (, (Create a new Fortran program - myCompiler - myCompiler – it uses gfortran 11.2.0) can execute the same program. Further, LFortran can not execute the program containing allocatable statement.

The following cannot:

Online Fortran Compiler - fortran
Tryit Compiler v1.0
EHCMMw - Online Fortran Compiler & Debugging Tool -
Online Fortran Compiler - Online Fortran Editor - Run Fortran Online - Online Fortran Runner