c-blosc icon indicating copy to clipboard operation
c-blosc copied to clipboard

macOS: Universal2 build fails on SSE2

Open ax3l opened this issue 3 years ago • 4 comments

Hi,

We ship openPMD-api as binary wheels for python users containing c-blosc for postprocessing tasks.

With ARM being strong with the Apple M1 processors, we want to build universal2 wheels that contain both x86_64 and arm64 code. We produce them on macOS 11.0 x86_64 GitHub actions runners.

Multi-arch builds for macOS are very easy with CMake, we just need to set:

export CMAKE_OSX_ARCHITECTURES="arm64;x86_64"

Unfortunately, c-blosc SSE2 breaks the build for SSE2. The only alternative I have is to disable SSE2 acceleration altogether at the moment, which means that x86_64 code in the universal binary will not be accelerated either. Is there maybe a way to make this more flexible? :)

Refs.: https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary

X-ref: https://github.com/openPMD/openPMD-api/pull/1233

ax3l avatar Mar 21 '22 18:03 ax3l

Hi,

There's a similar issue when building hdf5plugin for universal2 Python (see https://github.com/silx-kit/hdf5plugin/issues/186) which include blosc as a HDF5 compression filter.

t20100 avatar Oct 19 '22 13:10 t20100

Your reference says "For a list of compiler macros, see the compiler documentation.". Which compiler are you using?

kalvdans avatar Oct 20 '22 13:10 kalvdans

The latest XCode LLVM that Apple ships aka AppleClang in CMake.

ax3l avatar Oct 20 '22 18:10 ax3l

Thanks, I can't find a list of predefined macros for AppleClang but if you run the compiler like AppleClang --target=... -mcpu=... -E - -dM </dev/null it will output all the pre-defined preprocessor macros (similar works for gcc, too)

Build with make VERBOSE=1 to see the actual compiler binary and correct arch flags it uses.

kalvdans avatar Oct 20 '22 19:10 kalvdans