Fortran-lang accepted for Google Summer of Code 2022

Fortran-lang has once again been accepted for Google Summer of Code 2022! Thanks to everybody who helped prepare the application.

GSoC is Google’s global, online program that allows newcomers to open-source to work on a project and get paid for it. See the Fortran-lang GSoC 2022 page for information about the projects and how to apply. Applications for contributors open April 4 and close April 19. To learn more about GSoC and what has changed since last year, please see the GSoC 2022 announcement.

If you’d like to participate as a contributor or a mentor, please let us know in this thread and we’ll help you get started.

18 Likes

That looks like an awesome set of projects, I was completely unaware of Fortran-lang GSoC. I noticed that there are a couple of projects that I might be able to give some insight/contribute, namely:

  1. Language Server
  2. Parser + ASR (for F2PY)

Although, the Language Server that I am developing (fortls) parses Fortran into AST and not ASR.

Let me know if you think I can be of some assistance.

5 Likes

Thanks @gnikit, great to hear. I think it’d be great if you could co-mentor on one of the projects you’re interested in, or even suggest a new project idea–we can still add them and they could be outside of existing project categories. I wonder if there’s a path here for LFortran and fortls to collaborate.

CC’ing @certik @rgoswami.

1 Like

Yes, definitely. Thanks for writing here and offering help. I just wrote you a private email to setup a video call to discuss more.

I would be interested in brainstorming the language server, as you have a lot of experience there and see how we can join forces. We can use AST also, LFortran has both, and the AST in fact already works for all of Fortran (as far as we know), but for a language server it seems to me that you really want the semantics, thus ASR would be better.

1 Like

Re: @milancurcic

I would be glad to assist in either. Not sure if my knowledge is enough to co-mentor some, but more than glad for us to have a discussion.

As for LFortran and fortls that was my original thought too. It would be cool if fortls could become more robust and gain wider adoption. (I sure wish I had it 6 years ago when I started with Fortran).

Re: @certik

Thanks, I have sent back a reply. I am not against the idea. Currently, I am in the process of rewriting (in my non-existent free time) the bulk of the Fortran parsing. Changing between AST and ASR shouldn’t be too much of an issue I think.

1 Like

Hi @milancurcic , I am Arteev. I am a Computer Science Student from India. I am looking forward to contribute to Fortran-lang under the program of GSoC 22. I am particularly interested in the idea “fpm-ize the Fortran Ecosystem”. Can you share some resources that will help in getting some better understanding of this problem and will get to contribute to the organization.

5 Likes

Welcome @arteevraina and thank you for writing here. Beyond the project description the the ideas page, perhaps the first steps would be to read about fpm (docs and GitHub repo) and even start playing with it so you get a feel for all the things it can do. Specifically for this project, it will be important to have a good understanding of an fpm package layout and its manifest. Of course, learning these in-depth would be part of the project and not necessarily the requirement at the time of application, but the better you understand it the more of a head start you’ll have.

Then, we’d look at what’s already in fpm:

  • fpm-registry
  • @awvwgk has a list of all fpm packages on GitHub (whether or nor they’re part of fpm-registry) based on his script.

Understanding what’s already available as fpm package would help us identify gaps in the ecosystem and inform us whether there’s a specific application domain to prioritize.

Then, we’d research the online Fortran ecosystem and look for packages that are relatively:

  • Easy to write an fpm.toml for
  • High impact (useful real-world projects rather than toy examples)
  • Well documented
  • Well tested
  • Interesting to you to work on

One such group of packages could be those by Stefano Zaghi. They use a package layout somewhat different from fpm’s assumed layout and use git submodules to manage dependencies, but they’re otherwise low-hanging fruit.

I assume that researching the ecosystem would also involve polling the Fortran Discourse to get feedback on what Fortran packages people use the most.

I hope this gives you plenty info to spark interest, and let us know if any questions come up in the meantime.

5 Likes

Hello everyone, I am Anirudha Mirmira a physics PhD student (in my final stages) from JNCASR, Bangalore, India. I have been programming in Fortran for my thesis work and mostly write programs in the F90 standard. I have utilised MINPACK (J. Burkardt’s version) and FFTW for Fast Fourier Transforms in my code. I also code in Python and have bare minimum exposure to Julia.
Coming to GSoC, I am intrigued by the Sparse Matrix implementation and the SciPy implementation of MINPACK. I am also planning to implement the meshgrid issue in stdlib as my first contribution and am looking forward to work with a great group.

6 Likes

Welcome to the discourse, @anirudha-mirmira.

Regarding Minpack, we are currently in the process of implementing Python bindings in

Feedback on the proposed API is very welcome. We are currently stuck with a slight disagreement on how to wrap C to Python, but the choice of glue is only secondary.

From there we have decide on things like distributing wheels and how much of scipy.optimize we want/can to provide from the Minpack bindings already.

3 Likes

Thanks for such a detailed explanation. I will go through these links and will let you know if I have any questions and post them here. Thanks again.

2 Likes

Hi, I wanted to know how to start contributing to stdlib or Fortran-lang’s other repositories. I’m especially unfamiliar with Fortran preprocessing and would appreciate any references from where I can learn more about this.
Also, it would be very helpful if documentation regarding the method of submission and the files which should be worked on can be mentioned.
Thanks in Advance!

Hi @milancurcic @awvwgk . Can you confirm is this issue genuine? I encountered it while testing out the different fpm comands.

Thanks.

Hello @arteevraina,

thanks for posting. I had a look and I don’t think it’s a genuine error. As I understand it’s simply the output of a test driver for the new subcommand. I’ve left an answer in the issue.

If you’re looking for a possible contribution for the GSoC application, perhaps addressing the “FIXME” note on this line fpm/new_test.f90 at 86a8e2f71ee16be30bc21b7ff0273de324a59985 · fortran-lang/fpm · GitHub is one possibility.

3 Likes

Hi Anirudha,

stdlib uses the fypp preprocessor. The documentation of that project provides a nice introduction to the reasons and preprocessor language syntax. You could also take a look at the materials provided in the ForMoSa workshop, specifically the document MetaProgrammingWithFypp by @aradi.

For contributing to stdlib I’d suggest reading the WORKFLOW. If you are interested in sparse matrices, the next step would be to go through the pertinent issue: https://github.com/fortran-lang/stdlib/issues/38. It would also be a good idea to find an easier issue to get accustomed with the process of submitting a pull request.

2 Likes

Hi @ivanpribec

Thank you for the references, I will go through them. As advised, I will also work on some simpler issues before getting into the sparse matrix issue.

2 Likes

Thank you @ivanpribec. I am looking into this issue.

Hi, I am Ashirwad Mishra a 3rd year Computer Science major from Vellore Institute of Technology, Vellore(India). I have experience in Web Development and ML, mostly working on my own projects.
I would like to contribute this year to Build or embed online playground for fortran-lang.org
Can you please inform me how can I get started with this?
As of now I’m cloning the fortran-lang.org repo from github and trying to run it on my machine but I’m unsure how to proceed after I do this.

3 Likes

Welcome, @ashirrwad! Good first step getting familiar with the website repo. To start, I suggest:

  • Read all the contributor instructions (see the original post in this thread)
  • Research existing playgrounds from other languages e.g.:
  • Think about what approach would you take to implement this and why (HTTP client/server, Webassembly in browser, embedded Jupyter notebook etc.)
  • Find a small issue in any of the Fortran-lang projects and submit a small PR of your choice (bug fix, docs improvement, small feature)

Since this project would be started from scratch, you don’t necessarily need to worry about how to shoe-horn it into the existing website. The playground could be embedded in the page (like in the Haskell and Python examples), or not (like in the Nim and Rust examples that have a separate playground website). I think a separate playground website would be a better choice, as it would allow for more options and flexibility.

Let us know if you have any other questions.

2 Likes

Hi @ivanpribec . I had a look at the fpm/new_test.f90 at 86a8e2f71ee16be30bc21b7ff0273de324a59985 · fortran-lang/fpm · GitHub FIXME! code. I could not figure what we need to achieve differently here. I know that this piece of give us the fpm executable. Can you help ? So that I can understand it better and create a fix for this.

:warning: TL;DR

Hey @arteevraina,

Here’s what I am able to understand about the new-test driver:

  1. Upon running the command fpm test new-test, the file fpm/test/new_test/new_test.f90 will be compiled into an executable. The executable will be named something like build/gfortran_xxxxxxxx/test/new_test/new_test.
  2. The purpose of the executable is to run variations of the new subcommand which creates a new package directory and sample files. For each variation, the program will check if the desired outputs are generated, and add the result to a tally (score, record). In case of failure, the program will report what went wrong.
  3. After looping through the variations, the program performs clean-up, removing the folders and files that were just generated.
  4. The final tally is output so the developer can verify if all tests passed.

The fpm being tested, is not the system-installed one, but the one bootstrapped via fpm, that also resides in the build/ directory.

Now to the purpose of get_command_path:

  • When fpm test new-test is invoked, it actually executes the new-test executable that resides in the build/gfortran_xxxxxxxx/test/ folder; the purpose of the test however, is to invoke the actual fpm executable, that resides in the build/gfortran/_xxxxxxxx/app/ folder. The purpose of get_command_path is to find/assemble the path of the fpm executable.

  • This is achieved by assuming a certain relative position of the test executables and the app executable.

  • Here’s a breakdown of how it’s done:

    1. The length of the 0-th command argument (i.e. the new-test executable) is queried, and a string of correct length is allocated.
        call get_command_argument(0, length=length)
        allocate(character(len=length) :: prog)
    
    1. Now the actual command argument is retrieved, and the directory name part is extracted. This should be something like build/gfortran_xxxxxxxx/test/new-test/
        call get_command_argument(0, prog)
        path = dirname(prog)
    
    1. Assuming Windows for the next step:
          prog = join_path(path, "..", "app", "fpm.exe")
          if (.not.exists(prog)) then
            prog = join_path(path, "..", "..", "app", "fpm.exe")
          end if
    

    we move one level up in the folder directory, assuming we will find a binary named build/gfortran_xxxxxxx/test/../app/fpm.exe. We check if the file exists, if not it’s because our test was nested one level deeper.

Because get_command_path carries a number of implicit assumptions on the relative file position, it’s a kind of hacky way of figuring out the fpm executable path. To be honest, I’m not sure what would be a more robust solution. Perhaps @LKedward could give us a suggestion?

1 Like