Pārlūkot izejas kodu

Merge trunk up to 6400

Samuel Thibault 13 gadi atpakaļ
vecāks
revīzija
4c3eeaddb8

+ 1 - 0
.gitignore

@@ -285,3 +285,4 @@ starpu.log
 /tests/main/wait_all_regenerable_tasks
 /tools/starpu_workers_activity
 /tests/datawizard/interfaces/copy_interfaces
+/gcc-plugin/tests/release

+ 200 - 0
INSTALL

@@ -0,0 +1,200 @@
+# StarPU --- Runtime system for heterogeneous multicore architectures.
+#
+# Copyright (C) 2009-2012  Université de Bordeaux 1
+# Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+#
+# 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.
+
+Contents
+=========
+
+* Installing StarPU on a Unix machine
+* Installing StarPU on Windows
+
+
+
+Installing StarPU on a Unix machine
+------------------------------------
+$ ./autogen.sh # If running the SVN version
+$ ./configure --prefix=<prefix>
+$ make
+$ make install
+
+
+
+Installing StarPU on Windows
+----------------------------
+
+If you are building from a tarball downloaded from the website, you can skip the
+cygwin part.
+
+1. Install cygwin
+
+http://cygwin.com/install.html
+
+Make sure the following packages are available:
+- (Devel)/subversion
+- (Devel)/libtool
+- (Devel)/gcc
+- (Devel)/make
+- your favorite editor (vi, emacs, ...)
+- (Devel)/gdb
+- (Archive)/zip
+- (Devel)/pkg-config
+
+2. Install mingw
+
+http://sourceforge.net/projects/mingw/
+
+3. Install hwloc (not mandatory, but strongly recommended)
+
+http://www.open-mpi.org/projects/hwloc
+
+4. Install Microsoft Visual C++ Studio Express
+
+   http://www.microsoft.com/express/Downloads
+
+   Add in your path the following directories.
+   (adjusting where necessary for the Installation location according to VC
+    version and on 64 and 32bit Windows versions)
+
+   On cygwin, with Visual C++ 2010 e.g.;
+
+   export PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE":$PATH
+   export PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin":$PATH
+
+   On MingW, with Visual C++ 2010, e.g.;
+
+   export PATH="/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE":$PATH
+   export PATH="/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin":$PATH
+
+   Try to call <cl.exe>, <lib.exe> and <link.exe> without any option to make
+   sure these dump their help output with a series of options, otherwise no
+   .def or .lib file will be produced.
+
+5. Install GPU Drivers (not mandatory)
+
+  5.1 Install Cuda
+
+      http://developer.nvidia.com/object/cuda_3_2_downloads.html
+
+      You need to install at least the CUDA toolkit.
+
+      libtool is not able to find the libraries automatically, you
+      need to make some copies:
+
+      copy c:\cuda\lib\cuda.lib c:\cuda\lib\libcuda.lib
+      copy c:\cuda\lib\cudart.lib c:\cuda\lib\libcudart.lib
+      copy c:\cuda\lib\cublas.lib c:\cuda\lib\libcublas.lib
+      copy c:\cuda\lib\cufft.lib c:\cuda\lib\libcufft.lib
+      copy c:\cuda\lib\OpenCL.lib c:\cuda\lib\libOpenCL.lib
+
+      (and if the version of your CUDA driver is >= 3.2)
+
+      copy c:\cuda\lib\curand.lib c:\cuda\lib\libcurand.lib
+
+      Add the CUDA bin directory in your path
+
+      export PATH=/cygdrive/c/CUDA/bin:$PATH
+
+      Since we build code using CUDA headers with gcc instead of Visual studio,
+      a fix is needed: c:\cuda\include\host_defines.h has a bogus CUDARTAPI
+      definition which makes linking fail completely. Replace the first
+      occurence of
+
+      #define CUDARTAPI
+
+      with
+
+      #ifdef _WIN32
+      #define CUDARTAPI __stdcall
+      #else
+      #define CUDARTAPI
+      #endif
+
+      While at it, you can also comment the __cdecl definition to avoid spurious
+      warnings.
+
+
+  5.2 Install OpenCL
+
+      http://developer.nvidia.com/object/opencl-download.html
+
+      You need to download the NVIDIA Drivers for your version of
+      Windows. Executing the file will extract all files in a given
+      directory. The the driver installation will start, it will fail
+      if no compatibles drivers can be found on your system.
+
+      Anyway, you should copy the *.dl_ files from the directory
+      (extraction path) in the bin directory of the CUDA installation
+      directory (the directory should be v3.2/bin/)
+
+  5.3 Install MsCompress
+
+      http://gnuwin32.sourceforge.net/packages/mscompress.htm
+
+      Go in the CUDA bin directory, uncompress .dl_ files and rename
+      them in .dll files
+
+      cp /cygdrive/c/NVIDIA/DisplayDriver/190.89/International/*.dl_ .
+      for i in *.dl_ ; do /cygdrive/c/Program\ Files/GnuWin32/bin/msexpand.exe  $i ; mv ${i%_} ${i%_}l ; done
+
+If you are building from a tarball downloaded from the website, you can skip the
+autogen.sh part.
+
+6. Start autogen.sh from cygwin
+
+   cd starpu-trunk
+   ./autogen.sh
+
+7. Start a MinGW shell
+
+   /cygdrive/c/MinGW/msys/1.0/bin/sh.exe --login -i
+
+8. Configure, make, install from MinGW
+
+   If you have a non-english version of windows, use
+
+     export LANG=C
+
+   else libtool has troubles parsing the translated output of the toolchain.
+
+   cd starpu-trunk
+   mkdir build
+   cd build
+   ../configure --prefix=$PWD/target \
+        --with-hwloc=<HWLOC installation directory> \
+        --with-cuda-dir=<CUDA installation directory> \
+        --with-cuda-lib-dir=<CUDA installation directory>/lib/Win32 \
+	--with-opencl-dir=<CUDA installation directory>
+   make
+   make install
+
+   Also convert a couple of files to CRLF:
+
+   sed -e 's/$/'$'\015'/ < README > $prefix/README.txt
+   sed -e 's/$/'$'\015'/ < AUTHORS > $prefix/AUTHORS.txt
+   sed -e 's/$/'$'\015'/ < COPYING.LGPL > $prefix/COPYING.LGPL.txt
+
+9. If you want your StarPU installation to be standalone, you need to
+   copy the DLL files from hwloc, Cuda, and OpenCL into the StarPU
+   installation bin directory, as well as MinGW/bin/libpthread*dll
+
+   cp <CUDA directory>/bin/*dll target/bin
+   cp <HWLOC directory>/bin/*dll target/bin
+   cp /cygdrive/c/MinGW/bin/libpthread*dll target/bin
+
+   and set the StarPU bin directory in your path.
+
+   export PATH=<StarPU installation directory>/bin:$PATH
+
+

+ 1 - 2
README

@@ -124,8 +124,7 @@ Update the video drivers to the latest stable release available for your
 hardware. Old ATI drivers (< 2.3) contain bugs that cause OpenCL support in
 StarPU to hang or exhibit incorrect behaviour.
 
-For details on the Windows build process, see the README.dev file in the
-subversion tree.
+For details on the Windows build process, see the INSTALL file.
 
 ++==================++
 || V. Documentation ||

+ 102 - 115
configure.ac

@@ -317,74 +317,62 @@ AC_ARG_WITH(cuda-lib-dir,
 		enable_cuda=yes
 	], [cuda_lib_dir=no])
 
-AC_DEFUN([STARPU_CHECK_CUDA],
+AC_DEFUN([STARPU_CHECK_CUDA_L],
 [
-    __cuda_dir=$1
-    __cuda_lib_dir=$2
-
-    if test "$__cuda_dir" != "no" ; then
-	AC_MSG_CHECKING(whether CUDA is available in $__cuda_dir)
-    else
-	AC_MSG_CHECKING(whether CUDA is available)
-    fi
-    AC_MSG_RESULT()
-
-    if test "$__cuda_lib_dir" = "no" -a "$__cuda_dir" != "no" ; then
-        __cuda_lib_dir="$__cuda_dir/lib"
-    fi
-
+    __cuda_L=$1
     SAVED_LDFLAGS="${LDFLAGS}"
-
-    if test "$__cuda_dir" != "no" ; then
-	STARPU_CUDA_LDFLAGS="-L${__cuda_lib_dir}"
-	LDFLAGS="${SAVED_LDFLAGS} -L${__cuda_lib_dir}"
-    fi
-
+    STARPU_CUDA_LDFLAGS="${__cuda_L}"
+    AC_MSG_CHECKING(whether CUDA is available with: $__cuda_L)
+    AC_MSG_RESULT()
+    LDFLAGS="${SAVED_LDFLAGS} ${__cuda_L}"
     AC_HAVE_LIBRARY([cuda],[have_valid_cuda=yes],[have_valid_cuda=no])
     unset ac_cv_lib_cuda_main
-
-    if test "$have_valid_cuda" = "no" ; then
-        if test "$__cuda_dir" != "no" ; then
-	    STARPU_CUDA_LDFLAGS="-L${__cuda_dir}/lib64"
-	    LDFLAGS="${SAVED_LDFLAGS} -L${__cuda_dir}/lib64"
-	    AC_HAVE_LIBRARY([cuda],[have_valid_cuda=yes],[have_valid_cuda=no])
-            unset ac_cv_lib_cuda_main
-        fi
-    fi
-
-    if test "$have_valid_cuda" = "no" ; then
-        LDFLAGS="${SAVED_LDFLAGS}"
-	unset STARPU_CUDA_LDFLAGS
+    if test "$have_valid_cuda" = "yes" ; then
+	AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
+	unset ac_cv_lib_cudart_main
+	if test "$have_valid_cuda" = yes ; then
+	    STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcudart"
+	    LDFLAGS="${SAVED_LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
+	    # we also check that CUBLAS is available
+	    AC_HAVE_LIBRARY([cublas],[have_valid_cuda=yes],[have_valid_cuda=no])
+	    unset ac_cv_lib_cublas_main
+	    if test "$have_valid_cuda" = "yes" ; then
+		STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcublas"
+	    fi
+	fi
     fi
+    LDFLAGS="${SAVED_LDFLAGS}"
 ])
-
-AC_DEFUN([STARPU_CHECK_CUDA_RUNTIME],
+AC_DEFUN([STARPU_CHECK_CUDA],
 [
     __cuda_dir=$1
     __cuda_include_dir=$2
     __cuda_lib_dir=$3
 
-    if test "$__cuda_dir" != "no" -a "$__cuda_dir" != "" ; then
-	AC_MSG_CHECKING(whether CUDA RT is available in $__cuda_dir)
+    if test -z "$__cuda_lib_dir" ; then
+	__cuda_lib_dir=no
+    fi
+    if test -z "$__cuda_include_dir" ; then
+	__cuda_include_dir=no
+    fi
+    if test -z "$__cuda_dir" ; then
+	__cuda_dir=no
+    fi
+
+    if test "$__cuda_dir" != "no" ; then
+	AC_MSG_CHECKING(whether CUDA is available in $__cuda_dir, $__cuda_include_dir and $__cuda_lib_dir)
     else
-	AC_MSG_CHECKING(whether CUDA RT is available)
+	AC_MSG_CHECKING(whether CUDA is available)
     fi
     AC_MSG_RESULT()
 
     if test "$__cuda_include_dir" = "no" -a "$__cuda_dir" != "no" ; then
         __cuda_include_dir="$__cuda_dir/include"
     fi
-    if test "$__cuda_lib_dir" = "no" -a "$__cuda_dir" != "no" ; then
-        __cuda_lib_dir="$__cuda_dir/lib"
-    fi
 
     SAVED_CPPFLAGS="$CPPFLAGS"
-    SAVED_LDFLAGS="${LDFLAGS}"
-    SAVED_STARPU_CUDA_LDFLAGS=${STARPU_CUDA_LDFLAGS}
+    have_valid_cuda=no
 
-    if test "$__cuda_lib_dir" != "no" ; then
-	STARPU_CUDA_LDFLAGS="${SAVED_STARPU_CUDA_LDFLAGS} -L$__cuda_lib_dir"
-    fi
     if test "$__cuda_include_dir" != "no" ; then
         CPPFLAGS="${CPPFLAGS} -I$__cuda_include_dir"
     fi
@@ -393,63 +381,47 @@ AC_DEFUN([STARPU_CHECK_CUDA_RUNTIME],
     unset ac_cv_header_cuda_h
 
     if test "$have_valid_cuda" = "yes" ; then
-	if test "$__cuda_lib_dir" != "no"; then
-	    LDFLAGS="${SAVED_LDFLAGS} -L$__cuda_lib_dir"
-        fi
-	AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
-        unset ac_cv_lib_cudart_main
-        if test "$have_valid_cuda" = "no" ; then
-            if test "$3" = "no" -a "$__cuda_dir" != "no" ; then
-                __cuda_lib_dir="$__cuda_dir/lib64"
-		LDFLAGS="${SAVED_LDFLAGS} -L$__cuda_lib_dir"
-	        STARPU_CUDA_LDFLAGS="${SAVED_STARPU_CUDA_LDFLAGS} -L$__cuda_lib_dir"
-	        AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
-                unset ac_cv_lib_cudart_main
-            fi
-        fi
-    fi
-
-    if test "$have_valid_cuda" = "yes" ; then
-        STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcudart"
-	LDFLAGS="${SAVED_LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
-	# we also check that CUBLAS is available
-	AC_HAVE_LIBRARY([cublas],[have_valid_cuda=yes],[have_valid_cuda=no])
-        unset ac_cv_lib_cublas_main
-        if test "$have_valid_cuda" = "yes" ; then
-            STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcublas"
-        fi
+	if test "$__cuda_lib_dir" != "no" ; then
+	    STARPU_CHECK_CUDA_L("-L${__cuda_lib_dir}")
+	else
+	    if test "$__cuda_dir" != "no" ; then
+		for __cuda_libdir in lib64 lib lib/x64 lib/Win32 ; do
+		    STARPU_CHECK_CUDA_L("-L${__cuda_dir}/${__cuda_libdir}")
+		    if test "$have_valid_cuda" = yes ; then
+			break
+		    fi
+		done
+	    else
+		STARPU_CHECK_CUDA_L("")
+	    fi
+	fi
     fi
 
-    CPPFLAGS="${SAVED_CPPFLAGS}"
-    LDFLAGS="${SAVED_LDFLAGS}"
-
-    if test "$have_valid_cuda" = "yes" -a "$__cuda_include_dir" != "no"; then
-        STARPU_CUDA_CPPFLAGS="-I$__cuda_include_dir"
-	NVCCFLAGS="${NVCCFLAGS} -I$__cuda_include_dir"
+    if test "$have_valid_cuda" = "no" ; then
+	CPPFLAGS="${SAVED_CPPFLAGS}"
+	unset STARPU_CUDA_LDFLAGS
+    else
+	if test "$__cuda_include_dir" != "no"; then
+	    STARPU_CUDA_CPPFLAGS="-I$__cuda_include_dir"
+	    NVCCFLAGS="${NVCCFLAGS} -I$__cuda_include_dir"
+	fi
     fi
 ])
 
 if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
-    STARPU_CHECK_CUDA($cuda_dir, $cuda_lib_dir)
+    STARPU_CHECK_CUDA("$cuda_dir", "$cuda_include_dir", "$cuda_lib_dir")
     if test "$have_valid_cuda" = "no" ; then
-        for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" "$CUDA_INC_PATH/.." "$CUDA_INSTALL_PATH" "$CUDA_TOOLKIT"; do
-            STARPU_CHECK_CUDA($f, "no")
-            if test "$have_valid_cuda" = "yes" ; then
-                break
-            fi
-        done
+	STARPU_CHECK_CUDA("$CUDA_PATH", "$CUDA_INC_PATH", "$CUDA_LIB_PATH")
     fi
-
-    if test "$have_valid_cuda" = "yes" ; then
-        STARPU_CHECK_CUDA_RUNTIME($cuda_dir, $cuda_include_dir, $cuda_lib_dir)
-        if test "$have_valid_cuda" = "no" ; then
-            for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" "$CUDA_INC_PATH/.." "$CUDA_INSTALL_PATH" "$CUDA_TOOLKIT"; do
-                STARPU_CHECK_CUDA_RUNTIME($f, "no", "no")
-                if test "$have_valid_cuda" = "yes" ; then
-                    break
-                fi
-            done
-        fi
+    if test "$have_valid_cuda" = "no" ; then
+	for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" "$CUDA_PATH" "$CUDA_INC_PATH/.." "$CUDA_INSTALL_PATH" "$CUDA_TOOLKIT"; do
+	    if test -n "$f" ; then
+		STARPU_CHECK_CUDA("$f", "no", "no")
+		if test "$have_valid_cuda" = "yes" ; then
+		    break
+		fi
+	    fi
+	done
     fi
 
     # Check cuda is compatible with the C compiler
@@ -595,7 +567,7 @@ AC_DEFUN([STARPU_CHECK_OPENCL],
     __opencl_lib_dir=$3
 
     if test "$__opencl_dir" != "no" ; then
-	AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir)
+	AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir $__opencl_include_dir and $__opencl_lib_dir)
     else
 	AC_MSG_CHECKING(whether OpenCL is available)
     fi
@@ -604,9 +576,6 @@ AC_DEFUN([STARPU_CHECK_OPENCL],
     if test "$__opencl_include_dir" = "no" -a "$__opencl_dir" != "no" ; then
         __opencl_include_dir="$__opencl_dir/include"
     fi
-    if test "$__opencl_lib_dir" = "no" -a "$__opencl_dir" != "no" ; then
-        __opencl_lib_dir="$__opencl_dir/lib"
-    fi
 
     SAVED_CPPFLAGS="$CPPFLAGS"
     SAVED_LDFLAGS="${LDFLAGS}"
@@ -620,16 +589,30 @@ AC_DEFUN([STARPU_CHECK_OPENCL],
     if test "$have_valid_opencl" = "yes" ; then
 	if test "$__opencl_lib_dir" != "no"; then
 	    LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
-        fi
-	AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
-        unset ac_cv_lib_OpenCL_main
-        if test "$have_valid_opencl" = "no" ; then
-            if test "$3" = "no" -a "$__opencl_dir" != "no" ; then
-                __opencl_lib_dir="$__opencl_dir/lib64"
-	        LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
-	        AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
-                unset ac_cv_lib_OpenCL_main
-            fi
+	    AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
+	    unset ac_cv_lib_OpenCL_main
+	else
+	    AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir)
+	    AC_MSG_RESULT()
+	    AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
+	    unset ac_cv_lib_OpenCL_main
+	    if test "$have_valid_opencl" = "no" -a "$__opencl_dir" != "no" ; then
+		for __cuda_libdir in lib64 lib lib/x86 lib/Win32 ; do
+		    __opencl_lib_dir="$__opencl_dir/$__cuda_libdir"
+		    AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir and $__opencl_lib_dir)
+		    AC_MSG_RESULT()
+		    LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
+		    AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
+		    unset ac_cv_lib_OpenCL_main
+		    if test "$have_valid_opencl" = yes ; then
+			break
+		    fi
+		done
+	    else
+		LDFLAGS="${SAVED_LDFLAGS}"
+		AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
+		unset ac_cv_lib_OpenCL_main
+	    fi
         fi
     fi
 
@@ -681,11 +664,11 @@ AC_ARG_WITH(opencl-lib-dir,
 AC_DEFUN([STARPU_LOOK_FOR_OPENCL],
 [
     	if test "x$has_opencl_being_checked" != "xyes" ; then
-    	    STARPU_CHECK_OPENCL($opencl_dir, $opencl_include_dir, $opencl_lib_dir)
+    	    STARPU_CHECK_OPENCL("$opencl_dir", "$opencl_include_dir", "$opencl_lib_dir")
 	    if test "$have_valid_opencl" = "no" ; then
-            	for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" "$CUDA_INC_PATH/.." "$CUDA_INSTALL_PATH" "$CUDA_TOOLKIT"; do
-		    if test -n $f ; then
-    			STARPU_CHECK_OPENCL($f, "no", "no")
+            	for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" "$CUDA_PATH" "$CUDA_INC_PATH/.." "$CUDA_INSTALL_PATH" "$CUDA_TOOLKIT"; do
+		    if test -n "$f" ; then
+    			STARPU_CHECK_OPENCL("$f", "no", "no")
 			if test "$have_valid_opencl" = "yes" ; then
 			    break
 			fi
@@ -1578,9 +1561,12 @@ if test "$enable_cuda" = "yes" -a "$ICC" != ""; then
    AC_MSG_CHECKING(whether CUDA and ICC are compatible)
    OLD_CC="$CC"
    CC="$ICC"
+   OLD_CFLAGS="$CFLAGS"
+   CFLAGS="-I$PWD/include -I$srcdir/include"
    AC_COMPILE_IFELSE(
        AC_LANG_PROGRAM(
-	   [[#include <cuda.h>]],
+	   [[#include <cuda.h>
+	   #include <starpu.h>]],
 	   [[]]
 	   ),
        AC_MSG_RESULT(yes),
@@ -1588,6 +1574,7 @@ if test "$enable_cuda" = "yes" -a "$ICC" != ""; then
            AC_MSG_RESULT(no)]
    )
    CC="$OLD_CC"
+   CFLAGS="$OLD_CFLAGS"
 fi
 
 # Disable ICC on windows

+ 4 - 2
doc/Makefile.am

@@ -59,8 +59,10 @@ uninstall-local:
 #	vector_scal_c.texi vector_scal_cuda.texi vector_scal_opencl.texi vector_scal_opencl_codelet.texi
 
 # Rule to update documentation on web server. Should only be used locally.
-update-web:
-	scp starpu.pdf starpu.html sync:/web/runtime/html/StarPU
+PUBLISHHOST	:= sync
+update-web: starpu.html
+	sed -i 's/gcc\.html#Attribute-Syntax/http:\/\/gcc.gnu.org\/onlinedocs\/gcc\/Attribute-Syntax.html#Attribute-Syntax/' starpu.html
+	scp starpu.pdf starpu.html $(PUBLISHHOST):/web/runtime/html/StarPU
 
 showcheck:
 	-cat /dev/null

+ 8 - 9
doc/chapters/installing.texi

@@ -3,7 +3,7 @@
 @c This file is part of the StarPU Handbook.
 @c Copyright (C) 2009--2011  Universit@'e de Bordeaux 1
 @c Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
-@c Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
+@c Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
 @c See the file starpu.texi for copying conditions.
 
 @menu
@@ -42,8 +42,8 @@ Additionally, the code can be directly checked out of Subversion, it
 should be done only if you need the very latest changes (i.e. less
 than a day!).@footnote{The client side of the software Subversion can
 be obtained from @indicateurl{http://subversion.tigris.org}. If you
-are running on Windows, you will probably prefer to use TortoiseSVN
-from @indicateurl{http://tortoisesvn.tigris.org/}}.
+are running on Windows, you will probably prefer to use
+@url{http://tortoisesvn.tigris.org/, TortoiseSVN}.}.
 
 @example
 % svn checkout svn://scm.gforge.inria.fr/svn/starpu/trunk
@@ -52,12 +52,11 @@ from @indicateurl{http://tortoisesvn.tigris.org/}}.
 @node Optional dependencies
 @subsection Optional dependencies
 
-The topology discovery library, @code{hwloc}, is not mandatory to use StarPU
-but strongly recommended. It allows to increase performance, and to
-perform some topology aware scheduling.
-
-@code{hwloc} is available in major distributions and for most OSes and can be
-downloaded from @indicateurl{http://www.open-mpi.org/software/hwloc}.
+The @url{http://www.open-mpi.org/software/hwloc, @code{hwloc} topology
+discovery library} is not mandatory to use StarPU but strongly
+recommended.  It allows for topology aware scheduling, which improves
+performance.  @code{hwloc} is available in major free operating system
+distributions, and for most operating systems.
 
 @node Configuration of StarPU
 @section Configuration of StarPU

+ 3 - 5
doc/chapters/introduction.texi

@@ -178,9 +178,7 @@ unregister it.
 @subsection Research Papers
 
 Research papers about StarPU can be found at
+@indicateurl{http://runtime.bordeaux.inria.fr/Publis/Keyword/STARPU.html}.
 
-@indicateurl{http://runtime.bordeaux.inria.fr/Publis/Keyword/STARPU.html}
-
-Notably a good overview in the research report
-
-@indicateurl{http://hal.archives-ouvertes.fr/inria-00467677}
+A good overview is available in the research report at
+@indicateurl{http://hal.archives-ouvertes.fr/inria-00467677}.

+ 11 - 6
doc/chapters/perf-feedback.texi

@@ -3,7 +3,7 @@
 @c This file is part of the StarPU Handbook.
 @c Copyright (C) 2009--2011  Universit@'e de Bordeaux 1
 @c Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
-@c Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
+@c Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
 @c See the file starpu.texi for copying conditions.
 
 @menu
@@ -277,15 +277,20 @@ Or alternatively, setting the @code{STARPU_GENERATE_TRACE} environment variable
 to 1 before application execution will make StarPU do it automatically at
 application shutdown.
 
-This will create a @code{paje.trace} file in the current directory that can be
-inspected with the ViTE trace visualizing open-source tool. More information
-about ViTE is available at @indicateurl{http://vite.gforge.inria.fr/}. It is
-possible to open the @code{paje.trace} file with ViTE by using the following
-command:
+This will create a @code{paje.trace} file in the current directory that
+can be inspected with the @url{http://vite.gforge.inria.fr/, ViTE trace
+visualizing open-source tool}.  It is possible to open the
+@code{paje.trace} file with ViTE by using the following command:
 @example
 % vite paje.trace
 @end example
 
+To get names of tasks instead of "unknown", fill the optional @code{name} field
+of the codelets, or use a performance model for them.
+
+By default, all tasks are displayed using a green color. To display tasks with
+varying colors, pass option @code{-c} to @code{starpu_fxt_tool}.
+
 @node DAG
 @subsection Creating a DAG with graphviz
 

+ 1 - 1
examples/filters/custom_mf/custom_interface.c

@@ -56,7 +56,7 @@ static int copy_opencl_to_ram_async(void *src_interface, unsigned src_node,
 				    void *event);
 #endif /* !STARPU_USE_OPENCL */
 
-static const struct starpu_data_copy_methods custom_copy_data_methods_s =
+static struct starpu_data_copy_methods custom_copy_data_methods_s =
 {
 	.ram_to_ram = copy_ram_to_ram,
 	.ram_to_spu = NULL,

+ 45 - 1
gcc-plugin/src/starpu.c

@@ -892,7 +892,7 @@ handle_pragma_acquire (struct cpp_reader *reader)
       error_at (loc, "%qE is neither a pointer nor an array", var);
       return;
     }
-  else if (TREE_CHAIN (var) != NULL_TREE)
+  else if (TREE_CHAIN (args) != NULL_TREE)
     error_at (loc, "junk after %<starpu acquire%> pragma");
 
   /* If VAR is an array, take its address.  */
@@ -908,6 +908,48 @@ handle_pragma_acquire (struct cpp_reader *reader)
 			     build_int_cst (integer_type_node, STARPU_RW)));
 }
 
+/* Process `#pragma starpu release VAR' and emit the corresponding
+   `starpu_data_release' call.  */
+
+static void
+handle_pragma_release (struct cpp_reader *reader)
+{
+  static tree release_fn;
+  LOOKUP_STARPU_FUNCTION (release_fn, "starpu_data_release");
+
+  tree args, var;
+  location_t loc;
+
+  loc = cpp_peek_token (reader, 0)->src_loc;
+
+  args = read_pragma_expressions ("release", loc);
+  if (args == NULL_TREE)
+    return;
+
+  var = TREE_VALUE (args);
+
+  if (var == error_mark_node)
+    return;
+  else if (TREE_CODE (TREE_TYPE (var)) != POINTER_TYPE
+	   && TREE_CODE (TREE_TYPE (var)) != ARRAY_TYPE)
+    {
+      error_at (loc, "%qE is neither a pointer nor an array", var);
+      return;
+    }
+  else if (TREE_CHAIN (args) != NULL_TREE)
+    error_at (loc, "junk after %<starpu release%> pragma");
+
+  /* If VAR is an array, take its address.  */
+  tree pointer =
+    POINTER_TYPE_P (TREE_TYPE (var))
+    ? var
+    : build_addr (var, current_function_decl);
+
+  /* Call `starpu_data_release (starpu_data_lookup (ptr))'.  */
+  add_stmt (build_call_expr (release_fn, 1,
+			     build_pointer_lookup (pointer)));
+}
+
 /* Process `#pragma starpu unregister VAR' and emit the corresponding
    `starpu_data_unregister' call.  */
 
@@ -984,6 +1026,8 @@ register_pragmas (void *gcc_data, void *user_data)
 				    handle_pragma_register);
   c_register_pragma_with_expansion (STARPU_PRAGMA_NAME_SPACE, "acquire",
 				    handle_pragma_acquire);
+  c_register_pragma_with_expansion (STARPU_PRAGMA_NAME_SPACE, "release",
+				    handle_pragma_release);
   c_register_pragma_with_expansion (STARPU_PRAGMA_NAME_SPACE, "unregister",
 				    handle_pragma_unregister);
   c_register_pragma (STARPU_PRAGMA_NAME_SPACE, "shutdown",

+ 3 - 0
gcc-plugin/tests/Makefile.am

@@ -23,6 +23,8 @@ gcc_tests =					\
   register-errors.c				\
   acquire.c					\
   acquire-errors.c				\
+  release.c					\
+  release-errors.c				\
   unregister.c					\
   unregister-errors.c				\
   task-errors.c					\
@@ -45,6 +47,7 @@ CLEANFILES = *.gimple *.o			\
   base						\
   pointers					\
   register					\
+  release					\
   scalar-tasks					\
   pointer-tasks					\
   lib-user					\

+ 3 - 1
gcc-plugin/tests/acquire-errors.c

@@ -1,5 +1,5 @@
 /* GCC-StarPU
-   Copyright (C) 2011 Institut National de Recherche en Informatique et Automatique
+   Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
 
    GCC-StarPU is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -36,6 +36,8 @@ main (int argc, char *argv[])
 #pragma starpu acquire y
 #pragma starpu acquire x
 
+#pragma starpu acquire x z			  /* (error "junk after") */
+
   /* XXX: Uncomment below when this is supported.  */
 #if 0
 #pragma starpu acquire z /* error "not registered" */

+ 11 - 1
gcc-plugin/tests/acquire.c

@@ -20,6 +20,14 @@
 
 #include <mocks.h>
 
+static void
+foo (char *x, int foo)
+{
+  expected_acquire_arguments.pointer = x;
+#pragma starpu acquire x
+}
+
+
 int
 main (int argc, char *argv[])
 {
@@ -44,8 +52,10 @@ main (int argc, char *argv[])
   expected_acquire_arguments.pointer = z;
 #pragma starpu acquire z
 
+  foo (z, 345);
+
   assert (data_register_calls == 2);
-  assert (data_acquire_calls == 2);
+  assert (data_acquire_calls == 3);
 
   return EXIT_SUCCESS;
 }

+ 18 - 3
gcc-plugin/tests/mocks.h

@@ -279,11 +279,19 @@ struct data_acquire_arguments
   void *pointer;
 };
 
-/* Number of `starpu_data_acquire' calls.  */
-static unsigned int data_acquire_calls;
+struct data_release_arguments
+{
+  /* Pointer to the data being released.  */
+  void *pointer;
+};
 
-/* Variable describing the expected `starpu_data_acquire' arguments.  */
+/* Number of `starpu_data_{acquire,release}' calls.  */
+static unsigned int data_acquire_calls, data_release_calls;
+
+/* Variable describing the expected `starpu_data_{acquire,release}'
+   arguments.  */
 struct data_acquire_arguments expected_acquire_arguments;
+struct data_release_arguments expected_release_arguments;
 
 int
 starpu_data_acquire (starpu_data_handle_t handle, enum starpu_access_mode mode)
@@ -297,6 +305,13 @@ starpu_data_acquire (starpu_data_handle_t handle, enum starpu_access_mode mode)
   return 0;
 }
 
+void
+starpu_data_release (starpu_data_handle_t handle)
+{
+  assert (handle_to_pointer (handle) == expected_release_arguments.pointer);
+  data_release_calls++;
+}
+
 
 /* Data acquisition.  */
 

+ 42 - 0
gcc-plugin/tests/release-errors.c

@@ -0,0 +1,42 @@
+/* GCC-StarPU
+   Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
+
+   GCC-StarPU is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   GCC-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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC-StarPU.  If not, see <http://www.gnu.org/licenses/>.  */
+
+extern float *y;
+
+static const double a[123];
+
+int
+main (int argc, char *argv[])
+{
+#pragma starpu initialize
+
+  int x[123] __attribute__ ((unused));
+  static char z[345] __attribute__ ((unused));
+
+#pragma starpu register x
+
+#pragma starpu release /* (error "parse error") */
+#pragma starpu release 123 /* (error "neither a pointer nor an array") */
+#pragma starpu release does_not_exit /* (error "unbound variable") */
+
+#pragma starpu release argc /* (error "neither a pointer nor an array") */
+#pragma starpu release y
+#pragma starpu release x
+
+#pragma starpu release x z			  /* (error "junk after") */
+
+  return 1;
+}

+ 61 - 0
gcc-plugin/tests/release.c

@@ -0,0 +1,61 @@
+/* GCC-StarPU
+   Copyright (C) 2012 Institut National de Recherche en Informatique et Automatique
+
+   GCC-StarPU is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   GCC-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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC-StarPU.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Test whether `#pragma starpu release ...' generates the right code.  */
+
+#undef NDEBUG
+
+#include <mocks.h>
+
+static void
+foo (char *x, int foo)
+{
+  expected_release_arguments.pointer = x;
+#pragma starpu release x
+}
+
+
+int
+main (int argc, char *argv[])
+{
+#pragma starpu initialize
+
+  int x[123];
+  static char z[345];
+
+  expected_register_arguments.pointer = x;
+  expected_register_arguments.elements = 123;
+  expected_register_arguments.element_size = sizeof x[0];
+#pragma starpu register x
+
+  expected_release_arguments.pointer = x;
+#pragma starpu release x
+
+  expected_register_arguments.pointer = z;
+  expected_register_arguments.elements = sizeof z;
+  expected_register_arguments.element_size = sizeof z[0];
+#pragma starpu register z
+
+  expected_release_arguments.pointer = z;
+#pragma starpu release z
+
+  foo (z, 345);
+
+  assert (data_register_calls == 2);
+  assert (data_release_calls == 3);
+
+  return EXIT_SUCCESS;
+}

+ 5 - 2
include/pthread_win32/pthread.h

@@ -32,6 +32,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #include <windows.h>
+#include <sys/types.h>
 #undef interface
 #include <stdio.h>
 #include <errno.h>
@@ -136,7 +137,7 @@ static inline int pthread_cancel (pthread_t thread) {
 }
 
 static inline void pthread_exit (void *res) {
-  ExitThread((DWORD) res);
+  ExitThread((DWORD_PTR) (DWORD) res);
 }
 
 static inline int pthread_join (pthread_t thread, void **res) {
@@ -154,7 +155,7 @@ again:
   if (res) {
     DWORD _res;
     if (GetExitCodeThread(thread, &_res))
-      *res = (void *)_res;
+      *res = (void *)(DWORD_PTR)_res;
   }
   return 0;
 }
@@ -269,6 +270,7 @@ typedef struct {
 } pthread_cond_t;
 #define PTHREAD_COND_INITIALIZER { NULL, 0}
 
+#ifndef _TIMESPEC_DEFINED
 #ifndef STARPU_TIMESPEC_DEFINED
 #define STARPU_TIMESPEC_DEFINED 1
 struct timespec {
@@ -276,6 +278,7 @@ struct timespec {
   long    tv_nsec; /* Nanoseconds */
 };
 #endif /* STARPU_TIMESPEC_DEFINED */
+#endif
 
 typedef unsigned pthread_condattr_t;
 

+ 5 - 2
socl/src/cl_buildprogram.c

@@ -35,10 +35,13 @@ static void soclBuildProgram_task(void *data) {
    err = clBuildProgram(d->program->cl_programs[range], 1, &device, d->options, NULL, NULL);
    if (err != CL_SUCCESS) {
       size_t len;
-      static char buffer[4096];
-      clGetProgramBuildInfo(d->program->cl_programs[range], device, CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, &len);
+      clGetProgramBuildInfo(d->program->cl_programs[range], device, CL_PROGRAM_BUILD_LOG, 0, NULL, &len);
+      char * buffer = malloc(len+1);
+      buffer[len] = '\0';
+      clGetProgramBuildInfo(d->program->cl_programs[range], device, CL_PROGRAM_BUILD_LOG, len, buffer, NULL);
       DEBUG_CL("clBuildProgram", err);
       ERROR_MSG("clBuildProgram: %s\n Aborting.\n", buffer);
+      free(buffer);
    }
 
    DEBUG_MSG("[Worker %d] Done building.\n", wid);

+ 0 - 10
socl/src/cl_waitforevents.c

@@ -22,16 +22,6 @@ soclWaitForEvents(cl_uint           num_events,
 {
    unsigned int i;
    DEBUG_MSG("Waiting for events: ");
-   for (i=0; i<num_events; i++) {
-   	command_graph_dump(event_list[i]->command);
-
-   	/* We need to submit commands if it's not already done */
-	command_submit_deep(event_list[i]->command);
-
-      	DEBUG_MSG_NOHEAD("%d ", event_list[i]->id);
-   }
-   DEBUG_MSG_NOHEAD("\n");
-
    for (i=0; i<num_events; i++)
       starpu_tag_wait(event_list[i]->id);
 

+ 2 - 1
socl/src/command.c

@@ -106,7 +106,8 @@ command_ndrange_kernel command_ndrange_kernel_create (
 	nullOrDup(local_work_size, work_dim*sizeof(size_t));
 
    	/* Codelet */
-   	cmd->codelet = (struct starpu_codelet*)calloc(1, sizeof(struct starpu_codelet));
+   	cmd->codelet = (struct starpu_codelet*)malloc(sizeof(struct starpu_codelet));
+	starpu_codelet_init(cmd->codelet);
 	struct starpu_codelet * codelet = cmd->codelet;
 	codelet->where = STARPU_OPENCL;
 	codelet->power_model = NULL;

+ 1 - 0
socl/src/command_list.c

@@ -35,6 +35,7 @@ command_list command_list_remove(command_list l, cl_command cmd) {
 			free(e);
 			if (e == l) return next;
 		}
+		e = e->next;
 	}
 	return l;
 }

+ 3 - 0
socl/src/command_queue.c

@@ -165,4 +165,7 @@ void command_queue_enqueue_ex(cl_command_queue cq, cl_command cmd, cl_uint num_e
 
 	/* Unlock command queue */
 	pthread_mutex_unlock(&cq->mutex);
+
+	/* Submit command */
+	command_submit_ex(cmd);
 }

+ 2 - 0
src/core/combined_workers.c

@@ -21,7 +21,9 @@
 #include <common/config.h>
 #include <core/workers.h>
 
+#ifdef __GLIBC__
 #include <sched.h>
+#endif
 
 #ifdef __MINGW32__
 #include <windows.h>

+ 5 - 4
src/core/jobs.c

@@ -424,11 +424,12 @@ const char *_starpu_get_model_name(struct _starpu_job *j)
 		return NULL;
 
 	struct starpu_task *task = j->task;
-        if (task && task->cl
-            && task->cl->model
-            && task->cl->model->symbol)
+        if (task && task->cl) {
+            if (task->cl->model && task->cl->model->symbol)
                 return task->cl->model->symbol;
-        else
+	    else
+		return task->cl->name;
+	} else
 	{
 #ifdef STARPU_USE_FXT
                 return j->model_name;

+ 8 - 2
starpufft/starpufftx.c

@@ -271,6 +271,8 @@ STARPUFFT(start_handle)(STARPUFFT(plan) plan, starpu_data_handle_t in, starpu_da
 void
 STARPUFFT(execute)(STARPUFFT(plan) plan, void *in, void *out)
 {
+	int ret;
+
 	memset(task_per_worker, 0, sizeof(task_per_worker));
 	memset(samples_per_worker, 0, sizeof(task_per_worker));
 
@@ -278,7 +280,8 @@ STARPUFFT(execute)(STARPUFFT(plan) plan, void *in, void *out)
 
 	struct starpu_task *task = STARPUFFT(start)(plan, in, out);
 	gettimeofday(&submit_tasks, NULL);
-	starpu_task_wait(task);
+	ret = starpu_task_wait(task);
+	STARPU_ASSERT(ret == 0);
 
 	STARPUFFT(cleanup)(plan);
 
@@ -288,8 +291,11 @@ STARPUFFT(execute)(STARPUFFT(plan) plan, void *in, void *out)
 void
 STARPUFFT(execute_handle)(STARPUFFT(plan) plan, starpu_data_handle_t in, starpu_data_handle_t out)
 {
+	int ret;
+
 	struct starpu_task *task = STARPUFFT(start_handle)(plan, in, out);
-	starpu_task_wait(task);
+	ret = starpu_task_wait(task);
+	STARPU_ASSERT(ret == 0);
 }
 
 /* Destroy FFTW plans, unregister and free buffers, and free tags */

+ 1 - 1
tests/datawizard/handle_to_pointer.c

@@ -160,7 +160,7 @@ int main(int argc, char *argv[])
 		  int *numbers = (int *)pointer;
 		  if (numbers[i] != i)
 		  {
-		       FPRINTF(stderr, "Incorrect value numbers[%d] == %d should be %d\n", i, numbers[i], i);
+		       FPRINTF(stderr, "Incorrect value numbers[%d] == %d should be %d\n", (int)i, numbers[i], (int)i);
 		       ret = EXIT_FAILURE;
 		  }
 	     }