Improvements to Fortran solution #726
Replies: 3 comments 4 replies
-
I have reviewed the Fortran Solution 1 submitted by @johandweber and would like to suggest some improvements which improve performance on my computers ( i5-2300 and Ryzen 5900X). The changes I am suggesting are:
The search loop becomes:
end subroutine allocate_odd_list subroutine run_sieve
! find next prime ! map out all multiples of prime
end subroutine run_sieve my gfortran compile options are : johandweber_fortran;3801;5.001;1;algorithm=base,faithful=no,bits=1 i5-2300 single thread ryzen 5900X single thread |
Beta Was this translation helpful? Give feedback.
-
I just wanted to confirm that my implementation (solution_1) is not object-oriented and is thereefore 'unfaithful'. |
Beta Was this translation helpful? Give feedback.
-
I have started an OpenMP solution of the simpler kind, calling run_sieve ( sieve_size, num_odds, list_odds ) in a parallel loop and counting the number of passes. For the Ryzen 5900X I am getting : For the i5-2300, I am getting: This comparison is interesting, as it shows my approach to OpenMP stalls with hyper-threading, but the achieved rate of 185,692 sieves with 12 threads on Ryzen 5900X is significantly faster that non-threaded code. To implement the OpenMP solution, run_sieve can not be CONTAINed, to allow multiple PRIVATE list_odds(:). I am not familiar with GitHub and as the OpenMP code needs further refining, I would be interested in feedback. Is there a process for a Fortran Multi-thread solution to first be reviewed and possibly accepted ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a placeholder/hook post, to facilitate @JohnCampbe11 suggesting improvements to the Fortran solutions submitted by @johandweber and @tjol.
Beta Was this translation helpful? Give feedback.
All reactions