`openmc.deplete` incompatible with Apple M1
When trying to import openmc.deplete on a Mac computer with the Apple M1 chip, the following error occurs:
Traceback (most recent call last):
File "/Users/kkiesling/software/opt/depletion-comparison/pwr/openmc/run_depletion.py", line 5, in <module>
import openmc.deplete
File "/Users/kkiesling/software/opt/openmc/openmc/deplete/__init__.py", line 11, in <module>
from .coupled_operator import *
File "/Users/kkiesling/software/opt/openmc/openmc/deplete/coupled_operator.py", line 21, in <module>
import openmc.lib
File "/Users/kkiesling/software/opt/openmc/openmc/lib/__init__.py", line 32, in <module>
_dll = CDLL(_filename)
File "/Users/kkiesling/opt/anaconda3/envs/openmc-dev/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/kkiesling/software/opt/openmc/openmc/lib/libopenmc.dylib, 0x0006): tried: '/Users/kkiesling/software/opt/openmc/openmc/lib/libopenmc.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))
I have no issue importing other standard openmc modules to build a model and run an eigenvalue problem. It is just this one module (could be others but I haven't encountered the error elsewhere). OpenMC compiles fine, this error occurs at runtime.
Other info/things I have tried:
- I am compiling from source with the latest develop branch.
- I have played around with explicitly setting different compilers (tried gcc/g++ and clang/clang++, both from various locations on my computer).
- I have tried explicitly setting the
CMAKE_OSX_ARCHITECTURESto "arm64" (what it is using) and "x86_64" per some google solutions but trying to set the architecture to the latter causes other errors and fails during build.
I am out of ideas for how to fix this on my end and I am not even sure if this is something that can be addressed by OpenMC (maybe there is something to set in CMake but my searching has led to no solutions on this front).
Has anyone else experienced this error with M1 and know how to get around it?
Other info: the conda install (conda install openmc=0.13.2=*mpich*) seems to be fine
I have gotten openmc.deplete to work on my M1 MBP for OpenMC version 0.14.0, with
CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++ LDFLAGS=-L/usr/local/lib cmake -DCMAKE_INSTALL_PREFIX=$HOME/openmc ..
for OpenMP, and
HDF5_ROOT=/opt/homebrew CXX=/opt/homebrew CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++ LDFLAGS=-L/usr/local/lib cmake -DCMAKE_INSTALL_PREFIX=$HOME/openmc-mpi -DOPENMC_USE_MPI=ON -DOPENMC_USE_OPENMP=OFF ..
for MPI.
I am, however having other difficulties with openmc.deplete, namely that it doesn't seem to be depleting anything, see Depletion calculations do not deplete