[mvapich-discuss] --enable-threads=single causes mpicc to miss -lpthread, breaking ptmalloc at link-time

Jonathan Perkins perkinjo at cse.ohio-state.edu
Thu Oct 24 14:47:09 EDT 2013


Thanks for the report and giving the work around that can be used for
any currently affected users.  We'll look at resolving this for our
upcoming release.

On Thu, Oct 24, 2013 at 2:11 PM, Jeff Hammond <jeff.science at gmail.com> wrote:
> It seems that ptmalloc depends upon pthreads unconditionally but
> configuring MVAPICH to support only single-threaded usage removes
> -lpthread from mpicc, hence one cannot link an MPI program using
> mpicc.  Manually inserting -lpthread at the end of the link line
> resolves the problem and suggests the trivial solution in MVAPICH.
>
> As a temporary solution, I will rebuild MVAPICH with
> --enable-threads=runtime, but I prefer to avoid any runtime overhead
> if possible.
>
> My "fast" build options work just fine with MPICH right now so this is
> an MVAPICH bug, which makes sense since MPICH does not use ptmalloc
> internally.
>
> Thanks,
>
> Jeff
>
> [jhammond at login1 oshmpi]$ mpichversion MVAPICH2 Version:        2.0a
> MVAPICH2 Release date:  Fri Aug 23 13:38:52 EDT 2013
> MVAPICH2 Device:        ch3:mrail
> MVAPICH2 configure:     CC=gcc CXX=g++ --enable-fc FC=gfortran
> --enable-f77 F77=gfortran --with-pm=hydra --enable-mcast
> --prefix=/soft/libraries/mpi/mvapich/3.0.a/gcc-fast --enable-static
> --enable-fast=O3,nochkmsg,notiming,ndebug,nompit
> --disable-weak-symbols --enable-threads=single
> MVAPICH2 CC:    gcc    -DNDEBUG -DNVALGRIND -O3
> MVAPICH2 CXX:   g++   -DNDEBUG -DNVALGRIND -O3
> MVAPICH2 F77:   gfortran   -O3
> MVAPICH2 FC:    gfortran   -O3
>
> [jhammond at login1 oshmpi]$ mpicc -show
> gcc -I/soft/libraries/mpi/mvapich/3.0.a/gcc-fast/include
> -L/soft/libraries/mpi/mvapich/3.0.a/gcc-fast/lib -lpmpich -lmpich
> -lopa -lmpl -libmad -lrdmacm -libumad -libverbs -lrt -lhwloc -lhwloc
>
> [jhammond at login1 oshmpi]$ mpicc -g -O3 -std=c99 -Wall -I.
> -DSHMEM_DEBUG=3     test_start.c -g -O3 -std=c99 -Wall -I.
> -DSHMEM_DEBUG=3  libshmem.a -lpthread -o test_start.x
> /soft/libraries/mpi/mvapich/3.0.a/gcc-fast/lib/libmpich.a(mvapich_malloc.o):
> In function `ptmalloc_init.part.5':
> mvapich_malloc.c:(.text+0xd74): undefined reference to `pthread_atfork'
> collect2: error: ld returned 1 exit status
>
> [jhammond at login1 oshmpi]$ gcc  -g -O3 -std=c99 -Wall -I.
> -DSHMEM_DEBUG=3     test_start.c -g -O3 -std=c99 -Wall -I.
> -DSHMEM_DEBUG=3  libshmem.a
> -I/soft/libraries/mpi/mvapich/3.0.a/gcc-fast/include
> -L/soft/libraries/mpi/mvapich/3.0.a/gcc-fast/lib -lpmpich -lmpich
> -lopa -lmpl -libmad -lrdmacm -libumad -libverbs -lpthread -lrt -lhwloc
>  -o test_start.x
>
>
>
> --
> Jeff Hammond
> jeff.science at gmail.com
> _______________________________________________
> mvapich-discuss mailing list
> mvapich-discuss at cse.ohio-state.edu
> http://mailman.cse.ohio-state.edu/mailman/listinfo/mvapich-discuss
>
>



-- 
Jonathan Perkins
http://www.cse.ohio-state.edu/~perkinjo


More information about the mvapich-discuss mailing list