[mvapich-discuss] MVAPICH2 1.9b build is broken with Clang

Jonathan Perkins perkinjo at cse.ohio-state.edu
Wed Apr 10 19:28:21 EDT 2013


On Thu, Apr 11, 2013 at 01:15:13AM +0300, Dmitri Gribenko wrote:
> On Wed, Apr 10, 2013 at 8:24 PM, Jonathan Perkins
> <perkinjo at cse.ohio-state.edu> wrote:
> > Hello Dmitri, thanks for the report.  I haven't been able to try with
> > version 3.2 of Clang yet but I've seen that there is an issue with an
> > older version when building with --enable-shared.  I believe that this
> > is the same issue you're facing.
> >
> > Basically with clang it appears that a utility library (mpl) is not
> > being built with -fPIC.  The error actually shows up before reaching cpi
> > or osu_benchmarks.  I am still trying to determine the exact issue with
> > building mpl and will try to prepare a proper.  In the meantime you can
> > try removing the --enable-shared and --enable-sharedlibs=gcc options if
> > you are not particular about using a static or shared build of MVAPICH2.
> 
> Hello Jonathan,
> 
> Thank you for your reply.
> 
> Unfortunately, removing --enable-shared and --enable-sharedlibs=gcc
> does not fix the issue.  Configuring with:
> 
> ./configure --prefix=/opt/eb/software/MVAPICH2/1.9b-ClangGCC-1.1.2
> --with-rdma=gen2 --with-thread-package=pthreads --enable-fast
> --enable-f77 --enable-fc --enable-cxx
> 
> I get:
> 
> [easybuild at cluster-build examples]$ make V=1

[snip]

> /home/easybuild/.local/easybuild/build/MVAPICH2/1.9b/ClangGCC-1.1.2/mvapich2-1.9b/lib/.libs/libpmpich.a(lib_libpmpich_la-bcast.o):
> In function `MPI_Bcast':
> src/mpi/coll/bcast.c:(.text+0xc9): undefined reference to
> `mv2_increment_shmem_coll_counter'

[snip] 

> This can be fixed by applying the attached patch.  The error is caused
> by Clang implementing C99 inline semantics correctly.  This is
> explained in, for example,
> http://www.greenend.org.uk/rjk/tech/inline.html

Thanks for the note.  We actually experienced a similar issue after
testing against an upgraded Ekopath compiler.  This is resolved
internally and will be available in our upcoming RC release.

> After fixing this, I see:

[snip]

> libtool: link: clang -O2 -march=native -DNDEBUG -DNVALGRIND -Wl,-rpath
> -Wl,/lib -Wl,-rpath -Wl,/lib -o osu_alltoallv osu_alltoallv.o
> ../lib/.libs/libpmpich.a -L/lib -L/opt/eb/software/GCC/4.7.2/lib64
> -L/opt/eb/software/hwloc/1.6.2-ClangGCC-1.1.2/lib -L./src/mpl
> -L./src/openpa/src -lmpl -lopa

The -lmpl and -lopa refererences have been replaced with the path to the
corresponding .la files internally.  Perhaps the attached patch may help
you.  The patch can be applied via

    patch -d /path/to/mvapich2 -p1 < inline.patch

You will need to run

    ./autogen.sh

after applying this patch (Makefile.am changes).  You'll need a recent
version of autoconf, automake, and libtool.  I use autoconf-2.69,
automake-1.13.1, and libtool-2.4.2.

> /home/easybuild/.local/easybuild/build/MVAPICH2/1.9b/ClangGCC-1.1.2/mvapich2-1.9b/lib/.libs/libmpich.a
> ../lib/.libs/libmpich.a
> /home/easybuild/.local/easybuild/build/MVAPICH2/1.9b/ClangGCC-1.1.2/mvapich2-1.9b/src/mpl/.libs/libmpl.a
> /home/easybuild/.local/easybuild/build/MVAPICH2/1.9b/ClangGCC-1.1.2/mvapich2-1.9b/src/openpa/src/.libs/libopa.a
> -libmad -libumad -libverbs -lrt
> /opt/eb/software/hwloc/1.6.2-ClangGCC-1.1.2/lib/libhwloc.so -ldl -lm
> -lpthread -Wl,-rpath
> -Wl,/opt/eb/software/hwloc/1.6.2-ClangGCC-1.1.2/lib -Wl,-rpath
> -Wl,/opt/eb/software/hwloc/1.6.2-ClangGCC-1.1.2/lib
> /usr/bin/ld: cannot find -lmpl

This is error should be resolved by the attached patch.

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

-------------- next part --------------
commit 3c4b01ed407735ce0d3e6cd60d76dec04979f773
Author: bureddy <bureddy at 09bc9535-d30e-0410-b1f7-d46b20a4725c>
Date:   Sun Mar 24 18:38:58 2013 +0000

    Fix build errors with latest pathscale compiler
    
    git-svn-id: http://localhost/svn/mpi/mvapich2/branches/exp5@6164 09bc9535-d30e-0410-b1f7-d46b20a4725c

diff --git a/Makefile.am b/Makefile.am
index 76ec859..b48ce9d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,7 +50,9 @@ errnames_txt_files =
 external_subdirs = src/mpl src/openpa
 # FIXME how/where does external_libs/ldflags get used?
 external_ldflags = -L$(top_builddir)/src/mpl -L$(top_builddir)/src/openpa/src
-external_libs = -lmpl -lopa
+# _OSU_MVAPICH_
+external_libs = $(top_builddir)/src/mpl/libmpl.la $(top_builddir)/src/openpa/src/libopa.la
+# _OSU_MVAPICH_
 
 # NOTE on our semi-unconventional usage of DIST_SUBDIRS:
 # The automake manual recommends thinking of DIST_SUBDIRS as the list of all
diff --git a/src/include/coll_shmem.h b/src/include/coll_shmem.h
index 69cb402..d6a7fd3 100644
--- a/src/include/coll_shmem.h
+++ b/src/include/coll_shmem.h
@@ -282,8 +282,8 @@ void lock_shmem_region(void);
 void unlock_shmem_region(void);
 
 /* utils */
-inline int mv2_increment_shmem_coll_counter(MPID_Comm *comm_ptr); 
-inline int mv2_increment_allgather_coll_counter(MPID_Comm *comm_ptr); 
+int mv2_increment_shmem_coll_counter(MPID_Comm *comm_ptr); 
+int mv2_increment_allgather_coll_counter(MPID_Comm *comm_ptr); 
 void increment_mv2_shmem_comm_count(void);
 int get_mv2_shmem_comm_count(void);
 int MPIDI_CH3I_SHMEM_Coll_get_free_block(); 
diff --git a/src/mpi/coll/ch3_shmem_coll.c b/src/mpi/coll/ch3_shmem_coll.c
index 5db8bb2..8868925 100644
--- a/src/mpi/coll/ch3_shmem_coll.c
+++ b/src/mpi/coll/ch3_shmem_coll.c
@@ -1106,7 +1106,7 @@ int is_shmem_collectives_enabled()
     return mv2_enable_shmem_collectives;
 }
 
-inline int mv2_increment_shmem_coll_counter(MPID_Comm *comm_ptr)
+int mv2_increment_shmem_coll_counter(MPID_Comm *comm_ptr)
 {
    int mpi_errno = MPI_SUCCESS, flag=0; 
    PMPI_Comm_test_inter(comm_ptr->handle, &flag);
@@ -1136,7 +1136,7 @@ fn_fail:
   goto fn_exit; 
 } 
 
-inline int mv2_increment_allgather_coll_counter(MPID_Comm *comm_ptr)
+int mv2_increment_allgather_coll_counter(MPID_Comm *comm_ptr)
 {   
    int mpi_errno = MPI_SUCCESS, flag=0, errflag=0;
    PMPI_Comm_test_inter(comm_ptr->handle, &flag);
diff --git a/src/mpid/ch3/channels/mrail/src/Makefile.mk b/src/mpid/ch3/channels/mrail/src/Makefile.mk
index da78a5e..6c433f2 100644
--- a/src/mpid/ch3/channels/mrail/src/Makefile.mk
+++ b/src/mpid/ch3/channels/mrail/src/Makefile.mk
@@ -121,7 +121,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/mpid/ch3/channels/mrail/src/hwloc/include 	\
 
 
 lib_lib at MPILIBNAME@_la_LDFLAGS += -L$(top_builddir)/src/mpid/ch3/channels/mrail/src/hwloc/src
-lib_lib at MPILIBNAME@_la_LIBADD += -lhwloc_embedded
+lib_lib at MPILIBNAME@_la_LIBADD += $(top_builddir)/src/mpid/ch3/channels/mrail/src/hwloc/src/libhwloc_embedded.la
 endif
 
 if BUILD_MRAIL_CUDA_KERNELS


More information about the mvapich-discuss mailing list