automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can I peforma conditional tests???


From: Dr. David Kirkby
Subject: Can I peforma conditional tests???
Date: Sat, 05 Apr 2003 16:59:10 +0100

I have a program that can be configured in one of three ways:

1) To be built run like a normal single-threaded application.
2) To be built as a multi-threaded application using muoltiple cpus on
the one machine
3) To be built as a distributed processing application, running in
parallel on a number of computers. 

There are a number of tests I'l like to perform that are appropiate
for all three configurations, but some are only appropiate for case 2
(multi-threaded) and some for case 3 (distributed processing).

How can I configure extra sets of tests to run if the program was
configured for multi-threaded or distibuted use? I don't want to run
all tests in all cases, as some will fail. 


At present my configure.ac defines 'ENABLE_POSIX_THREADS' if the
application is configured for threaded opperation and 'ENABLE_MPI'
gets defined if the program is configured for distributed processing.
(see below for the full details if wanted). 

Is there a way to pass ENABLE_POSIX_THREADS and ENABLE_MPI to the
tests subdirectory and if so how do i make the tests conditoinal on
these being defined? Or is there a better way?? 


# My top -level Makefile.am is:
AUTOMAKE_OPTIONS = gnits
SUBDIRS =  . src man docs examples tools tests 

# Makeifile.am in tests subdirectory is:
TESTS_ENVIRONMENT = top_builddir=$(top_builddir)
top_srcdir=$(top_srcdir)
TESTS =  \
1a.test  \
1b.test 

# Now how do I perform 2a.test +1b.test  when configured for
multi-threded use ?
# and how do I peform tests 3a.test +3b.test when configured for
distirbuted processing?




# Extract from configure.ac. This is the only bits of relavance to
the#
# multi-threaded and/or distributed processing code.

# This is case 2 above (multi-threading).
sinclude(acx_pthread.m4)
AC_ARG_WITH(threads, 
[  --with-threads          support thread-based parallel computation -
this 
                          needs a POSIX thread library (pthreads or
similar) 
                          installed])

if test "x$with_threads" = "xyes"; then
AC_CHECK_LIB(thread, thr_setconcurrency,
[AC_DEFINE(HAVE_THR_SETCONCURRENCY)])
ACX_PTHREAD([AC_DEFINE(ENABLE_POSIX_THREADS)])
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
fi



# case 3 above (distributed processing).
AC_ARG_WITH(mpi,
AC_HELP_STRING([--with-mpi=[mpi_install_prefix]],[support MPI-b
ased parallel computation (needs MPICH installed)]))
AC_ARG_WITH(mpe,
AC_HELP_STRING([--with-mpe=[mpi_install_prefix]],[implies --wit
h-mpi and additionally links in MPE logging support]))

if test "x$with_mpi" != "x" \
|| test "x$with_mpe" != "x"; then

  if test "x$with_mp" = "xyes"; then
    AC_MSG_ERROR([it does not make sense to use --with-mp with
--with-mpi or --w
ith-mpe])
  fi  
  AC_HAVE_HEADERS(mpi.h)
  AC_DEFINE(ENABLE_MPI)
  AC_CHECK_LIB(socket, getsockopt)
  AC_CHECK_LIB(nsl, xdr_void)
  AC_CHECK_LIB(rt, sched_yield)
  if test "x$with_mpe" != "x"; then 
    if test "x$with_mpe" = "xyes"; then
        path_to_mpe=/usr/local
    else
        path_to_mpe=$with_mpe
    fi
    CFLAGS="$CFLAGS -I$path_to_mpe/include -L$path_to_mpe/lib"
    AC_CHECK_LIB(pmpich,  MPI_Init , , [AC_MSG_ERROR([Could not link
test progra
m with libpmpich.a])])
    AC_CHECK_LIB(mpe,  MPE_Init_log , , [AC_MSG_ERROR([Could not link
test progr
am with libmpe.a])])
    AC_CHECK_LIB(lmpe,  MPE_Init_log , ,[AC_MSG_ERROR([Could not link
test progr
am with liblmpe.a])] , -lmpe)
  else
    if test "x$with_mpi" = "xyes"; then
        path_to_mpi=/usr/local
    else
        path_to_mpi=$with_mpi
    fi
    CFLAGS="$CFLAGS -I$path_to_mpi/include -L$path_to_mpi/lib"
    AC_CHECK_LIB(mpich,  MPI_Init, , [AC_MSG_ERROR([Could not link
test program 
with libmpich.a])])
  fi
fi

-- 
Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6408 Fax: 020 7679 6269
Internal telephone: ext 46408
e-mail address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]