kmaterna / elastic_stresses_py

Simple coseismic stress and displacement calculator (a mini-Coulomb, but in Python)
MIT License
51 stars 15 forks source link

M1 architecture fails in gmt-surface, not on every M1 machine #11

Closed kmaterna closed 1 year ago

kmaterna commented 1 year ago

Some M1 architectures fail to produce displacements at utilities: L 156

call(['gmt', 'surface', xyzfile, '-G' + outfile,
      '-R' + str(region[0]) + '/' + str(region[1]) + '/' + str(region[2]) + '/' + str(region[3]), '-I'+str(inc),
      '-r'], shell=False);
emamarmstrong commented 1 year ago

Python 3.11.4 GMT 6.4.0 M1 Ventura 13.4

Writing synthetic grid into files Outputs/my_experiment/ etc.xy_east.txt ERROR: Caught signal number 11 (Segmentation fault: 11) at 0 libgmt.6.dylib 0x0000000100aeaf64 _quicksort + 1528 Printing vert.grd ERROR: Caught signal number 11 (Segmentation fault: 11) at 0 libgmt.6.dylib 0x00000001049aef64 _quicksort + 1528 Printing east.grd ERROR: Caught signal number 11 (Segmentation fault: 11) at 0 libgmt.6.dylib 0x000000010534af64 _quicksort + 1528 Printing north.grd Mapping vertical deformation in Outputs/my_experiment/vertical_map.png grdimage [ERROR]: Cannot find file Outputs/my_experiment//vert.grd

kmaterna commented 1 year ago

ANSWER: This is a recent issue arising from GMT / M1 interaction.

On some M1 architectures, the required command is "gmt surface -rg". These machines segfault when producing pixel node registered grd files ("-r" or "-rp"). They require "-rg" for gridline node files. No idea why.

Identified on M1, gmt = 6.4.0

emamarmstrong commented 1 year ago

System: 2021 Macbook Pro, OS Ventura 13.4, Apple M1 Pro arch: arm64 GMT: 6.4.0

(geodesy_tut_1) % gmt surface xy_vert.txt -Gvert.grd -R-125.8/-122.6/39.3/41.7 -I0.0064 -rg (geodesy_tut_1) % (geodesy_tut_1) % (geodesy_tut_1) % (geodesy_tut_1) % gmt surface xy_vert.txt -Gvert.grd -R-125.8/-122.6/39.3/41.7 -I0.0064 -rp

ERROR: Caught signal number 11 (Segmentation fault: 11) at 0 libgmt.6.dylib 0x0000000102a12f64 _quicksort + 1528 zsh: trace trap gmt surface xy_vert.txt -Gvert.grd -R-125.8/-122.6/39.3/41.7 -I0.0064 -rp

kmaterna commented 1 year ago

Resolution: I changed the '-rp' flag to '-rg' and the issue resolves, see b9431fa. The underlying bug was reported back to GMT.