Week9 - Building SciPy & ImpliedDoLoops

Building SciPy & ImpliedDoLoops

Date: July 16, 2023.

Hello! Welcome to the blog of week 9. This week I worked on building SciPy with LFortran and implementation of ImpliedDoLoops.

So, after successfully compiling all files to ASR, I and Ondřej Čertík discussed about best way to proceed further. We decided to pick a package that compiles to LLVM and start working on it for aligning output with gfortran. We picked specfun as it compiles to LLVM and then tried to somehow tweak build system of SciPy to build specfun with LFortran. We made progress over it, a few tests run and pass but it still segfaults after few tests. We are still working on it and will get it to work soon. More details about it can be found at Issue: 1979

Later, I picked up an issue which is most frequent issue in SciPy codebase, ImpliedDoLoops. ImpliedDoLoops are a bit tricky to implement, I had tried it previously but failed, so this time I decided to take a different approach and looks like I am making a steady progress over it. Let us use a simple example to understand ImpliedDoLoops. In the above example you can see that assignment to x is done using a particular syntax, which is called ImpliedDoLoops.

On discussion at Issue: 981, we decided to create an ASR pass which will convert the above given example to: This will make it easier to implement ImpliedDoLoops. I have initial implementation of this ready, you can have a look at it PR: 1993.

All in all with 22.5 hours of work, I was able to make progress over building SciPy and ImpliedDoLoops. For next week I will push to somehow get all tests running with lfortran and simultaneously work on ImpliedDoLoops.

I would like to thank Ondřej Čertík for taking out time and helping me when I was stuck. Looking forward to many more commits.