f77 legendre transform error
Hi,
Thanks for adding the legendre transform to the f77 API.
I'm having trouble getting it to work in your fortran example however. Compiling and running the code gives a segmentation fualt and core dump whenever the new shtns_sh_to_spat_ml routine is called. Any suggestions?
Comments (8)
-
repo owner -
Account Deleted I've run the program in the debugger and get the following message
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) backtrace
#0 0x0000000000000000 in ?? ()
#1 0x00000000004022a8 in sht_example () at SHT_example.f:105
#2 0x000000000048ee2a in main ()
#3 0x0000003ebe01ed5d in __libc_start_main (main=0x48ee00 <main>, argc=1, ubp_av=0x7fffffffe368, init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7fffffffe358) at libc-start.c:226
#4 0x0000000000401619 in _start ()
Hope this helps
-
repo owner Mmm, unfortunately this does not help. Can you also post the output of the program, before the arrays of numbers ?
Also you could try reconfiguring with the --disable-simd option and see if the problem is still there.
-
Account Deleted The output of the program is as follows:
NLM= 6 [SHTns 2.6.3] built May 29 2015, 11:38:27, id: avx Lmax=5, Mmax*Mres=4, Mres=2, Nlm=12 [1 threads, orthonormalized] => using FFTW : Mmax=2, Nphi=6, Nlat=8 (data layout : phi_inc=1, theta_inc=6, phi_embed=6) => using Gauss nodes + polar optimization threshold = 1.0e-10 + SHT accuracy = 1.44e-15 => SHTns is ready. [SHTns 2.6.3] built May 29 2015, 11:38:27, id: avx Lmax=5, Mmax*Mres=4, Mres=2, Nlm=12 [1 threads, orthonormalized] Gauss grid : Nlat=8, Nphi=6 syn ana vsy van gsp gto v3s v3a std: mem mem mem mem mem mem mem mem ltr: mem mem mem mem mem mem mem mem m: none none none none none none none none
The -disable-simd option makes no difference.
-
repo owner - changed status to open
-
repo owner In the file SHT_example.f, could you please put nlat = 32 in line 41 ? I think it should work then... Sorry, too small grids seem to be problematic right now. I will try to fix this soon, but for now, please don't use too small grids. Maybe nlat = 16 is enough.
-
repo owner - marked as critical
This bug affects all Legendre transforms on small grids (Nlat < 8, 16 or 32 depending on the system), whether called from Fortran or from C.
Workaround: use large enough grids if you need a pure Legendre transform.
-
Account Deleted Thanks for your quick reply and workaround.
There seems to be a similar bug concerning nphi, for which the routine doesn't work on my machine when nphi<4.
The shtns_spat_to_sh_ml routine also gives a segmentation fault when using regular grids and DCT acceleration.
Debugging in gdb gives the output
[SHTns 2.6.3] built May 29 2015, 11:38:27, id: avx
Lmax=100, Mmax*Mres=1, Mres=1, Nlm=201 [1 threads, orthonormalized] Regular grid (mtr_dct=1) : Nlat=256, Nphi=4
syn ana vsy van gsp gto v3s v3a
std: dct dct dct dct dct dct s+v dct
ltr: dct dct dct dct dct dct s+v dct
m: fly4 fly2 fly2 fly2 fly2 fly2 s+v fly2
Program received signal SIGSEGV, Segmentation fault.
spat_to_SH_m_fly2_l (shtns=<value optimized out>, im=2117866500, Vr=0x697650, Qlm=0x6fe010, llim=100) at SHT/spat_to_SH_fly.c:467
467 y0[j] *= vread(wg, k+j); y1[j] *= vread(wg, k+j); // weight appears here (must be after the previous accuracy loop).
(gdb) backtrace
#0 spat_to_SH_m_fly2_l (shtns=<value optimized out>, im=2117866500, Vr=0x697650, Qlm=0x6fe010, llim=100) at SHT/spat_to_SH_fly.c:467
#1 0x0000000000401ef3 in sht_example () at SHT_example.f:116
#2 0x000000000048e92a in main ()
#3 0x0000003ebe01ed5d in __libc_start_main (main=0x48e900 <main>, argc=1, ubp_av=0x7fffffffe368, init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7fffffffe358) at libc-start.c:226
#4 0x0000000000401559 in _start ()
- Log in to comment
I'm sorry, but it works here. Could you please edit the Makefile and add -g after -O2 on the CFLAGS= line ? (should be line 5) Also add -g on line 91 after gfortran.
Then recompile the fortran example "make SHT_fort_ex" and run it in the debugger
and then type "run". When it crashes, type
and send me the output.
Thank you.