Fortran-Julia syntax comparison and Maxwell Solver in 2D using Yee numerical scheme and MPI topology
GPL-3.0 License
This is a simple cheatsheet and some performance comparison for scientific programmers who are interested in discover Julia. It is not an exhaustive list. This page is inspired from A Cheatsheet for Fortran 2008 Syntax: Comparison with Python 3.
Here an example of a Fortran to Julia translation. We use the Yee numerical scheme FDTD: Finite-Difference Time-Domain method and MPI topology. You can find a serial version and a parallel version using MPI library.
Test your MPI.jl installation with
$ mpirun -np 4 julia --project hello_mpi.jl
Hello world, I am 0 of 4
Hello world, I am 3 of 4
Hello world, I am 1 of 4
Hello world, I am 2 of 4
On small program like this in Julia is really fast.
julia -O3 --check-bounds=no maxwell_serial.jl
: 14 secondsmake && time ./maxwell_serial_fortran
: 31 secondsmake && time mpirun -np 9 ./maxwell_mpi_fortran
: 7 secondsmpirun -np 9 julia --project -O3 --check-bounds=no
: 5 secondsUncomment the plot_fields call in Julia programs or change idiag value in input_data for fortran.
gnuplot bz.gnu