Pārlūkot izejas kodu

starpupy: integrate within autotools

Nathalie Furmento 4 gadi atpakaļ
vecāks
revīzija
56d9b29ed2

+ 4 - 0
Makefile.am

@@ -53,6 +53,10 @@ if STARPU_BUILD_STARPURM
 SUBDIRS += starpurm
 endif
 
+if STARPU_BUILD_STARPUPY
+SUBDIRS += starpupy
+endif
+
 if STARPU_BUILD_SC_HYPERVISOR
 SUBDIRS += sc_hypervisor
 endif

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 36 - 0
configure.ac


+ 12 - 0
m4/libs.m4

@@ -191,3 +191,15 @@ AC_DEFUN([IS_SUPPORTED_FCFLAG],
 	FCFLAGS="$SAVED_FCFLAGS"
 	AC_LANG_POP([Fortran])
 ])
+
+# AC_PYTHON_MODULE(modulename, [action-if-found], [action-if-not-found])
+# Check if the given python module is available
+AC_DEFUN([AC_PYTHON_MODULE],
+	[
+	echo "import $1" | $PYTHON - 2>/dev/null
+	if test $? -ne 0 ; then
+	   	$3
+	else
+		$2
+	fi
+])

+ 21 - 0
starpupy/Makefile.am

@@ -0,0 +1,21 @@
+# 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.
+#
+
+include $(top_srcdir)/starpu-subdirtests.mk
+
+SUBDIRS  = src
+SUBDIRS += tests
+

+ 50 - 0
starpupy/src/Makefile.am

@@ -0,0 +1,50 @@
+# 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.
+#
+
+SUBDIRS =
+
+all:
+	$(MKDIR_P) starpu
+	for f in $(top_srcdir)/starpupy/src/starpu/*py ; do cp $$f starpu ; done
+	for f in $(top_srcdir)/starpupy/src/starpu/*c ; do cp $$f starpu ; done
+	$(PYTHON) setup.py build
+
+install:
+	@if test -d $(prefix)/lib/python* ; \
+	then	\
+		chmod u+w $(prefix)/lib/python* ; \
+		chmod u+w $(prefix)/lib/python*/site-packages ; \
+	fi
+	$(PYTHON) setup.py install
+
+clean-local:
+	$(PYTHON) setup.py clean
+	rm -f starpu/*py starpu/*c
+
+distclean-local:
+	rm -rf build
+
+uninstall:
+	rm -rf $(prefix)/lib/python*/site-packages/starpu*
+	rm -rf $(prefix)/lib/python*/site-packages/tmp/starpu*
+
+EXTRA_DIST	=		\
+	starpu/delay.py		\
+	starpu/__init__.py	\
+	starpu/intermedia.py	\
+	starpu/joblib.py	\
+	starpu/starpu_task_wrapper.c
+

+ 23 - 0
starpupy/src/setup.cfg.in

@@ -0,0 +1,23 @@
+# 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.
+#
+[build]
+build-platlib=build
+build-temp=build/tmp
+
+[install]
+prefix=@prefix@
+
+

+ 35 - 0
starpupy/src/setup.py.in

@@ -0,0 +1,35 @@
+# 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.
+#
+from distutils.core import setup, Extension
+
+starpupy = Extension('starpu.starpupy',
+                     include_dirs = ['@STARPU_SRC_DIR@/include', '@STARPU_BUILD_DIR@/include'],
+                     libraries = ['starpu-@STARPU_EFFECTIVE_VERSION@'],
+                     library_dirs = ['@STARPU_BUILD_DIR@/src/.libs'],
+	             sources = ['starpu/starpu_task_wrapper.c'])
+
+setup(
+    name = 'starpupy',
+    version = '0.5',
+    description = 'Python bindings for StarPU',
+    author = 'StarPU team',
+    author_email = 'starpu-devel@lists.gforge.inria.fr',
+    url = 'https://starpu.gitlabpages.inria.fr/',
+    license = 'GPL',
+    platforms = 'posix',
+    ext_modules = [starpupy],
+    packages = ['starpu'],
+    )

+ 0 - 13
starpupy/src/starpu/Makefile

@@ -1,13 +0,0 @@
-PYTHON ?= python3
-
-CPPFLAGS = $(shell $(PYTHON)-config --includes) -Wall -O2 -g
-CFLAGS += $(shell pkg-config --cflags starpu-1.3)
-LDLIBS += $(shell pkg-config --libs starpu-1.3)
-
-all: starpupy.so
-
-starpupy.so: starpu_task_wrapper.c Makefile
-	$(CC) -fPIC $(CFLAGS) $< -o $@ -shared  $(CPPFLAGS) $(LDLIBS)
-
-clean:
-	rm -f starpupy.so

+ 30 - 0
starpupy/tests/Makefile.am

@@ -0,0 +1,30 @@
+# 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.
+#
+SUBDIRS =
+
+CLEANFILES = *.gcno *.gcda *.linkinfo
+
+examplebindir = $(libdir)/starpupy/examples
+
+TESTS	=
+TESTS	+=	starpu_py.sh
+TESTS	+=	starpu_py_parallel.sh
+
+EXTRA_DIST	=		\
+	starpu_py_parallel.py	\
+	starpu_py_parallel.sh	\
+	starpu_py.py		\
+	starpu_py.sh

+ 34 - 0
starpupy/tests/execute.sh.in

@@ -0,0 +1,34 @@
+#!@REALBASH@
+# 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.
+#
+
+set -x
+
+tstdir=@STARPU_SRC_DIR@/starpupy/tests
+
+modpath=@STARPU_BUILD_DIR@/src/.libs:
+pypath=@STARPU_BUILD_DIR@/starpupy/src/build:$PYTHONPATH
+
+tstfile=$1
+if test ! -f $tstdir/$tstfile
+then
+    echo "Error. File $tstdir/$tstfile not found"
+    exit 1
+fi
+shift
+
+PYTHONPATH=$pypath LD_LIBRARY_PATH=$modpath @PYTHON@ $tstdir/$tstfile $*
+

+ 19 - 0
starpupy/tests/starpu_py.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+# 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.
+#
+
+$(dirname $0)/execute.sh starpu_py.py
+

+ 19 - 0
starpupy/tests/starpu_py_parallel.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+# 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.
+#
+
+STARPU_CALIBRATE=1 $(dirname $0)/execute.sh starpu_py_parallel.py
+