External Email - Use Caution        

 
Please check it works to run the tensorflow package in the included freesurfer python distribution.  The steps to follow below are from using the 8.0.0 beta release installed on an M2 Mac with 32GB RAM running MacOS Sonoma (14.7.2).

… run bash shell and setup the freesurfer environment ...

% bash

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
$ export FREESURFER_HOME=/Applications/freesurfer/8.0.0-beta
$ source $FREESURFER_HOME/SetUpFreeSurfer.sh
-------- freesurfer-macOS-darwin_arm64-8.0.0-beta-20241103-b8aacdc --------
Setting up environment for FreeSurfer/FS-FAST (and FSL)
FREESURFER_HOME   /Applications/freesurfer/8.0.0-beta/
FSFAST_HOME       /Applications/freesurfer/8.0.0-beta//fsfast
FSF_OUTPUT_FORMAT nii.gz
SUBJECTS_DIR      /Applications/freesurfer/8.0.0-beta//subjects
MNI_DIR           /Applications/freesurfer/8.0.0-beta//mni

… unless you installed something extra on the machine, there should only be a python3 installed on the system and it should not have a tensorflow package installed …

$ which python
$ which python2
$ which python3
/usr/bin/python3

… run the default python3 on the system interactively and check there is no tensorflow package there …

$ python3
Python 3.9.6 (default, May  7 2023, 23:32:44) 
[Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>> ^D          <—— type Ctrl D to exit

… check it works to import and run a test with tensorflow in the python provided with the freesurfer distribution - see attached test.py file to run on the command line …

$ which fspython
/Applications/freesurfer/8.0.0-beta//bin/fspython

… run fspython interactively and check tensorflow is version 2.13.0 ...

$ fspython
Python 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:05:16) 
[Clang 12.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, os
>>> import tensorflow as tf
>>> tf.__version__
'2..13.0'
>>> ^D          <—— type Ctrl D to exit

… run the attached test.py script and check for output similar to what's listed below.  Your output may not be exactly the same but the important thing is for the script to exit with status=0 …

$ fspython  test.py
2025-01-07 21:45:14.349299: I metal_plugin/src/device/metal_device.cc:1154] Metal device set to: Apple M2 Pro
2025-01-07 21:45:14.349321: I metal_plugin/src/device/metal_device.cc:296] systemMemory: 32.00 GB
2025-01-07 21:45:14.349325: I metal_plugin/src/device/metal_device.cc:313] maxCacheSize: 10.67 GB
2025-01-07 21:45:14..349366: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:269] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>)
2025-01-07 21:45:14.383371: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:375] MLIR V1 optimization pass is not enabled
2025-01-07 21:45:14.383950: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
30.0

…. check the returned status=0 …

$ echo $?
0

… If the above succeeded, then tensorflow should run and you should try your recon-all command again. But on MacOS for the 8.0.0 beta, you need to set the environment variable FS_ALLOW_DEEP in order for recon-all to work,

$ export FS_ALLOW_DEEP=1
… run your recon-all command again …

- R.


On Jan 7, 2025, at 18:29, Kayla Bohlke <Kayla.Bohlke@barrowneuro.org> wrote:

        External Email - Use Caution        


Yes, that is the version I used.
 

From: fsbuild <fsbuild@contbay.com>
Date: Tuesday, January 7, 2025 at 4:20PM
To: freesurfer@nmr.mgh.harvard.edu <freesurfer@nmr.mgh.harvard.edu>
Subject: Re: [Freesurfer] Compatibility with M4 processor?

 
Did you try installing the arm64 package for Macs with M1-M4 processors from this download link ?
https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/8.0.0-beta/freesurfer-macOS-darwin_arm64-8.0.0-beta.pkg
I would first uninstall what is already there with the provided script via the command,
 
$ sudo bash $FREESURFER_HOME/uninstall.sh
 
- R.


On Jan 7, 2025, at 15:41, Kayla Bohlke <Kayla.Bohlke@barrowneuro.org> wrote:
 

        External Email - Use Caution        

 
Hello,
 
I recently have been trying to use the 8.0.0-beta version on my mac which has an M4 processor. I have been trying to run recon-all but after a couple of minutes get the following error during the mri_synthseg function: “The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.”
 
The TensorFlow package downloaded does not seem to be compatible the M4 processor, it seems to be only setup for Intel processors? Has anyone had this issue before and solved it? Would I be better off going back a version to the 7.4.1 release? Is FreeSurfer just not ready for M4?
 
Thanks,
Kayla
 
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer