Compiling on new intel AVX512 machines with magic-layout

Issue #35 resolved
C. Maas created an issue

Hi,

when compiling on new intel machines with avx512, gcc, the switch --enable-magic-layout and without --enable-openmp, i get a lot of the following errors in the file shtns_fly.c :

In file included from sht_fly.c:32:0:
SHT/SHst_to_spat_fly.c: In function SHsphtor_to_spat_fly1_l:
SHT/SHst_to_spat_fly.c:157:5: warning: implicit declaration of function S2D_STORE_4MAGIC; did you mean _OLD_STDIO_MAGIC? [-Wimplicit-function-declaration]
     S2D_STORE_4MAGIC(BtF, j+k, te[j], to[j])
     ^~~~~~~~~~~~~~~~
     _OLD_STDIO_MAGIC
SHT/SHst_to_spat_fly.c:158:5: error: expected ; before S2D_STORE_4MAGIC
     S2D_STORE_4MAGIC(BpF, j+k, pe[j], po[j])
     ^~~~~~~~~~~~~~~~
SHT/SHst_to_spat_fly.c:336:5: warning: implicit declaration of function S2D_CSTORE_4MAGIC; did you mean S2D_CSTORE2? [-Wimplicit-function-declaration]
     S2D_CSTORE_4MAGIC(BtF, k+j, ter[j], tor[j], tei[j], toi[j])
     ^~~~~~~~~~~~~~~~~
     S2D_CSTORE2
SHT/SHst_to_spat_fly.c:337:5: error: expected ; before S2D_CSTORE_4MAGIC
     S2D_CSTORE_4MAGIC(BpF, k+j, per[j], por[j], pei[j], poi[j])
     ^~~~~~~~~~~~~~~~~
SHT/SHst_to_spat_fly.c: In function SHsphtor_m_to_spat_fly1_l:
SHT/SHst_to_spat_fly.c:497:5: warning: implicit declaration of function S2D_CSTORE2_4MAGIC; did you mean S2D_CSTORE2? [-Wimplicit-function-declaration]
     S2D_CSTORE2_4MAGIC(BtF, k+j, te[j], to[j], vall(0), vall(0))
     ^~~~~~~~~~~~~~~~~~
     S2D_CSTORE2
SHT/SHst_to_spat_fly.c:498:5: error: expected ; before S2D_CSTORE2_4MAGIC
     S2D_CSTORE2_4MAGIC(BpF, k+j, pe[j], po[j], vall(0), vall(0))
     ^~~~~~~~~~~~~~~~~~
SHT/SHst_to_spat_fly.c:650:5: error: expected ; before S2D_CSTORE2_4MAGIC
     S2D_CSTORE2_4MAGIC(BpF, k+j, per[j], por[j], pei[j], poi[j])
     ^~~~~~~~~~~~~~~~~~

If I replace "-march=skylake-avx512" with "-march=skylake" compilation finishes successfully. Tested with GCC versions 6.4.0, 7.3.0 und 8.1.1 and shtns 3.1 and 3.01

Could you please look into this issue.

Thank you very much for your help.

Comments (4)

  1. Nathanaël Schaeffer repo owner

    Indeed, there is some missing explicit AVX512 vectorization in the non-openmp code path for magic layout. Writing those explicit vectorization requires a bit of work. I have plans to merge all code paths to avoid these issues in the future, but this requires some substantial work too.

    As an immediate workaround, I suggest the following: 1) configure with openmp enabled:

    ./configure  --enable-magic --enable-openmp
    

    2) remove the -fopenmp switch from the Makefile

    3) compile to get a non-openmp library that uses avx512 together with the magic-layout.

  2. Log in to comment