abiosoft / colima

Container runtimes on macOS (and Linux) with minimal setup
MIT License
17.73k stars 364 forks source link

Show correct CPU architecture and model in the colima VM so that matlab can determine right BLAS and LAPACK versions to use #1046

Open alherm7 opened 1 week ago

alherm7 commented 1 week ago

Description

When I run a container with the matlab runtime and a compiled matlab binary, the program fails because it cannot determine the correct CPU model and architecture on colima.

Here are the log output from my matlab binary when I run the docker container in colima:

 *  Executing task: docker logs --tail 1000 -f 0c732330d4ce25a8c6dd7ea2f9028b5559588621058ace23ced6d3acfa77bf1d 

Detected host compuer: 
GLNXA64
Detected CPU model: 
Detected number of cores: 
     2
BLAS: Unable to determine CPU type
Error using *
BLAS loading error:
No valid linear algebra library found for this architecture. blas.spec is defective or the used architecture is not supported by MATLAB on this machine.

The container the exits with an error.

If i ssh into the colima VM, I can also see that the command 'lscpu' does not print the right CPU model:

ahb@colima:/Users/ahb/Documents/GitHub/wt-devops-htcondor-services$ lscpu
Architecture:           x86_64
  CPU op-mode(s):       32-bit, 64-bit
  Address sizes:        36 bits physical, 48 bits virtual
  Byte Order:           Little Endian
CPU(s):                 2
  On-line CPU(s) list:  0,1
Vendor ID:              GenuineIntel
  Model name:           06/9e
    CPU family:         6
    Model:              158
    Thread(s) per core: 1
    Core(s) per socket: 2
    Socket(s):          1
    Stepping:           13
    BogoMIPS:           4607.94
    Flags:              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt a
                        es xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch pti fsgsbase bmi1 avx2 smep bmi2 erms rdseed adx smap clflushopt xsaveopt xgetbv1 arat
Caches (sum of all):    
  L1d:                  64 KiB (2 instances)
  L1i:                  64 KiB (2 instances)
  L2:                   8 MiB (2 instances)
  L3:                   16 MiB (1 instance)
NUMA:                   
  NUMA node(s):         1
  NUMA node0 CPU(s):    0,1
Vulnerabilities:        
  Gather data sampling: Unknown: Dependent on hypervisor status
  Itlb multihit:        KVM: Mitigation: VMX unsupported
  L1tf:                 Mitigation; PTE Inversion
  Mds:                  Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
  Meltdown:             Mitigation; PTI
  Mmio stale data:      Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
  Retbleed:             Vulnerable
  Spec rstack overflow: Not affected
  Spec store bypass:    Vulnerable
  Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:           Mitigation; Retpolines, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
  Srbds:                Unknown: Dependent on hypervisor status
  Tsx async abort:      Not affected

I am running this on a 2019 Intel MacBook pro. If I run 'sysctl -n machdep.cpu.brand_string' in my terminal i get the CPU model as "Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz".

Is it possible for the colima VM to correctly show the CPU model, so that matlab can determine which BLAS and LAPACK packages to use?