This will apply to you if you run PAL_PFHB_fitModel on a MAC with the Silicon chip (MAC OS version ≥ 12 or ≥ Monterey) AND you use a Matlab Release less than R2023b (i.e., one which does not support the Silicon chip natively yet) AND you select Stan as your MCMC sampler.
We are not sure what the situation is with GNU Octave. GNU Octave 8.3.0 appears to run natively on Silicon chip and the workaround is not needed.
If you run Palamedes version 1.11.7 or less, PAL_PFHB_fitModel will crash. Error message will contain a line very similar to:
error: PCH file was compiled for the target 'arm64-apple-macosx13.0.0' but the current translation
unit is being compiled for target 'x86_64-apple-macosx13.0.0'
There are a few solutions:
1. Upgrade Palamedes to version 1.11.10 or higher. It includes a somewhat weird workaround that you will be told about when you run PAL_PFHB_fitModel and you use the Silicon chip/Matlab < R2023b/Stan combination
2. Use GNU Octave (https://octave.org/) instead of Matlab
3. Upgrade to MATLAB R2023b or higher
4. Use JAGS instead of Stan
5. Use Linux or MS Windows instead of MAC
Bit of background: This error ultimately occurs because Matlab (< R2023b) does not run ‘natively’ on the Silicon chip. Instead, it runs in a sort of emulator (called Rosetta). Because of Rosetta, Matlab ‘believes’ it is running on an intel chip type. At some point, the Palamedes routines instruct the MAC OS system to create (‘build’) a Stan executable based on your specified model. However, since Matlab believes it is running on an intel chip, the Stan executable is build to run on an Intel chip also, which will make it crash when it is actually run on the silicon chip. As of Palamedes 1.11.10, PAL_PFHB_fitModel will figure out whether you are using the MAC silicon chip/Matlab < R2023b/Stan combination and, if so, the workaround under solution 1 above will pause PAL_PFHB_fitModel. Then, instead of instructing the MAC OS system to build the Stan executable itself, Palamedes will ask you to instruct the MAC OS to built the Stan executable (by copying and pasting the build instructions into a MAC OS terminal). Once that completes (and you tell PAL_PFHB_fitModel that it did), PAL_PFHB_fitModel goes back to work and does its thing. Yes, weird workaround but it works.
Stan/Matlab/MAC Silicon chip incompatibility issue
- Nick Prins
- Site Admin
- Posts: 28
- Joined: Sun Feb 13, 2022 8:55 pm
Stan/Matlab/MAC Silicon chip incompatibility issue
Nick Prins, Administrator