Giter VIP home page Giter VIP logo

2021_fortrancon's Introduction

Particle simulations with Julia

Leandro Martínez
Institute of Chemistry and Center for Computing in Engineering and Sciences
University of Campinas

This repository contains the codes and documents associated with the talk "Particle simulations with Julia", presented at the Fortran 2021.

The main document here is the Pluto notebook file particle_simulation.jl, which can be viewed directly (non-interactively) at:

Note: the page is about 30Mb-large and may take some time to completely load. Be patient.

Versão em português do notebook aqui, e uma apresentação do trabalho pode ser vista neste video.

                 

2021_fortrancon's People

Contributors

lmiq avatar mforets avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mforets lmiq

2021_fortrancon's Issues

Benchmark can be misleading

I was surprised with the results in the benchmark of Fortran vs Julia (I was expecting similar performance but with a little advantage of Fortran over Julia), so I've decided to rerun the benchmarks with different optimization levels:

gfortran -O0 -march=native particle_simulation.f90 -o particle_simulation
echo "Fortran -O0:"
time ./particle_simulation

gfortran -O1 -march=native particle_simulation.f90 -o particle_simulation
echo "Fortran -O1:"
time ./particle_simulation

gfortran -O2 -march=native particle_simulation.f90 -o particle_simulation
echo "Fortran -O2:"
time ./particle_simulation

gfortran -O3 -march=native particle_simulation.f90 -o particle_simulation
echo "Fortran -O3:"
time ./particle_simulation

gfortran -Ofast -march=native particle_simulation.f90 -o particle_simulation
echo "Fortran -Ofast:"
time ./particle_simulation

echo "Julia:"
time julia particle_simulation.jl

With the results:

Fortran -O0:
real	1m10,165s
user	1m10,128s
sys	0m0,003s

Fortran -O1:
real	0m40,524s
user	0m40,497s
sys	0m0,000s

Fortran -O2:
real	0m36,427s
user	0m36,383s
sys	0m0,017s

Fortran -O3:
real	0m39,488s
user	0m39,443s
sys	0m0,007s

Fortran -Ofast:
real	0m36,217s
user	0m36,184s
sys	0m0,007s

Julia:
real	0m38,021s
user	0m37,924s
sys	0m0,073s

While I know that the intent of this simple benchmark is more something in the order of "Julia speed is comparable to Fortran", I think that the results can mislead the reader into thinking that Julia is faster than Fortran. (The difference is marginal anyways, so if the user is more productive with Julia I wouldn't say that a switch is necessary just based on speed)

Honestly I don't know exactly why, but the "best" optimization algorithm (-O3) ain't necessarily the best, as it can be shown with this implementation. This also shows that there is an extra step to take into account with compiled languages, and that's that compiling flags can make a huge impact in the result, giving another layer of complexity of Fortran over Julia.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.