Przeglądaj źródła

new script starpu_env to set up StarPU environment variables

Nathalie Furmento 5 lat temu
rodzic
commit
f8d6fc7208
4 zmienionych plików z 75 dodań i 0 usunięć
  1. 2 0
      configure.ac
  2. 12 0
      doc/doxygen/chapters/101_building.doxy
  3. 5 0
      tools/Makefile.am
  4. 56 0
      tools/starpu_env.in

+ 2 - 0
configure.ac

@@ -3489,6 +3489,7 @@ AC_CONFIG_COMMANDS([executable-scripts], [
   chmod +x tests/model-checking/starpu-mc.sh
   chmod +x examples/loader-cross.sh
   chmod +x examples/stencil/loader-cross.sh
+  chmod +x tools/starpu_env
   chmod +x tools/starpu_codelet_profile
   chmod +x tools/starpu_codelet_histo_profile
   chmod +x tools/starpu_mpi_comm_matrix.py
@@ -3566,6 +3567,7 @@ AC_OUTPUT([
 	Makefile
 	src/Makefile
 	tools/Makefile
+	tools/starpu_env
 	tools/starpu_codelet_profile
 	tools/starpu_codelet_histo_profile
 	tools/starpu_mpi_comm_matrix.py

+ 12 - 0
doc/doxygen/chapters/101_building.doxy

@@ -219,6 +219,18 @@ $ starpu_machine_display
 If it does not, please check the output of \c lstopo from \c hwloc and report
 the issue to the \c hwloc project, since this is what StarPU uses to detect the hardware.
 
+<br>
+A tool is provided to help setting all the environment variables
+needed by StarPU. If the given directory is a valid StarPU
+installation directory, calling the script <c>bin/starpu_env</c> will
+set in your current environment the variables <c>STARPU_PATH</c>,
+<c>LD_LIBRARY_PATH</c>, <c>PKG_CONFIG_PATH</c>, <c>PATH</c> and
+<c>MANPATH</c>.
+
+\verbatim
+$ source ./bin/starpu_env .
+\endverbatim
+
 \subsection IntegratingStarPUInABuildSystem Integrating StarPU in a Build System
 
 \subsubsection StarPUInMake Integrating StarPU in a Make Build System

+ 5 - 0
tools/Makefile.am

@@ -421,6 +421,7 @@ dist_bin_SCRIPTS +=				\
 	starpu_workers_activity			\
 	starpu_codelet_histo_profile		\
 	starpu_codelet_profile			\
+	starpu_env				\
 	starpu_mpi_comm_matrix.py		\
 	starpu_fxt_number_events_to_names.py	\
 	starpu_paje_draw_histogram		\
@@ -470,6 +471,9 @@ starpu_workers_activity.1: starpu_workers_activity
 starpu_codelet_profile.1: starpu_codelet_profile
 	chmod +x $<
 	help2man --no-discard-stderr -N -n "Draw StarPU codelet profile" --output=$@ ./$<
+starpu_env.1: starpu_env
+	chmod +x $<
+	help2man --no-discard-stderr -N -n "Set StarPU environment variables" --output=$@ ./$<
 starpu_codelet_histo_profile.1: starpu_codelet_histo_profile
 	chmod +x $<
 	help2man --no-discard-stderr -N -n "Draw StarPU codelet histogram" --output=$@ ./$<
@@ -505,6 +509,7 @@ dist_man1_MANS =\
 	starpu_workers_activity.1 \
 	starpu_codelet_profile.1 \
 	starpu_codelet_histo_profile.1 \
+	starpu_env.1 \
 	starpu_mpi_comm_matrix.1 \
 	starpu_fxt_number_events_to_names.1 \
 	starpu_paje_draw_histogram.1 \

+ 56 - 0
tools/starpu_env.in

@@ -0,0 +1,56 @@
+# StarPU --- Runtime system for heterogeneous multicore architectures.
+#
+# Copyright (C) 2020  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+#
+# StarPU is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# StarPU is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# See the GNU Lesser General Public License in COPYING.LGPL for more details.
+#
+
+PROGNAME=starpu_env
+
+usage()
+{
+    echo "Tool to set StarPU environment variables"
+    echo ""
+    echo "Usage: source $PROGNAME directory"
+    echo ""
+    echo "      directory must be a directory in which StarPU has been installed"
+    echo ""
+    echo "Options:"
+    echo "	-h, --help          display this help and exit"
+    echo "	-v, --version       output version information and exit"
+    echo ""
+    echo "Report bugs to <@PACKAGE_BUGREPORT@>"
+}
+
+if [ "$1" = "-v" ] || [ "$1" = "--version" ]
+then
+    echo "$PROGNAME (@PACKAGE_NAME@) @PACKAGE_VERSION@"
+elif [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "" ]
+then
+    usage
+elif test -d "$1"
+then
+    if test -f $1/bin/starpu_machine_display -a -f $1/lib/pkgconfig/libstarpu.pc
+    then
+	export STARPU_PATH=$(realpath $1)
+	echo "Setting StarPU environment for $STARPU_PATH"
+	export PKG_CONFIG_PATH=$STARPU_PATH/lib/pkgconfig:$PKG_CONFIG_PATH
+	export LD_LIBRARY_PATH=$STARPU_PATH/lib:$LD_LIBRARY_PATH
+	export PATH=$STARPU_PATH/bin:$PATH
+	export MANPATH=$STARPU_PATH/share/man:$MANPATH
+    else
+	echo "[Error] $1 is not a valid StarPU installation directory"
+    fi
+else
+    usage
+fi
+