External Email - Use Caution        

Thank you so much for these incredibly clear instructions.  I was able to “enable” AVX, disable hypervisor, and import tensorflow.

Since these posts are publicly visible, I'm hoping this thread will be useful for all others who face these issues.


Thanks again

-Randy

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

developer@developer-VirtualBox:/usr/local/freesurfer/7.2.0/subjects$ mri_segment_hypothalamic_subunits --s WBI-FES_S_0862 --write_posteriors
Posteriors will be saved in each subject's directory.
 
using 1 thread
processing 1/1
segmentation saved in: /usr/local/freesurfer/7.2.0/subjects/WBI-FES_S_0862/mri/hypothalamic_subunits_seg.v1.mgz
posteriors saved in:   /usr/local/freesurfer/7.2.0/subjects/WBI-FES_S_0862/mri/hypothalamic_subunits_posteriors.v1.mgz
volumes saved in:      /usr/local/freesurfer/7.2.0/subjects/WBI-FES_S_0862/mri/hypothalamic_subunits_volumes.v1.csv
 
If you use this tool in a publication, please cite:
Automated segmentation of the hypothalamus and associated subunits in brain MRI
B. Billot, M. Bocchetta, E. Todd, A. V. Dalca, J. D. Rohrer, J. E. Iglesias
NeuroImage (in press)
 


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



-----Original Message-----
From: fsbuild <fsbuild@contbay.com>
To: freesurfer@nmr.mgh.harvard.edu
Cc: daedalus39@aol.com
Sent: Sun, Sep 4, 2022 12:35 am
Subject: [Freesurfer] Enabling AVX instructions on Windows 10 (was Re: Illegal Instruction (mri_segment_hypothalamic_subunits) - VM 7.2.0

        External Email - Use Caution        

The lscpu output in the VM not listing AVX and AVX2 does not necessarily mean something is missing from the VM to run AVX instructions.

The Intel processor listed in your output, i7-8700K, does support AVX instructions.  But AVX instructions could be disabled on your host (windows) machine preventing the VM from running them.  Microsoft's own virtualization or “hyper-v” software may also be interfering with Virtualbox.

If you start the VM and open the terminal window you should see the output from the freesurfer startup script list SUBJECTS_DIR, etc.  You can run the included python distribution by typing “fspython” .  At the next prompt, type “import tensorflow”.   I think you will get an illegal instruction error and a core dump when you do that since the VM cannot currently run AVX instructions.

developer#developer-VirtualBox:~$ fspython
Python 3.6.8 (default, Apr 10 2020, 02:08:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import tensorflow
… Illegal instruction … (core dumped) ...

This post describes what I think you are seeing on a Windows machine hosting an Ubuntu VM,
https://stackoverflow.com/questions/65780506/how-to-enable-avx-avx2-in-virtualbox-6-1-16-with-ubuntu-20-04-64bit
… and this lists how to enable/disable AVX instructions …
https://superuser.com/questions/244213/how-can-i-check-whether-intels-avx-is-enabled-on-my-computer

From those and other posts I would try the following on your Windows (host) machine:

1) Open the windows terminal or command line window in administrator mode

2) Enable AVX instructions with the command

   BCDEDIT /set xsavedisable 0

3) Disable launching the Microsoft hypervisor

   BCDEDIT /set hypervisorlaunchtype off

4) Shut down the VM and quit Virtualbox.  You may want to quit all other applications as this next command may ask to reboot your machine (say yes).  If you are not prompted to reboot, then manually reboot the Windows host.

5) Disable Microsoft Hyper-V

   DISM /Online /Disable-Feature:Microsoft-Hyper-V

6) After your machine reboots, login and start the VM

7) In the VM Ubuntu terminal window, run “lscpu | grep avx” again and see if it lists avx, avx2

8) IF IT DOES REPORT AVX NOW, try the lines above again where you typed “fspython” followed by “import tensorflow”.  This time you should not get an illegal instruction error.  You can ignore any error you see about a missing library for libcuda and/or no GPU support.

- R.

On Sep 3, 2022, at 13:46, daedalus39@aol.com wrote:

        External Email - Use Caution        

OK.  It appears this VM (provided by the FreeSurfer developers) does not include "AVX".

That is, "freesurfer_7.2.0_amd64.deb" can't run mri_segment_hypothalamic_subunits without additional setup?  Is it even possible?  If so, can anyone in the FS community provide some simple guidance.  I am not horribly facile with Linux to begin with, but I'd really like to test the hypothal function..

-Randy


developer@developer-VirtualBox:/$ lscpu | grep avx
developer@developer-VirtualBox:/$ lscpu | grep avx2
developer@developer-VirtualBox:/$ lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               158
Model name:          Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
Stepping:            13
CPU MHz:             3599.998
BogoMIPS:            7199.99
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            12288K
NUMA node0 CPU(s):   0-3
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni ssse3 cx16 pcid sse4_1 sse4_2 hypervisor lahf_lm invpcid_single ibrs_enhanced fsgsbase invpcid md_clear flush_l1d arch_capabilities
developer@developer-VirtualBox:/$ 




-----Original Message-----
From: fsbuild <fsbuild@contbay.com>
To: freesurfer@nmr.mgh.harvard.edu
Cc: daedalus39@aol.com
Sent: Fri, Sep 2, 2022 10:12 pm
Subject: Re: [Freesurfer] Illegal Instruction (mri_segment_hypothalamic_subunits) - VM 7.2.0

        External Email - Use Caution        
Hello Randy,
The mri_segment_hypothalamic_subunits command is a python script that uses tensorflow which in turn is coded to use AVX instructions.  If the VM host processor does not support AVX instructions, then you will get an illegal instruction error.
You can check to see if AVX instructions are supported if this commands shows "avx" or "avx2" in the output (see screenshot for where that is the case).
$ lscpu | grep avx
If AVX instructions are supported, then error can also happen if the command is incomplete.
- R.


_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed.  If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://www.massgeneralbrigham.org/complianceline <MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://www.massgeneralbrigham.org/complianceline> .
Please note that this e-mail is not secure (encrypted).  If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately.  Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail. 
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed.  If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://www.massgeneralbrigham.org/complianceline <MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be https://www.massgeneralbrigham.org/complianceline> .
Please note that this e-mail is not secure (encrypted).  If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately.  Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail.