ANTsX / ITKR

port of ITK to R
6 stars 14 forks source link

ZLIB AVX_512 issue #61

Open muratmaga opened 2 years ago

muratmaga commented 2 years ago

I am trying to build ANTsR in a relatively old hardware that doesn't support AVX_512 (the cpu is xeon v2). During R CMD INSTALL ITKR it is failing at this step:

[ 22%] Building C object Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeFiles/zlib.dir/arch/x86/adler32_avx512_vnni.c.o
/scratch/ccBoMSYP.s: Assembler messages:
/scratch/ccBoMSYP.s:45: Error: no such instruction: `vpdpbusd %zmm10,%zmm4,%zmm3'
/scratch/ccBoMSYP.s:69: Error: no such instruction: `vpdpbusd %zmm8,%zmm4,%zmm1'
/scratch/ccBoMSYP.s:73: Error: no such instruction: `vpdpbusd %zmm8,%zmm5,%zmm3'
make[3]: *** [Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeFiles/zlib.dir/arch/x86/adler32_avx512_vnni.c.o] Error 1
make[3]: Leaving directory `/data/home/maga/antsr-install/ITKR/src/itkb'
make[2]: *** [Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeFiles/zlib.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....

How can I pass an argument to ZLIB not to use AVX2 or AVX512 during ITKR superbuild?

muratmaga commented 10 months ago

@stnava this is still continuing to be an issue for our older machines. I think it is a cmake problem specific to the ZLIB. I found this thread, and it appears there is a solution by setting a specific flag. But I am not familiar with cmake system enough to understand where to specify this. ANy input would be much appreciated: https://github.com/zlib-ng/zlib-ng/issues/553

cookpa commented 2 days ago

Late to this but FWIW, I had a look at the flags in ITKR and I don't see anything that specifically turns on AVX512. It should build with -march native. However, zlib is a third party module which has its own setting

https://github.com/InsightSoftwareConsortium/ITK/blob/1fc47c7bec4ee133318c1892b7b745763a17d411/Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeLists.txt#L116

Maybe ITK_USE_SYSTEM_ZLIB in the ITK config could help, assuming that's available.