On Sat, 10 Jun 2017, A. T. wrote:
Am 05.06.2017 um 14:55 schrieb Allin Cottrell:
> On Sat, 3 Jun 2017, Artur Tarassow wrote:
>
>> Damn, I thought it's solved. Even though MPI is now correctly
>> configured, I still obtain the following message:
>>
>> <gretlcli>
>> *** Warning ***
>> *
>> * gretl is built using OpenMP, but is linked against
>> * OpenBLAS parallelized via pthreads. This combination
>> * of threading mechanisms is not recommended. Ideally,
>> * OpenBLAS should also use OpenMP.
>>
>> </gretlcli>
>
> This is basically nothing to do with MPI. It's to do with the
> possibility that "raw" pthreads and OpenMP end up being invoked
> concurrently, in which case the result is unpredictable but probably bad!
>
> Various functions in gretl are parallelized via OpenMP (which is much
> easier to program than low-level pthreads). If such a function happened
> to call a BLAS routine, and that routine was parallelized in OpenBLAS
> using pthreads rather than OpenMP, nasty things could happen (two
> thread-management mechanisms in competition). And one way of ensuring
> that can never happen is to ensure that OpenBLAS is itself parallelized
> using OpenMP (which is a build-time option). That's why we say, "Ideally
> OpenBLAS should also use OpenMP".
>
> However... in fact we can probably get rid of the warning above, since
> we've been over the libgretl functions which invoke OpenMP, and I think
> we ensured that OpenBLAS-pthreads will not get called either directly or
> indirectly by those functions. Nonetheless, I think it's good practice
> to set things up so that any given program is never going to invoke
> pthreads and OpenMP simultaneously.
>
> Allin Cottrell
Thanks for this clarification, Allin. So in case I want to get 100% sure
that I use OpenMP rather than pthreads, I should re-compile OpenBLAS
myself with the correct build-time option [...]
That's right. In the OpenBLAS Makefile.rule there's a stanza:
# If you're going to use this library with OpenMP, please comment it in.
# USE_OPENMP = 1
So you "comment it in":
USE_OPENMP = 1
as it remains unclear which one the Ubuntu-maintainer used, right?
Actually that's not unclear. Gretl will give the warning you saw only
if OpenMP was _not_ used in the OpenBLAS build.
Allin