On my PC (Ryzen5700X(8-core, max-freq set to 3.4GHz) + Ubuntu22), the timing with gfortran-12 -O3 -march=native -fopenmp is like this:
1-thread : stdout -> 11.6 sec (time command -> 8.50user 4.55system)
2-thread : stdout -> 6.8 sec (time command -> 8.57user 4.58system)
4-thread : stdout -> 4.2 sec (time command -> 8.63user 4.54system)
8-thread : stdout -> 3.0 sec (time command -> 8.72user 4.64system)
If I replace random_number()
with u = 0.5d0
, the result is:
1-thread : stdout -> 6.9 sec (time command -> 3.74user 4.57system)
2-thread : stdout -> 4.4 sec (time command -> 3.83user 4.58system)
4-thread : stdout -> 3.1 sec (time command -> 3.81user 4.64system)
8-thread : stdout -> 2.4 sec (time command -> 3.85user 4.84system)
For serial runs, my PC is ~ 2 times slower than your laptop (= Core i7 12800H, max 4.8 GHz?, the memory (DDR4 vs DDR5?) may also be different):
https://www.cpubenchmark.net/cpu.php?cpu=Intel+Core+i7-12800H&id=4778
But with threading the program becomes faster to some extent, although the scaling is not very good (probably because memory bound? (as mentioned above))
These pages may also be related:
Though this is not about ifort + Windows, similar things might be happening…? (But it also seems (to me) that the speed-down is too large for the above laptop.)