I just decided to migrate from Python+Fortran to Julia as Julia was faster in my test

Hello again! Thank you guys for your kind responses.

I’ve fixed my link, I was meaning to point here:

Oops, I’ve forgotten about the loop index order (too much mixed-language programming lately I suppose). I do get a 10% improvement in both languages if I do that correctly. I didn’t know Julia was also following column-major ordering :slight_smile:

I’ll definitively check out Tullio.jl.

My test example was actually too simple, I usually require complex exponentials, not purely imaginary arguments. So I’ll check out if the comparison still holds in the general case (maybe Julia is figuring that out while gfortran is not? Both languages know that “a” and “k” are real…).

As for other performance libraries, I was just wondering about linking to MKL. I had done it in gfortran in the past, but I need to find again how I did it (documenting these things would really help).

In Julia, I see this package:

but they only mention Linear Algebra functions. There is also stuff like complex exponentials or square roots in MKL.

Anyway, I was also even willing to sacrifice some performance (no more than 10-20% actually) if the resulting code was, to begin with, written in a single language. I am delighted that I seem to be geting a performance gain on top of the code simplicity (and overall, better code in many ways than mixed python+fortran).

I have many more things to try, like Tullio.jl, MKL, and distributed memory.

And by the way, this was all about computational electromagnetics. Those complex exponentials are the expensive part of a Green function, my vector a is actually sampled from a geometry, and “k” could be a complex number.

As for the Geospatial things I do, I’m just using Geopandas which has a ton of wrappers, mainly to the GEOS library, but also I/O in every file format I need, thanks to fiona which is itself a wrapper to GDAL. If Julia has good wrapping capabilities, it could be done too I guess.

4 Likes