easybuilders / easybuild-easyconfigs

A collection of easyconfig files that describe which software to build using which build options with EasyBuild.
https://easybuild.io
GNU General Public License v2.0
378 stars 701 forks source link

dbarts extension added to R-4.0.0-foss2020a breaks on Arm64 #11449

Closed terjekv closed 4 years ago

terjekv commented 4 years ago

https://github.com/easybuilders/easybuild-easyconfigs/commit/858f50f14f5eb7d7719b03594241955be2b5d7d2#diff-f2a7ccd2712a57d5dff6f0bd478d7d18 (via ##11430)) breaks on arm: https://gist.github.com/terjekv/1c98b51b2f5b3b85ef33e3be08c7f3f5

simd.c:36:33: error: static declaration of misc_simd_getMaxSIMDInstructionSet follows non-static declaration
   36 | static misc_simd_instructionSet misc_simd_getMaxSIMDInstructionSet(void)
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from simd.c:9:
../include/misc/simd.h:30:26: note: previous declaration of misc_simd_getMaxSIMDInstructionSet was here
   30 | misc_simd_instructionSet misc_simd_getMaxSIMDInstructionSet(void);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
simd.c: In function misc_simd_getMaxSIMDInstructionSet:
simd.c:37:3: error: expected declaration specifiers before return
   37 |   return MISC_INST_C;
      |   ^~~~~~
simd.c:38:1: error: expected declaration specifiers before } token
   38 | }
      | ^
simd.c:194:17: error: storage class specified for parameter misc_partitionRange
  194 | extern size_t (*misc_partitionRange)(const misc_xint_t* restrict x, misc_xint_t cut, misc_size_t* restrict indices, misc_size_t length);
      |                 ^~~~~~~~~~~~~~~~~~~
simd.c:195:17: error: storage class specified for parameter misc_partitionIndices
  195 | extern size_t (*misc_partitionIndices)(const misc_xint_t* restrict x, misc_xint_t cut, misc_size_t* restrict indices, misc_size_t length);
      |                 ^~~~~~~~~~~~~~~~~~~~~
simd.c:197:15: error: storage class specified for parameter misc_addVectors
  197 | extern void (*misc_addVectors)(const double* restrict x, misc_size_t length, double alpha, const double* restrict y, double* restrict z);
      |               ^~~~~~~~~~~~~~~
simd.c:198:15: error: storage class specified for parameter misc_setVectorToConstant
  198 | extern void (*misc_setVectorToConstant)(double* x, size_t length, double alpha);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~
simd.c:225:15: error: storage class specified for parameter misc_partitionRange_c
  225 | extern size_t misc_partitionRange_c(const misc_xint_t* restrict x, misc_xint_t cut, misc_size_t* restrict indices, misc_size_t length);
      |               ^~~~~~~~~~~~~~~~~~~~~
simd.c:226:15: error: storage class specified for parameter misc_partitionIndices_c
  226 | extern size_t misc_partitionIndices_c(const misc_xint_t* restrict x, misc_xint_t cut, misc_size_t* restrict indices, misc_size_t length);
      |               ^~~~~~~~~~~~~~~~~~~~~~~
simd.c:228:13: error: storage class specified for parameter misc_addVectors_c
  228 | extern void misc_addVectors_c(const double* restrict x, size_t length, double alpha, const double* restrict y, double* restrict z);
      |             ^~~~~~~~~~~~~~~~~
simd.c:229:13: error: storage class specified for parameter misc_setVectorToConstant_c
  229 | extern void misc_setVectorToConstant_c(double* x, size_t length, double alpha);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
simd.c:231:27: error: expected =, ,, ;, asm or __attribute__ before { token
  231 | void misc_simd_init(void) {
      |                           ^
simd.c:237:13: error: storage class specified for parameter misc_stat_setSIMDInstructionSet
  237 | extern void misc_stat_setSIMDInstructionSet(misc_simd_instructionSet i);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
simd.c:240:1: error: expected =, ,, ;, asm or __attribute__ before { token
  240 | {
      | ^
simd.c:36:33: error: old-style parameter declarations in prototyped function definition
   36 | static misc_simd_instructionSet misc_simd_getMaxSIMDInstructionSet(void)
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
simd.c:296: error: expected { at end of input
  296 | 
      | 
zao commented 4 years ago

If the function is supposed to have linkage, the static on line 36 is erroneous and should be removed, matching the definition in the #else branch.

terjekv commented 4 years ago

Well, the blocks around https://github.com/vdorie/dbarts/blob/178427773db82df75787dacbcc609b00f213248f/src/misc/simd.c#L54 may also cause some issues on arm and power? I also spy immintrin.h which does SSE intrinsics, so we're back to https://github.com/DLTcollab/sse2neon/blob/master/sse2neon.h and friends. @boegel, should darts be taken out of R and made into its own Rpackage so we can debug this later[tm]?

zao commented 4 years ago

The preprocessor branch you're talking about there is for x86 and x64 only. It doesn't end until https://github.com/vdorie/dbarts/blob/178427773db82df75787dacbcc609b00f213248f/src/misc/simd.c#L190

zao commented 4 years ago

The fix is trivial: https://gist.github.com/zao/1ecfec2e52a6fe7cb3e17a9ac407c0a1 With this patch it builds with my system R on Ubuntu 20.04. Give it a try.

zao commented 4 years ago

Also filed an issue with upstream: https://github.com/vdorie/dbarts/issues/35

terjekv commented 4 years ago

The preprocessor branch you're talking about there is for x86 and x64 only. It doesn't end until https://github.com/vdorie/dbarts/blob/178427773db82df75787dacbcc609b00f213248f/src/misc/simd.c#L190

Oh whow, I completely misread the scope. That's what I get for not dumping the file into an editor.

The fix is trivial: https://gist.github.com/zao/1ecfec2e52a6fe7cb3e17a9ac407c0a1 With this patch it builds with my system R on Ubuntu 20.04. Give it a try.

I'll give it a whirl! Thanks!

branfosj commented 4 years ago

Thanks. The patch means that dbarts builds fine on POWER.

terjekv commented 4 years ago

Same, works on arm as well. I'll make a PR.