Initialization fails all the time

Issue #25 resolved
Former user created an issue

Hello, Nathanael,

I have sucessfully compiled the fortran example code "SHT_example.f", but when I run it, I always get the following output. It seems the initialization fails due to bad SHT accuracy. I compiled the example code using Intel fortran compiler 15 with options: -lshtns_omp -lfftw3_omp -lm -lrt. My system is Linux 64 bit. Please help me identify the problem. Thank you for providing such a great library!

 NLM=          12
[SHTns 2.6.5] built Jun 28 2016, 15:50:25, id: avx
        Lmax=5, Mmax*Mres=4, Mres=2, Nlm=12  [3 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 = 0.214
Lmax=5, Mmax*Mres=4, Mres=2, Nlm=12  [3 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 
*** [SHTns] Run-time error : bad SHT accuracy

Comments (7)

  1. Nathanaël Schaeffer repo owner

    Hello,

    I have been able to reproduce the bug. It happens only when the intel compilers are used together with OpenMP. If you use gcc / gfortran, or if you disable openmp, it works well.

    I will need to investigate this issue further

  2. Nathanaël Schaeffer repo owner

    After more investigation, it appears to me as a compiler bug:

    • It does not happen with gcc/gfortran
    • It does not happen with icc/ifort 14
    • It does not happen without -fopenmp
    • It does not happen without optimizations ( -O0 )

    Suggested workaround : in the Makefile, replace the line

    cc = $(CC) $(go) -O2
    

    with

     cc = $(CC) $(go) -O0
    

    It will slow down the initialization process a bit, but not the actual transforms. Please confirm that this fixes the problem for you too.

  3. plw0315

    Hello,

    Thanks for your quick reply and through investigation! Since I use your library on a computer cluster managed by my university, I am not able to reinstall your library with a different compiler. Today is a holiday (US independent day) here, I have to wait tomorrow and ask the cluster technician to reinstall it. For your suggestions about openmp and optimizations, I did the following tests:

    For system Linux 64 bit and compiler ifort 15 with options: -lfftw3_omp -lshtns_omp -lm –lrt:

    1) The problem remains with or without option -openmp.

    2) The problem remains with any optimization from -o0 to -o3.

    I will update again when I have a change to test the example code with a different compiler. Thanks again.

  4. plw0315

    Hello,

    The fortran example code "SHT_example.f" works properly when compiled with ifort 13, but not with ifort 15 or 16. The fortran compiler ifort 14 and gfortran has not been tested. Thanks for your help!

  5. plw0315

    Hello again,

    You are right about Intel compiler 15, if I one followed the workaround as you suggested and change the line in the makefile:

    cc = $(CC) $(go) -O2
    

    to

    cc = $(CC) $(go) -O0
    

    The example fortran code will work properly. I think this issue has been solved. Thank you very much!

  6. Log in to comment