Переглянути джерело

fixes for mic native (option --enable-native-mic)

Andra Hugo 11 роки тому
батько
коміт
45e9e7dbfc
3 змінених файлів з 48 додано та 7 видалено
  1. 41 4
      mic-configure
  2. 6 2
      src/core/tree.c
  3. 1 1
      src/worker_collection/worker_tree.c

+ 41 - 4
mic-configure

@@ -12,7 +12,7 @@ prefix="/usr/local"
 coi_dir="/opt/intel/mic/coi"
 scif_dir="/opt/intel/mic/scif"
 mic_host="x86_64-k1om-linux"
-
+native_mic=0
 for arg in $*
 do
 	case $arg in
@@ -28,6 +28,9 @@ do
 		--mic-host=*)
 			mic_host="${arg#--mic-host=}"
 			;;
+	        --enable-native-mic)
+		        native_mic=1
+		        ;;
 	esac
 done
 
@@ -50,7 +53,13 @@ else
     compiler="gcc"
 fi
 
-for arch in host mic
+dev_list="host mic"
+if [ "$native_mic" -eq "1" ]
+then
+    dev_list="mic"
+fi
+
+for arch in $dev_list #host mic
 do
 	# We call the configure script from a build directory further in the
 	# arborescence
@@ -65,11 +74,16 @@ do
 	    export CXX="icc -mmic"
 	fi
 
-	params="--enable-mic --with-coi-dir=$coi_dir --with-scif-dir=$scif_dir --prefix=$prefix/$arch"
+	params="--with-coi-dir=$coi_dir --with-scif-dir=$scif_dir --prefix=$prefix/$arch"
 
 	if test x$arch = xmic ; then
+	    if [ "$native_mic" -eq "1" ]
+	    then
+		params="$params --disable-build-doc --with-coi-lib-dir=$coi_dir/device-linux-release/lib --with-scif-lib-dir=$scif_dir/device-linux-release/lib --host=$mic_host"
+	    else
 		# TODO: fix hwloc detection to look for another pkg-config place, and not just believe in the host version of hwloc.pc...
-		params="$params --disable-build-doc -without-hwloc --with-coi-lib-dir=$coi_dir/device-linux-release/lib --with-scif-lib-dir=$scif_dir/device-linux-release/lib --host=$mic_host"
+		params="$params --enable-mic --disable-build-doc -without-hwloc --with-coi-lib-dir=$coi_dir/device-linux-release/lib --with-scif-lib-dir=$scif_dir/device-linux-release/lib --host=$mic_host"
+	    fi
 	else
 		params="$params --with-coi-lib-dir=$coi_dir/host-linux-release/lib --with-scif-lib-dir=$scif_dir/host-linux-release/lib"
 	fi
@@ -92,7 +106,29 @@ do
 	fi
 	cd ..
 done
+if [ "$native_mic" -eq "1" ]
+then
+cat > Makefile << EOF
+all:
+	\$(MAKE) -C build_mic
+
+clean:
+	\$(MAKE) -C build_mic clean
 
+distclean: clean
+	rm -f Makefile
+
+check:
+	\$(MAKE) -C build_mic check
+
+showcheck:
+	\$(MAKE) -C build_mic showcheck
+
+install:
+	\$(MAKE) -C build_mic install
+	ln -sf "${prefix}/mic/lib/pkgconfig/starpu-1.2.pc" "${prefix}/mic/lib/pkgconfig/starpu-1.2-mic.pc"
+EOF
+else
 cat > Makefile << EOF
 all:
 	\$(MAKE) -C build_host
@@ -118,3 +154,4 @@ install:
 	\$(MAKE) -C build_mic install
 	ln -sf "${prefix}/mic/lib/pkgconfig/starpu-1.2.pc" "${prefix}/mic/lib/pkgconfig/starpu-1.2-mic.pc"
 EOF
+fi

+ 6 - 2
src/core/tree.c

@@ -70,7 +70,9 @@ struct starpu_tree* _get_down_to_leaves(struct starpu_tree *node, int *visited,
 	{
 		if(node->nodes[i]->arity == 0)
 		{
-			if(!visited[node->nodes[i]->id] && present[node->nodes[i]->id] && node->nodes[i]->is_pu)
+			/* if it is a valid workerid (bindids can exist on the machine but they may not be used by StarPU) */
+			if(node->nodes[i]->is_pu && _starpu_worker_get_workerid(node->nodes[i]->id) != -1 &&
+			   !visited[node->nodes[i]->id] && present[node->nodes[i]->id] )
 				return node->nodes[i];
 		}
 		else
@@ -94,7 +96,9 @@ struct starpu_tree* starpu_tree_get_neighbour(struct starpu_tree *tree, struct s
 		{
 			if(father->nodes[i]->arity == 0)
 			{
-				if(!visited[father->nodes[i]->id] && present[father->nodes[i]->id] && father->nodes[i]->is_pu)
+				/* if it is a valid workerid (bindids can exist on the machine but they may not be used by StarPU) */
+				if(father->nodes[i]->is_pu && _starpu_worker_get_workerid(father->nodes[i]->id) != -1 &&
+				   !visited[father->nodes[i]->id] && present[father->nodes[i]->id])
 					return father->nodes[i];
 			}
 			else

+ 1 - 1
src/worker_collection/worker_tree.c

@@ -41,7 +41,7 @@ static unsigned tree_has_next(struct starpu_worker_collection *workers, struct s
 	it->possible_value = neighbour;
 	int id = _starpu_worker_get_workerid(neighbour->id);
 
-	STARPU_ASSERT_MSG(id != -1, "bind id not correct");
+	STARPU_ASSERT_MSG(id != -1, "bind id (%d) for workerid (%d) not correct", neighbour->id, id);
 
 	return 1;
 }