Mercurial > mxe-octave
diff installer-files/octave.bat @ 6184:d02b5d26ac28 release
Set OPENBLAS_NUM_THREADS also in launcher scripts.
* installer-files/octave-firsttime.vbs, installer-files/octave.vbs,
installer-files/octave.bat: Set OPENBLAS_NUM_THREADS to number of physical cores
if it is not set in the environment yet.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 22 Apr 2022 19:19:31 +0200 |
parents | 4ba9eb3f70c9 |
children | 6adeb47401d6 |
line wrap: on
line diff
--- a/installer-files/octave.bat Tue Apr 19 09:26:38 2022 -0400 +++ b/installer-files/octave.bat Fri Apr 22 19:19:31 2022 +0200 @@ -41,9 +41,27 @@ set QT_PLUGIN_PATH=%OCT_HOME%\plugins ) -Rem pkgconfig .pc path +Rem pkgconfig .pc files path set PKG_CONFIG_PATH=%OCT_HOME%\lib\pkgconfig +IF NOT x%OPENBLAS_NUM_THREADS%==x GOTO openblas_num_threads_set + +Rem Set OPENBLAS_NUM_THREADS to number of physical processor cores. +SETLOCAL ENABLEDELAYEDEXPANSION +SET count=1 +FOR /F "tokens=* USEBACKQ" %%F IN (`wmic CPU Get NumberOfCores`) DO ( + SET line!count!=%%F + SET /a count=!count!+1 +) +Rem Check that first line contains "NumberOfCores". +IF x%line1%==xNumberOfCores ( + Rem The next line should contain the number of cores. + SET OPENBLAS_NUM_THREADS=%line2% +) +ENDLOCAL & SET OPENBLAS_NUM_THREADS=%OPENBLAS_NUM_THREADS% + +:openblas_num_threads_set + Rem set home if not already set if "%HOME%"=="" set HOME=%USERPROFILE% if "%HOME%"=="" set HOME=%HOMEDRIVE%%HOMEPATH%