SHTns provides a simple way to load/save a configuration from/to a file. It allows:
- to save initialization time if you often use the same transform sizes.
- better reproducibility at bit-level between several runs.
- ensure that all MPI processes use the same config/plan.
All the calling program has to do is add SHT_LOAD_SAVE_CFG to the flags or layout parameter when calling shtns_set_grid / shtns_set_grid_auto (C) or shtns_precompute / shtns_precompute_auto (Fortran). SHTns will first look for the files shtns_cfg
and shtns_cfg_fftw
and use the data stored therein. If no configuration stored in the files correspond to the required one, SHTns will proceed as usual and then store the configuration (unless sht_quick_init mode is used).
Ensuring same config is used across MPI processes:
if (rank > 0) MPI_Barrier();
if (rank == 0) MPI_Barrier();
int shtns_set_grid_auto(shtns_cfg, enum shtns_type flags, double eps, int nl_order, int *nlat, int *nphi)
Precompute everything and choose the optimal nlat and nphi for a given non-linear order.
Definition sht_init.c:1353
#define SHT_LOAD_SAVE_CFG
try to load and save the config. (add to flags in shtns_set_grid)
Definition shtns.h:72