Paul,

in my environment, libslurm.la contains

# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'

# Libraries that this one depends upon.
dependency_libs=' -ldl -lpthread'


so bottom line, it invokes the compiler with both -pthread and -lpthread


iirc, -pthread does two things :

- invoke the compiler with -D_REENTRANT (so it uses the thread-safe errno and so on)

- invoke the linker with -lpthread

OpenMPI has its own way to pass -D_REENTRANT or similar anyway, and libslurm.la is used only for for linking.

since -lpthread is pulled anyway from libslurm.la (or it was already set by OpenMPI), then yes, discarding -pthread should do the trick.


Cheers,


Gilles


On 7/26/2016 10:11 AM, Paul Hargrove wrote:
Gilles,

My initial thought is that libslurm probably does require linking libpthread, either for for linking pthread_* symbols, or for proper *operation* (such as thread-safe versions of functions which override weak definitions in libc).

If so, then neither omitting "-pthread" nor telling pgcc not to complain about "-pthread" is going to be a good solution.
Instead the "-pthread" needs to be replaced by "-lpthread", or similar.

-Paul

On Mon, Jul 25, 2016 at 6:03 PM, Gilles Gouaillardet <gil...@rist.or.jp <mailto:gil...@rist.or.jp>> wrote:

    Folks,


    This is a followup of a thread that initially started at
    http://www.open-mpi.org/community/lists/users/2016/07/29635.php


    The user is trying to build Open MPI with PGI compiler and
    libslurm.la/libpmi.la <http://libslurm.la/libpmi.la> support, and
    slurm was built with gcc compiler.


    At first, it fails because the "-pthread" flag is pulled from
    libslurm.la/libpmi.la <http://libslurm.la/libpmi.la>, but this
    flag is not supported by PGI compilers.

    A workaround is to pass the -noswitcherror flag to the PGI
    compiler (so the -pthread flag is discarded and a warning message
    is issued, but PGI compiler does not fail). Unfortunatly, that
    does not work because libtool does does not pass this flag to the
    PGI compiler.


    Of course, one option is to tell the user to rebuild slurm with
    PGI, so libslurm.la/libpmi.la <http://libslurm.la/libpmi.la> do
    not have the "-pthread" flag.

    A nicer though arguable option is to hack libtool to silently drop
    the "-pthread" flag with PGI compiler is used (i made a proof of
    concept, and this is a two lines patch).

    An other cleaner option is to hack libtool so it pass
    -noswitcherror to PGI compiler, but i do not know how to achieve this.


    Any thoughts ?


    Cheers

    _______________________________________________
    devel mailing list
    de...@open-mpi.org <mailto:de...@open-mpi.org>
    Subscription: https://www.open-mpi.org/mailman/listinfo.cgi/devel
    Link to this post:
    http://www.open-mpi.org/community/lists/devel/2016/07/19278.php




--
Paul H. Hargrove phhargr...@lbl.gov <mailto:phhargr...@lbl.gov>
Computer Languages & Systems Software (CLaSS) Group
Computer Science Department               Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900


_______________________________________________
devel mailing list
de...@open-mpi.org
Subscription: https://www.open-mpi.org/mailman/listinfo.cgi/devel
Link to this post: 
http://www.open-mpi.org/community/lists/devel/2016/07/19279.php

Reply via email to