Browse Source

better handle spaces in mic-configure arguments. Document about using mpicc

Samuel Thibault 9 years ago
parent
commit
d6615ad3db
3 changed files with 65 additions and 28 deletions
  1. 5 3
      configure.ac
  2. 5 0
      doc/doxygen/chapters/18mic_scc_support.doxy
  3. 55 25
      mic-configure

+ 5 - 3
configure.ac

@@ -1118,9 +1118,11 @@ fi
 #                                                                             #
 #                                                                             #
 ###############################################################################
 ###############################################################################
 
 
-# ignore --enable-native-mic, only meant for mic-configure, but also passed
-# here.
-AC_ARG_ENABLE(native-mic, , , )
+# ignore these otions, only meant for mic-configure, but also passed here.
+AC_ARG_ENABLE(native-mic)
+AC_ARG_WITH(compiler)
+AC_ARG_WITH(mic-param)
+AC_ARG_WITH(host-param)
 
 
 AC_MSG_CHECKING(maximum number of MIC devices)
 AC_MSG_CHECKING(maximum number of MIC devices)
 AC_ARG_ENABLE(maxmicdev, [AS_HELP_STRING([--enable-maxmicdev=<number>],
 AC_ARG_ENABLE(maxmicdev, [AS_HELP_STRING([--enable-maxmicdev=<number>],

+ 5 - 0
doc/doxygen/chapters/18mic_scc_support.doxy

@@ -29,6 +29,11 @@ One can also run StarPU just natively on the Xeon Phi, i.e. it will only run
 directly on the Phi without any exchange with the host CPU. The binaries in
 directly on the Phi without any exchange with the host CPU. The binaries in
 <c>build_mic</c> can be run that way.
 <c>build_mic</c> can be run that way.
 
 
+For MPI support, you will probably have to specify different MPI compiler path
+or option for the host and the device builds, for instance:
+
+<c>./mic-configure --with-mic-param=--with-mpicc="/.../mpiicc -mmic" --with-mic-param=--with-mpicc=/.../mpiicc</c>
+
 In case you have troubles with the coi or scif libraries (the Intel paths are
 In case you have troubles with the coi or scif libraries (the Intel paths are
 really not standard, it seems...), you can still make a build in native mode
 really not standard, it seems...), you can still make a build in native mode
 only, by using <c>mic-configure --enable-native-mic</c> (and notably without
 only, by using <c>mic-configure --enable-native-mic</c> (and notably without

+ 55 - 25
mic-configure

@@ -12,8 +12,10 @@ prefix="/usr/local"
 coi_dir="/opt/intel/mic/coi"
 coi_dir="/opt/intel/mic/coi"
 scif_dir="/opt/intel/mic/scif"
 scif_dir="/opt/intel/mic/scif"
 mic_host="x86_64-k1om-linux"
 mic_host="x86_64-k1om-linux"
-host_params=""
-mic_params=""
+declare -a host_params
+declare -a mic_params
+unset host_params
+unset mic_params
 native_mic=0
 native_mic=0
 for arg in "$@"
 for arg in "$@"
 do
 do
@@ -33,32 +35,59 @@ do
 	        --enable-native-mic)
 	        --enable-native-mic)
 		        native_mic=1
 		        native_mic=1
 		        ;;
 		        ;;
+		--with-compiler=*)
+			compiler="${arg#--with-compiler=}"
+			;;
 		--with-mic-param=*)
 		--with-mic-param=*)
-			mic_params="$mic_params ${arg#--with-mic-param=}"
+			mic_params+=("${arg#--with-mic-param=}")
 			;;
 			;;
 		--with-host-param=*)
 		--with-host-param=*)
-			host_params="$host_params ${arg#--with-host-param=}"
+			host_params+=("${arg#--with-host-param=}")
+			;;
+		--help)
+			cat << EOF
+mic-configure specific options:
+
+  --with-coi-dir=DIR	Specify directory that contains
+			device-linux-release/lib/libcoi_device and 
+			host-linux-release/lib/libcoi_host and 
+  --with-scif-dir=DIR	Specify directory that contains
+			device-linux-release/lib/libscif_device and 
+			host-linux-release/lib/libscif_host and 
+  --mic-host=HOST	Specify the precise Phi host to build for
+			(default: k1om)
+  --with-compiler=[icc|gcc]
+			Specify whether to build with icc or with gcc
+  --enable-native-mic	Only build the Phi binaries
+  --with-mic-param=--OPTION
+			Pass --OPTION to the Phi configure script
+  --with-host-param=--OPTION
+			Pass --OPTION to the host configure script
+EOF
 			;;
 			;;
 	esac
 	esac
 done
 done
 
 
-# Test gcc compiler
-x=$(type -t ${mic_host}-gcc)
-if [ -z "$x" ]
+if [ -z "$compiler" ]
 then
 then
-    # Test icc compiler
-    echo "int main(int argc, char **argv) { return 0; }" > /tmp/icc_$USER_$$.c
-    icc -mmic /tmp/icc_$USER_$$.c > /dev/null 2>/tmp/icc_$USER_$$.err
-    l=$(grep -c "invalid argument" /tmp/icc_$USER_$$.err)
-    if [ "$l" != "0" ]
+    # Test gcc compiler
+    x=$(type -t ${mic_host}-gcc)
+    if [ -z "$x" ]
     then
     then
-        echo "[error] no compiler found. please add path to either ${mic_host}-gcc or to an enabled mic icc compiler in your PATH"
-	exit 1
+	# Test icc compiler
+	echo "int main(int argc, char **argv) { return 0; }" > /tmp/icc_$USER_$$.c
+	icc -mmic /tmp/icc_$USER_$$.c > /dev/null 2>/tmp/icc_$USER_$$.err
+	l=$(grep -c "invalid argument" /tmp/icc_$USER_$$.err)
+	if [ "$l" != "0" ]
+	then
+	    echo "[error] no compiler found. please add path to either ${mic_host}-gcc or to an enabled mic icc compiler in your PATH"
+	    exit 1
+	else
+	    compiler="icc"
+	fi
     else
     else
-	compiler="icc"
+	compiler="gcc"
     fi
     fi
-else
-    compiler="gcc"
 fi
 fi
 
 
 dev_list="host mic"
 dev_list="host mic"
@@ -96,23 +125,24 @@ do
 		fi
 		fi
 	fi
 	fi
 
 
-	params="--prefix=$prefix/$arch"
+	declare -a params
+	params=("--prefix=$prefix/$arch")
 
 
 	if [ "$native_mic" -eq "0" ]
 	if [ "$native_mic" -eq "0" ]
 	then
 	then
-	    params="$params --enable-mic --with-coi-dir=$coi_dir --with-scif-dir=$scif_dir"
+		params+=(--enable-mic "--with-coi-dir=$coi_dir" "--with-scif-dir=$scif_dir")
 	fi
 	fi
 
 
 	if test x$arch = xmic ; then
 	if test x$arch = xmic ; then
-	    params="$params --disable-build-doc --host=$mic_host"
+	    params+=(--disable-build-doc --host=$mic_host)
 	    if [ "$native_mic" -eq "1" ]
 	    if [ "$native_mic" -eq "1" ]
 	    then
 	    then
-		params="$params --enable-maxcpus=250"
+		params+=(--enable-maxcpus=250)
 	    else
 	    else
-		params="$params --with-coi-lib-dir=$coi_dir/device-linux-release/lib --with-scif-lib-dir=$scif_dir/device-linux-release/lib"
+		params+=("--with-coi-lib-dir=$coi_dir/device-linux-release/lib" "--with-scif-lib-dir=$scif_dir/device-linux-release/lib")
 	    fi
 	    fi
 	else
 	else
-		params="$params --with-coi-lib-dir=$coi_dir/host-linux-release/lib --with-scif-lib-dir=$scif_dir/host-linux-release/lib"
+	    params+=("--with-coi-lib-dir=$coi_dir/host-linux-release/lib" "--with-scif-lib-dir=$scif_dir/host-linux-release/lib")
 	fi
 	fi
 
 
 	# If the build directory doesn't exist yet, create it
 	# If the build directory doesn't exist yet, create it
@@ -128,9 +158,9 @@ do
 		C_INCLUDE_PATH=$SINK_C_INCLUDE_PATH \
 		C_INCLUDE_PATH=$SINK_C_INCLUDE_PATH \
 		CPLUS_INCLUDE_PATH=$SINK_CPLUS_INCLUDE_PATH \
 		CPLUS_INCLUDE_PATH=$SINK_CPLUS_INCLUDE_PATH \
 		PKG_CONFIG_PATH=$SINK_PKG_CONFIG_PATH \
 		PKG_CONFIG_PATH=$SINK_PKG_CONFIG_PATH \
-		$command "$@" $params $mic_params
+		$command "$@" "${params[@]}" "${mic_params[@]}"
 	else
 	else
-		$command "$@" $params $host_params
+		$command "$@" "${params[@]}""${host_params[@]}"
 	fi
 	fi
 	if [ "$?" != 0 ]
 	if [ "$?" != 0 ]
 	then
 	then