princemahajan / FLINT

Fortran Library for numerical INTegration of differential equations
https://princemahajan.github.io/FLINT/
Apache License 2.0
43 stars 9 forks source link

test code seems much slower on with heap arrays #7

Open CRquantum opened 3 years ago

CRquantum commented 3 years ago

Hi @princemahajan !

I have written a Makefile for flint in windows using ifort, and gfortran in linux. All the f90 files and Makefile is here, https://gitlab.com/CRquantum/flint_test/-/tree/main/flint_OneAPI The flint's f90 files is from your src folder, the test file is your test_CR3BP.f90. Makefile is for gfortran in linux. Makefile.win is for ifort in windows. Actually you could just add all the f90 files into visual studio with intel OneAPI, it will compile and run.

However, I found a problem, it seems the same code, in linux with gfortran (no heap array) it only took 10 seconds. But in windows compiled in visual studio and run (with heap arrays set to 0 so always heap arrays), it took me like at least 5 + minutes. I am a little confused.

If I do not heap arrays, so leave it blank as below

image

then the speed is about the same on windows with ifort and on Linux with gfortran, 10 seconds or so.

@princemahajan Do you know why heap arrays will cause a huge speed difference?

I also post at Fortran forum, https://fortran-lang.discourse.group/t/does-heap-arrays-slow-down-the-code-a-lot/2123

From VTune's results, perhaps looks like some allocate and deallocate arrays caused the heap arrays slow down.

Thank you very much indeed!

Best regards, Rong

princemahajan commented 10 months ago

ok, this is the next thing to investigate on my todo list