SHT not working for small Gaussian grids

Issue #36 open
Former user created an issue

In setting up a SHT, I am getting the error when I want a relatively small grid:

*** [SHTns] Run-time error : on-the-fly only available for nlat>=32

even when I am not requesting on-the-fly transforms. The call I am using is:

shtnsc = shtns_create(lmax, mmax, mres, sht_orthonormal | SHT_REAL_NORM); shtns_set_grid(shtnsc, sht_gauss, 0.0, nlat, nphi);

which should use a standard Gaussian grid. The problem seems to arise in sht_init.c

switch (flags) {
    case sht_auto :     flags = sht_gauss;  break;      // only gauss available.
    case sht_reg_fast:  quick_init = 1;
    case sht_reg_dct:   flags = sht_reg_fast; on_the_fly = 1;  break;
    case sht_gauss_fly :  flags = sht_gauss;  on_the_fly = 1;  break;
    case sht_quick_init : flags = sht_gauss;  quick_init = 1;  break;
    case sht_reg_poles : on_the_fly = 1;  quick_init = 1;   break;      // WARNING: quick_init mandatory here, as reg_poles needs NWAY>1 to work (quick_init sets NWAY=2)
    default : break;
}
#ifndef SHTNS_MEM
    on_the_fly = 1;
#endif

where the on-the-fly setting is forced if SHTNS_MEM is not defined (and there is no way in the ./configure to force it to be defined).

Comments (2)

  1. Nathanaël Schaeffer repo owner

    How small do you wish your grid?
    Before I fix the issue, disabling SIMD will allow you to have grids as small as nlat=4.

    You can disable SIMD by configuring with ./configure --disable-simd
    The performance will be strongly affected, but at such small sizes it may not be important.

  2. Log in to comment