1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
|
# Checking wether we can produce a parallel version
# -------------------------------------------------
dnl m4_include(ax_mpi.m4)
ff_save_path="$PATH"
# We need to choose between mpich, openmpi and lam for the Debian package
AC_ARG_WITH(mpipath,[ --with-mpipath= the path of mpich under windows (no command mpic++, ... )])
AC_ARG_WITH(mpilibs,[ --with-mpilibs= the libs to add to c++,fc, ... (to link with c++ - ex: -L/usr/local/lib -lmpi_f90 -lmpi_cxx -lmpi -lopen-rte -lopen-pal -lutil) ])
AC_ARG_WITH(mpilibsc,[ --with-mpilibsc= the libs to add to c ... (to link with cc (for pastix lib) ex: -L/usr/local/lib -lmpi -lopen-rte -lopen-pal -lutil) ])
AC_ARG_WITH(mpiinc,[ --with-mpiinc= the include directory directive and preprocess directive (no mpicc++, just use the compiler)) ])
AC_ARG_WITH(mpi,[ --with-mpi=[yes|no|mpic++|lam|mpich|openmpi|/usr/local/bin/mpic++|... ] or --without-mpi Choose MPI implementation (default is mpic++)])
if test "$with_mpi" != no ; then
#if test "$with_mpi" != no ; then
#AX_MPI(with_mpi=yes, with_mpi=no)
#fi
# Default is mpic++
ff_mpi_suffix="";
if test "$with_mpi" = yes -o -z "$with_mpi"
then
ff_mpicxx=mpic++
else
case "$with_mpi" in
lam|mpich|openmpi) ff_mpi_suffix=.$with_mpi;ff_mpicxx=mpic++.$with_mpi;;
*) ff_mpicxx="$with_mpi" ;;
esac
fi
dnl AC_MSG_NOTICE([ xxxxxxxxxxxxxxxxxxxx --$with_mpilibs--]);
if test -n "$with_mpiinc" -a "$with_mpiinc" != no ; then
if test "$with_mpi" = 'no' ; then with_mpi='yes'; fi
ff_MPI_INCLUDE="$with_mpiinc"
fi
if test -n "$with_mpilibs" -a "$with_mpilibs" != no ; then
ff_MPI_LIB="$with_mpilibs"
ff_MPI_LIBC="$with_mpilibs"
ff_MPI_LIBFC="$with_mpilibs"
MPICXX="$CXX $ff_MPI_INCLUDE"
MPIF77="$F77 $ff_MPI_INCLUDE"
MPIFC="$FC $ff_MPI_INCLUDE"
MPICC="$CC $ff_MPI_INCLUDE"
AC_MSG_NOTICE([ --- set all MPI compile to compiler: $MPICC , $MPIF77, $MPIFC, $MPICC ])
fi
if test -n "$with_mpilibsc" -a "$with_mpilibsc" != no ; then
ff_MPI_LIBC="$with_mpilibsc"
fi
AC_ARG_VAR(MPIRUN,[MPI run command ])
AC_MSG_CHECKING(for MPIRUN)
if test -z "$MPIRUN" ; then
AC_PATH_PROGS(MPIRUN,mpirun mpiexec mpiexec.exe,no)
if test "$MPIRUN" = no
then
ff_mpi=no
fi
fi
AC_MSG_RESULT($MPIRUN)
AC_MSG_CHECKING(for mpipath )
if test "$with_mpi" != no -a ! -d "$with_mpipath" -a "$ff_win32" = yes -a "$MPIRUN" != no ; then
# if "$MPIRUN" != no ; tehn
with_mpipath=`AS_DIRNAME(["$MPIRUN"])`
with_mpipath=`AS_DIRNAME(["$with_mpipath"])`
# else
# for i in '/c/Program Files (x86)/MPICH2' '/c/Program Files/MPICH2' 'c:\Program Files (x86)\MPICH2' 'c:\Program Files\MPICH2' ; do
# test -d "$i" && with_mpipath="$i" && break
# done
# fi
fi
dnl if test "$with_mpilibs" != "no" ; then
dnl fi
if test -d "$with_mpipath" -a "$ff_win32" = yes ; then
# sed -e "s?@MPIDIR@?$with_mpipath?" -e "s?@F77@?$F77?" -e "s?@CC@?$CC?" -e "s?@CXX@?$CXX?" -e "s?@FC@?$FC?" <mpic++.in >mpic++
# chmod a+rx mpic++
# for i in mpicc mpif90 mpifc mpif77 ; do cp mpic++ $i; done
# ff_pwd=`pwd`
# with_mpi="$ff_pwd"/mpic++
# MPICXX="$ff_pwd/mpic++"
# MPIF77="$ff_pwd/mpif77"
# MPIFC="$ff_pwd/mpif90"
# MPICC="$ff_pwd/mpicc" zzzzzzzzzzz
if with_mpilibs=`which msmpi.dll`
then
case "$ff_size_ptr" in
4) with_mpipathlib="$with_mpipath/Lib/i386";;
8) with_mpipathlib="$with_mpipath/Lib/amd64";;
*) with_mpipath=no;;
esac
test -d "$with_mpipath/Inc" && ff_MPI_INCLUDE_DIR="$with_mpipath/Inc"
test -d "$with_mpipath/Include" && ff_MPI_INCLUDE_DIR="$with_mpipath/Include"
ff_MPI_INCLUDE="-I'$ff_MPI_INCLUDE_DIR' '-D_MSC_VER' '-D__int64=long long'"
with_mpiinc="$ff_MPI_INCLUDE"
test -z "$MPIRUN" && MPIRUN="$with_mpipath/bin/mpiexe.exe"
ff_MPI_LIBC="$with_mpilibs"
ff_MPI_LIB="$with_mpilibs"
ff_MPI_LIBFC="$with_mpilibs"
test -z "$MPICXX" && MPICXX="$CXX $ff_MPI_INCLUDE"
test -z "$MPIF77" && MPIF77="$F77 $ff_MPI_INCLUDE"
test -z "$MPIFC" && MPIFC="$FC $ff_MPI_INCLUDE"
test -z "$MPICC" && MPICC="$CC $ff_MPI_INCLUDE"
else
echo " #### no msmpi.dll => no mpi under windows .... (FH) " >&AS_MESSAGE_LOG_FD
echo " #### no msmpi.dll => no mpi under windows .... (FH) " >&AS_MESSAGE_FD
with_mpipath=no
with_mpi=no
fi
else
with_mpipath=no
fi
AC_MSG_RESULT($ff_mpi_path)
dnl correct ff_mpi_path august 2010 -- FH ...
ff_save_cxx="$CXX"
ff_save_libs="$LIBS"
if test "$with_mpi" != no
then
ff_mpi_path=`AS_DIRNAME(["$MPIRUN"])`
dnl echo "ff_mpi_path '$ff_mpi_path' .............."
case "$ff_mpi_path" in
.|"") ff_mpi_path="$PATH";ff_defmpicxx="$ff_mpicxx";;
*) ff_mpi_path="$ff_mpi_path";ff_defmpicxx=`expr "//$ff_mpicxx" : '.*/\(.*\)'`;;
dnl if also add $PATH they could be missing some different mpi version...
esac
AC_ARG_VAR(MPICXX,[MPI C++ compiler command])
if test -z "$MPICXX" ; then
AC_PATH_PROGS(MPICXX,$ff_defmpicxx mpic++$ff_mpi_suffix mpicxx$ff_mpi_suffix mpiCC$ff_mpi_suffix mpCC hcp mpxlC mpxlC_r cmpic++,no,$ff_mpi_path)
AC_MSG_CHECKING(for MPICXX)
fi
ff_mpicxx="eval $MPICXX"
CXX=$ff_mpicxx
LIBS="$LIBS $ff_MPI_LIB"
AC_LINK_IFELSE(
[AC_LANG_SOURCE([
#include <mpi.h>
#include <stdio.h>
int main(int argc,char **argv){
char name[[BUFSIZ]];
int length;
MPI_Init(&argc, &argv);
MPI_Get_processor_name(name, &length);
printf("%s: hello world\n", name);
MPI_Finalize();
return 0;
}])],
ff_mpi=yes,
ff_mpi=no)
AC_MSG_RESULT($ff_mpi)
# Also check that mpirun is there. If it isn't, then MPI is
# not fully installed.
if test "$ff_mpi" = yes;
then
AC_MSG_CHECKING( MPI_DOUBLE_COMPLEX)
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <mpi.h>
MPI_Datatype xxxx=MPI_DOUBLE_COMPLEX;
])],
ff_mpi_double_complex=yes,
ff_mpi_double_complex=no)
AC_MSG_RESULT($ff_mpi_double_complex)
if test "$ff_mpi_double_complex" = yes ; then
AC_DEFINE(HAVE_MPI_DOUBLE_COMPLEX,1, mpi_double_complex)
fi
echo "MPI CC $ff_mpi" >config_LIB_INFO
# We do not AC_DEFINE any special flag for parallel
# computation here, because it must only be set when the
# parallel program is compiled (see src/mpi/Makfile.am)
ff_mpiprog="FreeFem++-mpi${EXEEXT}"
AC_SUBST(MPIPROG,"$ff_mpiprog")
AC_SUBST(MPISCRIPT,"ff-mpirun")
AC_SUBST(MPIRUN,$MPIRUN)
AC_SUBST(MPICXX,$MPICXX)
else
AC_SUBST(MPICXX,$ff_save_cxx)
fi
if test "$ff_mpi" = yes;
then
if test "$enable_fortran" != no
then
AC_ARG_VAR(MPIF77,[MPI Fortran 77 compiler command])
if test -z "$MPIF77" ; then
AC_PATH_PROGS(MPIF77, mpif90$ff_mpi_suffix mpif77$ff_mpi_suffix hf77 mpxlf mpf77 mpif90 mpf90 mpxlf90 mpxlf95 mpxlf_r cmpifc cmpif90c, "",$ff_mpi_path)
fi
AC_SUBST(MPIF77)
AC_ARG_VAR(MPIFC,[MPI Fortran 90 compiler command])
if test -z "$MPIFC" ; then
AC_PATH_PROGS(MPIFC, mpif90$ff_mpi_suffix mpxlf95_r mpxlf90_r mpxlf95 mpxlf90 mpf90 cmpif90c, "",$ff_mpi_path)
fi
AC_SUBST(MPIFC)
fi
ff_MPI_INCLUDE="$with_mpiinc"
ff_mpishow=`$MPICXX -show` 2>/dev/null
ff_mpicshow=`$MPICC -show` 2>/dev/null
ff_mpifcshow=`$MPIFC -show` 2>/dev/null
if test "$with_mpilibs" = no -o -z "$with_mpilibs" ; then
[ff_MPI_INCLUDE=`echo $ff_mpishow|tr ' ' '\n'| grep -E '^-[^WLlOgp]|^-Wp,'|tr '\n' ' '`]
ff_MPI_LIB_DIRS=""
[ff_MPI_LIB=`echo $ff_mpishow|tr ' ' '\n'| grep -E '^-[Llp]|^-Wl,'|tr '\n' ' '`]
[ff_MPI_LIBC=`echo $ff_mpicshow|tr ' ' '\n'| grep -E '^-[Llp]|^-Wl,'|tr '\n' ' '`]
[ff_MPI_LIBFC=`echo $ff_mpifcshow|tr ' ' '\n'| grep -E '^-[Llp]|^-Wl,'|grep -v 'commons,use_dylibs' |tr '\n' ' '`]
[ff_mpi_idir=`echo $ff_mpishow|tr ' ' '\n'| grep -E '^-I'|sed s/^-I//|tr '\n' ' '`' /usr/include']
fi
[ff_mpi_idir=`echo $ff_MPI_INCLUDE|tr ' ' '\n'| grep -E '^-I'|sed s/^-I//|tr '\n' ' '`' /usr/include']
[ff_mpi_ldir=`echo $ff_MPI_LIB|tr ' ' '\n'| grep -E '^-[Llp]|^-Wl,'|sed -e 's/^-[Llp]//' -e 's/^-Wl,]//' |tr '\n' ' '`' /usr/lib']
if test -z "$ff_MPI_INCLUDE_DIR" ; then
for i in $ff_mpi_idir; do
if test -f "$i/mpi.h" -a -z "$ff_MPI_INCLUDE_DIR" ;then
ff_MPI_INCLUDE_DIR=$i
fi
done
fi
for i in $ff_mpi_ldir; do
ff_tmp=`ls $i/libmpi.*|head -1`
if test -f "$ff_tmp" -a -z "$ff_MPI_LIB_DIRS" ;then
ff_MPI_LIB_DIRS=$i
fi
done
AC_SUBST(MPICXX,$MPICXX)
AC_ARG_VAR(MPICC,[MPI C compiler command in $ff_mpi_path])
if test -z "$MPICC" ; then
AC_PATH_PROGS(MPICC,mpicc$ff_mpi_suffix hcc mpcc mpcc_r mpxlc cmpicc, "",$ff_mpi_path)
fi
AC_SUBST(MPICC,$MPICC)
AC_SUBST(PASTIX_HOSTARCH,$ff_HOSTARCH_pastix)
if test ! -f "$ff_MPI_INCLUDE_DIR/mpif.h" ; then
AC_MSG_NOTICE([ MPI without fortran no file "$ff_MPI_INCLUDE_DIR/mpif.h" ])
else
if test -n "$MPIFC" ; then
AC_FF_ADDWHERELIB(mpifc,$ff_MPI_LIBFC,$ff_MPI_INCLUDE)
AC_FF_ADDWHERELIB(mpif77,$ff_MPI_LIBFC,$ff_MPI_INCLUDE)
dnl [echo mpifc LD "'$ff_MPI_LIBFC'" >>$ff_where_lib_conf ]
dnl [echo mpifc INCLUDE "'$ff_MPI_INCLUDE'" >>$ff_where_lib_conf ]
dnl [echo mpif77 LD "'$ff_MPI_LIBFC'" >>$ff_where_lib_conf ]
dnl [echo mpif77 INCLUDE "'$ff_MPI_INCLUDE'" >>$ff_where_lib_conf ]
fi
fi
if test -n "$MPICXX" ; then
AC_FF_ADDWHERELIB(mpi,$ff_MPI_LIB,$ff_MPI_INCLUDE)
dnl [echo mpi LD "'$ff_MPI_LIB'" >>$ff_where_lib_conf ]
dnl [echo mpi INCLUDE "'$ff_MPI_INCLUDE'" >>$ff_where_lib_conf ]
fi
AC_SUBST(MPI_INC_DIR,$ff_MPI_INCLUDE_DIR)
AC_SUBST(MPI_INCLUDE,$ff_MPI_INCLUDE)
AC_SUBST(MPI_LIB_DIRS,$ff_MPI_LIB_DIRS)
AC_SUBST(MPI_LIB,$ff_MPI_LIB)
AC_SUBST(MPI_LIBC,$ff_MPI_LIBC)
AC_SUBST(MPI_LIBFC,$ff_MPI_LIBFC)
AC_SUBST(SKIP_TESTS_MPI,"no")
fi
CXX="$ff_save_cxx"
LIBS="$ff_save_libs"
fi
fi
## clean on MPI variable if not MPI ...
if test "$ff_mpi" != yes ; then
AC_SUBST(MPIRUN,"")
AC_SUBST(MPICC,"")
AC_SUBST(MPICXX,"")
AC_SUBST(MPIF77,"")
AC_SUBST(MPIFC,"")
AC_SUBST(MPI_INCLUDE,"")
AC_SUBST(MPI_LIB_DIRS,"")
AC_SUBST(MPI_LIB,"")
AC_SUBST(MPI_LIBC,"")
AC_SUBST(MPI_LIBFC,"")
AC_SUBST(SKIP_TESTS_MPI,"yes")
ff_mpi=no
fi
# Local Variables:
# mode:shell-script
# ispell-local-dictionary:"british"
# coding:utf-8
# End:
|