Originally, GraSphInv was tested with compilers g++ 9.3 and Intel oneAPI 2021/2022 on Ubuntu 20.04. However, the program compiled by a newer version of g++ (11.3.0) on Ubuntu 22.04 is found to produce sporadic large errors. Thanks to Keying Zhu for pointing out this.
For example, in Examples/Tibet50kmH_0_25x0_25/data/Crust_Correction/crystalline_crust_g_r
calculated by the program compiled by g++ 11.3 on ubuntu 22.04, there are 5082 extremely large values which are inconsistent with the original file. It looks like
![image](https://private-user-images.githubusercontent.com/38816011/261310120-30fba09e-98a8-43cd-be08-cc4ee4da1226.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTc3MjcyMTMsIm5iZiI6MTcxNzcyNjkxMywicGF0aCI6Ii8zODgxNjAxMS8yNjEzMTAxMjAtMzBmYmEwOWUtOThhOC00M2NkLWJlMDgtY2M0ZWU0ZGExMjI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjA3VDAyMjE1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTliMWM1OTc4ODMxYWI1MmM0YWY2MWYzNDVmMTIyMGYzY2I3NGUyNzhmMTYzZGJhZmNmNDMwMmE3OTVmYjAzZGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ZZ3-tk1Tww0T7Kuj3e88cuM_GOPXoFax_iho62KMpVg)
Then I tested Intel oneAPI 2023 compiler on Ubuntu 22.04 to see if this problem is specific to g++ compilers. In the Crust_Correction
example, 1077 out of 20905 data points in file moho_g_r
are different from the original file with a maximum absolute difference of 1.76 mGal and the rest of the data points are the same as the original files. I think this difference is still within an acceptable range in view of different implementation of C++ compilers and the inherent numerical inaccuracy of Gaussian Legendre quadrature. For the rest of files, e.g crystalline_crust_g_r
, sediments_g_r
, rm_sedim_cryst_g_r
, rm_sedim_g_r
, mantle_g_r
are exactly the same as the original file (with maximum difference less than 1e-12).
I suspect that the large error caused by g++ 11.3.0 is due to compiler optimization. I will get around to test a lower level of compiler optimization by adding a statement set(CMAKE_BUILD_TYPE Debug)
to file cmake.config
.