mne-python
mne-python copied to clipboard
Determine total memory without psutil
Fixes #12785. We've always computed gibibytes (GiB), so I've also fixed the unit (was previously GB).
- [x] Linux
- [x] macOS
- [x] Windows
One option to check win/macOS/Linux would be to add to the test something like assert re.match("[0-9]+ GiB", out) is not None in some sys_info test. It would ensure that on all CIs we get some estimate of the memory rather than ? GiB
This is ready for review.
While I'm at it, I don't get any CPU name on my Mac, and at least for macOS I have an easy fix. Do you want me to include it in this PR or a new one?
Sure, feel free to push here
This gives
Apple M2 Pro (12 cores)
instead of
arm (12 cores)
I can try to get this to work on Linux and Windows tomorrow.
OK, this is now ready again. I've tested on all three platforms and got nice CPU strings as well as the correct memory size, but if you have hardware such as Intel-based Macs (I only tested on ARM-based Macs), please feel free to check the output of mne.sys_info()!
I'm using wmic on Windows, but I just found out that Microsoft is deprecating this tool. I'll see if I can replace it with some Powershell commands like they suggest.
Candidate replacements:
subprocess.check_output(["powershell.exe", "(Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum"])subprocess.check_output(["powershell.exe", "(Get-CimInstance Win32_Processor).Name"])
Can we not output GB instead of GiB? no-one except for a few CS and IT / tech-savvy folks will know what GiB is
Can we not output GB instead of GiB? no-one except for a few CS and IT / tech-savvy folks will know what GiB is
Only if we really show GB (base 1000).
yes that's what I meant
OK, but this changes the numbers then. Previously, we computed GiB but erroneously wrote GB.
IMO, GiB is not that esoteric and people can always look it up with their search engine if they're not familiar. For me the first few hits are unrelated but hits 4 and 5 are "what is a GibiByte (GiB)?" and "GB vs GiB what's the difference?"
IMO, GiB is not that esoteric and people can always look it up with their search engine if they're not familiar.
I agree! In principle, I don't care what we use as long as we use the correct unit though.
The tools I checked on Linux use GiB, the activity monitor or macOS says GB. No opinion from me on which to use but agree it would be nice to get the unit right.
Current approach appears to be failing on Windows CIs, though
https://github.com/mne-tools/mne-python/actions/runs/10386163230/job/28756877686?pr=12787#step:17:4174
https://dev.azure.com/mne-tools/mne-python/_build/results?buildId=30965&view=logs&jobId=2bd7b19d-6351-5e7f-8417-63f327ab45bc&j=2bd7b19d-6351-5e7f-8417-63f327ab45bc&t=43b4c425-59e5-5cb3-0374-1f08e81b4191
I suggest we get this in early for 1.9 rather than just before 1.8. Might be good to have a bit more time to test it, I don't think this is a critical blocker, and we still need to converge a bit.
I mean, it's only the memory calculation which is currently failing. I could try and play around a bit more, but I'm also fine with moving it to 1.9.
This is now finally ready for review again. Everything seems to be working fine on all platforms.
Thanks @cbrnr !