Re: Compiler optimizations and other performance hacks for HiGHS

Ralf Gommers <[email protected]> Tue, 14 Mar 2023 13:12:23 +0000
Newsgroups gmane.comp.python.scientific.user
Message-ID <CABL7CQhq426Gwrfs9AsdV6t7V6oho8JxcSHBJz-LAysbCC4JHw@mail.gmail.com>
--===============3887710510968997305==
Content-Type: multipart/alternative; boundary="00000000000020b7bb05f6dbfb34"

--00000000000020b7bb05f6dbfb34
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Mar 14, 2023 at 1:04=E2=80=AFPM S=C3=B8ren Fuglede J=C3=B8rgensen v=
ia SciPy-User <
[email protected]> wrote:

> I have a workflow where I'm solving a bunch of (non-integral) LPs, and
> `scipy.optimize._highs._highs_wrapper` is the main bottleneck, and I was
> looking for ways to squeeze out as much performance of that as I could. F=
or
> instance, I was looking around for stuff like "-O3" in the `meson.build`,
> `CMakeLists.txt`, `setup.py` but didn't find anything, so I was wondering
> if the compilation uses performance optimizations, or if it even matters.
> Or, more generally:
>

Generally, for optimization settings Meson uses "build options" rather than
manually passing around flags - see
https://mesonbuild.com/Builtin-options.html#core-options. The defaults are
encoded in the top-level meson.build (applies when you're using `dev.py`
locally) and in meson-python's defaults (applies when you're using `pip` to
install, defaults to debug=3Dfalse, optimization=3D2).

For HiGHS specifically, I think the main thing is that we disable its
OpenMP support because we don't allow OpenMP usage in SciPy. But you could
probably enable it by removing the `-UOPENMP` build flag from
`optimize/_highs/meson.build`.

Cheers,
Ralf



> Are there any tricks, hacks, optimizations that one should be aware of to
> get as much as possible out of HiGHS? I only care about LPs and stuff tha=
t
> works on x86 and/or ARM64.
>
> Thanks!
> _______________________________________________
> SciPy-User mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/scipy-user.python.org/
> Member address: [email protected]
>

--00000000000020b7bb05f6dbfb34
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Tue, Mar 14, 2023 at 1:04=E2=80=AF=
PM S=C3=B8ren Fuglede J=C3=B8rgensen via SciPy-User &lt;<a href=3D"mailto:s=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1p=
x solid rgb(204,204,204);padding-left:1ex">I have a workflow where I&#39;m =
solving a bunch of (non-integral) LPs, and `scipy.optimize._highs._highs_wr=
apper` is the main bottleneck, and I was looking for ways to squeeze out as=
 much performance of that as I could. For instance, I was looking around fo=
r stuff like &quot;-O3&quot; in the `meson.build`, `CMakeLists.txt`, `setup=
.py` but didn&#39;t find anything, so I was wondering if the compilation us=
es performance optimizations, or if it even matters. Or, more generally:<br=
></blockquote><div><br></div><div>Generally, for optimization settings Meso=
n uses &quot;build options&quot; rather than manually passing around flags =
- see <a href=3D"https://mesonbuild.com/Builtin-options.html#core-options">=
https://mesonbuild.com/Builtin-options.html#core-options</a>. The defaults =
are encoded in the top-level meson.build (applies when you&#39;re using `de=
v.py` locally) and in meson-python&#39;s defaults (applies when you&#39;re =
using `pip` to install, defaults to debug=3Dfalse, optimization=3D2).</div>=
<div><br></div><div>For HiGHS specifically, I think the main thing is that =
we disable its OpenMP support because we don&#39;t allow OpenMP usage in Sc=
iPy. But you could probably enable it by removing the `-UOPENMP` build flag=
 from `optimize/_highs/meson.build`.</div><div><br></div><div>Cheers,<br></=
div><div>Ralf</div><div><br></div><div><br> </div><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex">
<br>
Are there any tricks, hacks, optimizations that one should be aware of to g=
et as much as possible out of HiGHS? I only care about LPs and stuff that w=
orks on x86 and/or ARM64.<br>
<br>
Thanks!<br>
_______________________________________________<br>
SciPy-User mailing list -- <a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a><br>
To unsubscribe send an email to <a href=3D"mailto:[email protected]=
rg" target=3D"_blank">[email protected]</a><br>
<a href=3D"https://mail.python.org/mailman3/lists/scipy-user.python.org/" r=
el=3D"noreferrer" target=3D"_blank">https://mail.python.org/mailman3/lists/=
scipy-user.python.org/</a><br>
Member address: <a href=3D"mailto:[email protected]" target=3D"_blank"=
>[email protected]</a><br>
</blockquote></div></div>

--00000000000020b7bb05f6dbfb34--

--===============3887710510968997305==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
SciPy-User mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-user.python.org/
Member address: [email protected]

--===============3887710510968997305==--