gfortran-for-macOS icon indicating copy to clipboard operation
gfortran-for-macOS copied to clipboard

gfortran 12.2 Ventura has a problem with -O2 and -O3 and lapack library

Open telicha opened this issue 2 years ago • 0 comments

Not sure if this is the right forum for bringing up this discussion. As you know, lapack library 3.11 https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.11.0.tar.gz have extensive testing capabilities, with thousands of tests. Using -O1 compiler flags for gfortran 12.2 on macOS Ventura 13.1 (on a Macbook Pro 14" with M1 Pro 10CPU chip) all tests are clean: ` --> LAPACK TESTING SUMMARY <-- Processing LAPACK Testing output found in the TESTING directory SUMMARY nb test run numerical error other error ================ =========== ================= ================ REAL 1327023 0 (0.000%) 0 (0.000%) DOUBLE PRECISION 1327845 0 (0.000%) 0 (0.000%) COMPLEX 786775 0 (0.000%) 0 (0.000%) COMPLEX16 787842 0 (0.000%) 0 (0.000%)

--> ALL PRECISIONS 4229485 0 (0.000%) 0 (0.000%) `

However, if I use -O2 compiler flags some of the tests fail:

                    -->   LAPACK TESTING SUMMARY  <--
            Processing LAPACK Testing output found in the TESTING directory

SUMMARY nb test run numerical error other error ================ =========== ================= ================ REAL 1327023 0 (0.000%) 0 (0.000%) DOUBLE PRECISION 1318955 5 (0.000%) 5 (0.000%) COMPLEX 778999 1 (0.000%) 0 (0.000%) COMPLEX16 787842 0 (0.000%) 0 (0.000%)

--> ALL PRECISIONS 4212819 6 (0.000%) 5 (0.000%)

and if I use the more aggressive -O3 compiler flags many more tests fail, indicating clearly that some of the optimizations are not appropriate

                  -->   LAPACK TESTING SUMMARY  <--
    Processing LAPACK Testing output found in the TESTING directory

SUMMARY nb test run numerical error other error ================ =========== ================= ================ REAL 1317063 40 (0.003%) 0 (0.000%) DOUBLE PRECISION 1316771 54 (0.004%) 5 (0.000%) COMPLEX 767023 301 (0.039%) 0 (0.000%) COMPLEX16 779394 116 (0.015%) 0 (0.000%)

--> ALL PRECISIONS 4180251 511 (0.012%) 5 (0.000%)

This was actually the first time I had done these tests on the M1 chip and the gfortran compiler. I've doing these tests with the gfortran compiler for many years always on the Intel x86_64 platform, and the tests always have been perfectly clean - 0 errors.

Thanks for your help - sorry about the formatting I tried my best to keep it aligned but the preview come out bad.

telicha avatar Jan 17 '23 01:01 telicha