Hi! I sent this in October and got very little feedback. There is a problem in ompi_config_pthreads.m4 and ompi_check_pthread_pids.m4 at least on Ubuntu Dapper with both gcc and pgi.
The attached patch against v1.1.2 fixes the problem. What happens is that in OMPI_INTL_POSIX_THREADS_LIBS_CXX it was incorrectly setting PTHREAD_LIBS to $pl which at the time isn't set yet and forgetting to reset LIBS on failure. In OMPI_INTL_POSIX_THREADS_LIBS_FC it was resetting LIBS too quickly resulting in -lpthread missing when checking for PTHREAD_MUTEX_ERRORCHECK_NP In OMPI_THREADS_HAVE_DIFFERENT_PIDS it didn't add THREAD_CFLAGS to CFLAGS resulting in the code failing to link. The testcode in itself was also broken so that some compilers failed even to compile it. -- Ake Sandgren, HPC2N, Umea University, S-90187 Umea, Sweden Internet: a...@hpc2n.umu.se Phone: +46 90 7866134 Fax: +46 90 7866126 Mobile: +46 70 7716134 WWW: http://www.hpc2n.umu.se
diff -ru site/config/ompi_config_pthreads.m4 amd64_ubuntu606-pgi6.2/config/ompi_config_pthreads.m4 --- site/config/ompi_config_pthreads.m4 2006-06-02 21:51:39.000000000 +0200 +++ amd64_ubuntu606-pgi6.2/config/ompi_config_pthreads.m4 2006-10-06 10:54:22.000000000 +0200 @@ -480,7 +480,6 @@ ompi_pthread_cxx_success=0) AC_LANG_POP(C++) if test "$ompi_pthread_cxx_success" = "1"; then - PTHREAD_LIBS="$pl" AC_MSG_RESULT([yes]) else CXXCPPFLAGS="$orig_CXXCPPFLAGS" @@ -515,6 +514,7 @@ else PTHREAD_CXXCPPFLAGS= CXXCPPFLAGS="$orig_CXXCPPFLAGS" + LIBS="$orig_LIBS" AC_MSG_RESULT([no]) fi done @@ -535,7 +535,6 @@ OMPI_INTL_PTHREAD_TRY_LINK_F77(ompi_pthread_f77_success=1, ompi_pthread_f77_success=0) AC_LANG_POP(C) - LIBS="$orig_LIBS" if test "$ompi_pthread_f77_success" = "1"; then AC_MSG_RESULT([yes]) else @@ -550,12 +549,12 @@ OMPI_INTL_PTHREAD_TRY_LINK_F77(ompi_pthread_f77_success=1, ompi_pthread_f77_success=0) AC_LANG_POP(C) - LIBS="$orig_LIBS" if test "$ompi_pthread_f77_success" = "1"; then PTHREAD_LIBS="$pl" AC_MSG_RESULT([yes]) break else + LIBS="$orig_LIBS" AC_MSG_RESULT([no]) fi done diff -ru site/config/ompi_check_pthread_pids.m4 amd64_ubuntu606-pgi6.2/config/ompi_check_pthread_pids.m4 --- site/config/ompi_check_pthread_pids.m4 2006-04-12 18:12:28.000000000 +0200 +++ amd64_ubuntu606-pgi6.2/config/ompi_check_pthread_pids.m4 2006-10-06 12:05:11.000000000 +0200 @@ -33,6 +33,8 @@ [Do threads have different pids (pthreads on linux)]) AC_MSG_CHECKING([if threads have different pids (pthreads on linux)]) +CFLAGS_save="$CFLAGS" +CFLAGS="$CFLAGS $THREAD_CFLAGS" CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS" LDFLAGS_save="$LDFLAGS" @@ -46,20 +48,20 @@ void *checkpid(void *arg); int main(int argc, char* argv[]) { pthread_t thr; - int pid, retval; + int pid, *retval; pid = getpid(); pthread_create(&thr, NULL, checkpid, &pid); pthread_join(thr, (void **) &retval); - exit(retval); + exit(*retval); } +static int ret; void *checkpid(void *arg) { - int ret; int ppid = *((int *) arg); if (ppid == getpid()) ret = 0; else ret = 1; - pthread_exit((void *) ret); + pthread_exit((void *) &ret); }], [MSG=no OMPI_THREADS_HAVE_DIFFERENT_PIDS=0], [MSG=yes OMPI_THREADS_HAVE_DIFFERENT_PIDS=1], @@ -75,6 +77,7 @@ esac ]) +CFLAGS="$CFLAGS_save" CPPFLAGS="$CPPFLAGS_save" LDFLAGS="$LDFLAGS_save" LIBS="$LIBS_save"