MPI_info: Path check and error handling for MPI exec
MPI_check: Check and selection of the installed MPI MPI_info: default unknown fix for MPI name and version
This commit is contained in:
Родитель
570a765887
Коммит
71c5aaba06
2
Makefile
2
Makefile
|
@ -75,7 +75,7 @@ endif
|
|||
|
||||
# The mpic++ wrapper only adds MPI specific flags to the g++ command line.
|
||||
# The actual compiler/linker flags added can be viewed by running 'mpic++ --showme:compile' and 'mpic++ --showme:link'
|
||||
CXX = mpic++
|
||||
CXX = $(MPI_PATH)/bin/mpic++
|
||||
SSE_FLAGS = -msse4.1 -mssse3
|
||||
|
||||
PROTOC = $(PROTOBUF_PATH)/bin/protoc
|
||||
|
|
|
@ -98,8 +98,24 @@ if not %l_build_target% == CPU-only (
|
|||
)
|
||||
)
|
||||
|
||||
echo #define _MPI_NAME_ "msmpi" >> buildinfo.h$$
|
||||
for /f "tokens=6 delims=] " %%i in ('mpiexec -? ^| findstr Version') do echo #define _MPI_VERSION_ "%%i" >> buildinfo.h$$
|
||||
:: MPI info
|
||||
set MPI_NAME="Unknown"
|
||||
set MPI_VERSION="Unknown"
|
||||
where -q mpiexec && mpiexec.exe -help > NUL 2>&1
|
||||
if not errorlevel 1 (
|
||||
for /f "tokens=1 delims= " %%i in ('mpiexec -help ^| findstr Version') do (
|
||||
if "%%i" == "Microsoft" (
|
||||
set MPI_NAME="Microsoft MPI"
|
||||
for /f "tokens=6 delims=] " %%i in ('mpiexec -help ^| findstr Version') do set MPI_VERSION="%%i"
|
||||
) else if "%%i" == "Intel" (
|
||||
set MPI_NAME="Intel MPI"
|
||||
for /f "tokens=8 delims= " %%i in ('mpiexec -help ^| findstr Version') do set MPI_VERSION="%%i"
|
||||
)
|
||||
)
|
||||
)
|
||||
echo #define _MPI_NAME_ %MPI_NAME% >> buildinfo.h$$
|
||||
echo #define _MPI_VERSION_ %MPI_VERSION% >> buildinfo.h$$
|
||||
|
||||
echo #endif >> buildinfo.h$$
|
||||
|
||||
::: update file only if it changed (otherwise CNTK.cpp will get rebuilt each time)
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
# BUILDER (user under which the build was done)
|
||||
# BUILDMACHINE (build machine)
|
||||
# BUILDPATH (build path)
|
||||
# MPI_NAME (mpi distribution)
|
||||
# MPI_VERSION (mpi version)
|
||||
|
||||
usage ()
|
||||
{
|
||||
|
@ -142,15 +144,17 @@ if [ "$MATHLIB" = "mkl" -a "$MKL_THREADING" = "sequential" ]; then
|
|||
fi
|
||||
|
||||
# MPI info
|
||||
which ompi_info > /dev/null &&
|
||||
{
|
||||
MPI_NAME=openmpi
|
||||
MPI_VERSION=`ompi_info --parsable | grep ident | cut -f 2 -d ":"`
|
||||
} ||
|
||||
{
|
||||
MPI_NAME=mvapich2
|
||||
MPI_VERSION=`mpiname -v`
|
||||
}
|
||||
MPI_NAME=Unknown
|
||||
MPI_VERSION=Unknown
|
||||
if hash ${MPI_PATH}/bin/mpirun 2>/dev/null; then
|
||||
if [ -e ${MPI_PATH}/bin/ompi_info ]; then
|
||||
MPI_NAME="Open MPI"
|
||||
MPI_VERSION=`${MPI_PATH}/bin/ompi_info --parsable | grep ident | cut -f 2 -d ":"`
|
||||
elif [ -e ${MPI_PATH}/bin/mpirun_rsh ]; then
|
||||
MPI_NAME=`${MPI_PATH}/bin/mpiname`
|
||||
MPI_VERSION=`${MPI_PATH}/bin/mpiname -v`
|
||||
fi
|
||||
fi
|
||||
|
||||
# Build machine info
|
||||
BUILDER=$USER
|
||||
|
|
|
@ -41,6 +41,10 @@ boost_check=include/boost/test/unit_test.hpp
|
|||
protobuf_path=
|
||||
protobuf_check=lib/libprotobuf.a
|
||||
|
||||
# MPI library
|
||||
mpi_path=
|
||||
mpi_check=include/mpi.h
|
||||
|
||||
have_kaldi=no
|
||||
kaldi_path=
|
||||
kaldi_check=src/kaldi.mk
|
||||
|
@ -113,6 +117,7 @@ default_opencvs="opencv-3.1.0 opencv-3.0.0"
|
|||
default_protobuf="protobuf-3.1.0"
|
||||
default_libzips="libzip-1.1.2"
|
||||
default_swig="swig-3.0.10"
|
||||
default_mpi="mpi"
|
||||
|
||||
function default_paths ()
|
||||
{
|
||||
|
@ -215,6 +220,11 @@ function find_libzip ()
|
|||
find_dir "$default_libzips" "$libzip_check"
|
||||
}
|
||||
|
||||
function find_mpi ()
|
||||
{
|
||||
find_dir "$default_mpi" "$mpi_check"
|
||||
}
|
||||
|
||||
function is_hardlinked ()
|
||||
{
|
||||
r=no
|
||||
|
@ -348,6 +358,7 @@ function show_help ()
|
|||
echo " --with-py34-path[=directory] $(show_default $(find_python 34))"
|
||||
echo " --with-py35-path[=directory] $(show_default $(find_python 35))"
|
||||
echo " --with-swig[=directory] $(show_default $(find_swig))"
|
||||
echo " --with-mpi[=directory] $(show_default $(find_mpi))"
|
||||
|
||||
echo "Libraries search path:"
|
||||
for head in $(default_paths)
|
||||
|
@ -802,6 +813,25 @@ do
|
|||
fi
|
||||
fi
|
||||
;;
|
||||
--with-mpi*)
|
||||
if test x$optarg = x
|
||||
then
|
||||
mpi_path=$(find_mpi)
|
||||
if test x$mpi_path = x
|
||||
then
|
||||
echo "Cannot find mpi directory."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if test $(check_dir $optarg $mpi_check) = yes
|
||||
then
|
||||
mpi_path=$optarg
|
||||
else
|
||||
echo "Invalid mpi directory $optarg"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo Invalid option $key
|
||||
show_help
|
||||
|
@ -1004,6 +1034,20 @@ then
|
|||
fi
|
||||
fi
|
||||
|
||||
if test x$mpi_path = x
|
||||
then
|
||||
mpi_path=$(find_mpi)
|
||||
if test x${mpi_path} = x
|
||||
then
|
||||
echo Cannot locate MPI library. See
|
||||
echo https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-Linux#open-mpi
|
||||
echo for installation instructions.
|
||||
exit 1
|
||||
else
|
||||
echo Found MPI at $mpi_path
|
||||
fi
|
||||
fi
|
||||
|
||||
config=$build_top/Config.make
|
||||
echo Generating $config
|
||||
echo "#Configuration file for cntk" > $config
|
||||
|
@ -1059,6 +1103,9 @@ fi
|
|||
if test x$protobuf_path != x; then
|
||||
echo PROTOBUF_PATH=$protobuf_path >> $config
|
||||
fi
|
||||
if test x$mpi_path != x; then
|
||||
echo MPI_PATH=$mpi_path >> $config
|
||||
fi
|
||||
|
||||
if test $enable_asgd = yes ; then
|
||||
echo CNTK_ENABLE_ASGD=true >> $config
|
||||
|
|
Загрузка…
Ссылка в новой задаче