Bläddra i källkod

Merge branch 'starpurm' of git+ssh://scm.gforge.inria.fr/gitroot/starpu/starpu into starpurm

Olivier Aumage 6 år sedan
förälder
incheckning
fba0dc8556

+ 3 - 1
configure.ac

@@ -3324,6 +3324,7 @@ m4_ifdef([AM_SILENT_RULES],
 ##########################################
 
 starpurm_support=no
+starpurm_dlb_support=no
 
 AC_ARG_ENABLE(starpurm, [AS_HELP_STRING([--enable-starpurm], [enable resource management support])],
                     enable_starpurm=$enableval, enable_starpurm=no)
@@ -3429,11 +3430,12 @@ then
 	if test "x$enable_dlb" != "xno"
 	then
 		AC_DEFINE([STARPURM_HAVE_DLB], [1], [Define to 1 if dlb support is enabled.])
+		starpurm_dlb_support=yes
 	fi
-	AM_CONDITIONAL(STARPURM_HAVE_DLB, test "x$enable_dlb" != "xno")
 	AC_SUBST(DLB_CFLAGS)
 	AC_SUBST(DLB_LIBS)
 fi
+AM_CONDITIONAL(STARPURM_HAVE_DLB, test x$starpurm_dlb_support == "xyes")
 AM_CONDITIONAL(BUILD_STARPURM, [test x$starpurm_support = xyes])
 
 AC_ARG_ENABLE(starpurm-examples, [AS_HELP_STRING([--enable-starpurm-examples],

+ 9 - 6
doc/doxygen/Makefile.am

@@ -1,6 +1,6 @@
 # StarPU --- Runtime system for heterogeneous multicore architectures.
 #
-# Copyright (C) 2013-2017                                Inria
+# Copyright (C) 2013-2018                                Inria
 # Copyright (C) 2010-2017                                CNRS
 # Copyright (C) 2009,2011,2013-2014,2017                 Université de Bordeaux
 #
@@ -80,6 +80,7 @@ chapters =	\
 	chapters/470_simgrid.doxy		\
 	chapters/480_openmp_runtime_support.doxy		\
 	chapters/490_clustering_a_machine.doxy		\
+	chapters/495_interoperability.doxy		\
 	chapters/501_environment_variables.doxy		\
 	chapters/510_configure_options.doxy		\
 	chapters/520_files.doxy		\
@@ -143,7 +144,8 @@ chapters =	\
 	chapters/api/sc_hypervisor/sc_hypervisor.doxy \
 	chapters/api/sc_hypervisor/sc_hypervisor_usage.doxy \
 	chapters/api/modularized_scheduler.doxy \
-	chapters/api/clustering_machine.doxy
+	chapters/api/clustering_machine.doxy \
+	chapters/api/interoperability.doxy
 
 images = 	\
 	chapters/images/data_trace.eps \
@@ -275,7 +277,8 @@ dox_inputs = $(DOX_CONFIG) 				\
 	$(top_srcdir)/sc_hypervisor/include/sc_hypervisor_config.h 	\
 	$(top_srcdir)/sc_hypervisor/include/sc_hypervisor_lp.h		\
 	$(top_srcdir)/sc_hypervisor/include/sc_hypervisor_monitoring.h	\
-	$(top_srcdir)/sc_hypervisor/include/sc_hypervisor_policy.h
+	$(top_srcdir)/sc_hypervisor/include/sc_hypervisor_policy.h	\
+	$(top_srcdir)/starpurm/include/starpurm.h
 
 $(DOX_TAG): $(dox_inputs)
 	@rm -fr $(DOX_HTML_DIR) $(DOX_LATEX_DIR)
@@ -299,9 +302,9 @@ $(DOX_PDF): $(DOX_TAG) refman.tex
 	$(SED) -i -e 's/__configure__/\\_Configure Options!/' -e 's/\\-\\_\\-\\-\\_\\-configure\\-\\_\\-\\-\\_\\-//' CompilationConfiguration.tex ;\
 	$(SED) -i s'/\\item Module\\-Documentation/\\item \\hyperlink{ModuleDocumentation}{Module Documentation}/' index.tex ;\
 	$(SED) -i s'/\\item File\\-Documentation/\\item \\hyperlink{FileDocumentation}{File Documentation}/' index.tex ;\
-	$(PDFLATEX) refman.tex > /dev/null ;\
-	$(MAKEINDEX) refman.idx > /dev/null 2>&1 ;\
-	$(PDFLATEX) refman.tex > /dev/null ;\
+	$(PDFLATEX) refman.tex ;\
+	$(MAKEINDEX) refman.idx ;\
+	$(PDFLATEX) refman.tex ;\
 	done=0; repeat=5 ;\
 	while test $$done = 0 -a $$repeat -gt 0; do \
            if $(EGREP) 'Rerun (LaTeX|to get cross-references right)' refman.log > /dev/null 2>&1; then \

+ 31 - 0
doc/doxygen/chapters/495_interoperability.doxy

@@ -0,0 +1,31 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2018                                     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.
+ */
+
+/*! \page InteroperabilitySupport Interoperability Support
+
+TODO
+
+\section ResourceManagement StarPU Resource Management
+
+This section will present the 'starpurm' module.
+
+All functions are defined in \ref API_Interop_Support.
+
+\subsection InitExit Initialization and Shutdown
+
+TODO
+
+*/

+ 2 - 0
doc/doxygen/chapters/520_files.doxy

@@ -71,4 +71,6 @@
 
 \file starpufft.h
 
+\file starpurm.h
+
 */

+ 358 - 0
doc/doxygen/chapters/api/interoperability.doxy

@@ -0,0 +1,358 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2018                                     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.
+ */
+
+/*! \defgroup API_Interop_Support Interoperability Support
+
+\brief This section describes the interface supplied by StarPU to interoperate with other runtime systems.
+
+\enum e_starpurm_drs_ret
+\ingroup API_Interop_Support
+StarPU Resource Manager return type.
+\var starpurm_drs_ret::starpurm_DRS_SUCCESS
+  Dynamic resource sharing operation succeeded.
+\var starpurm_drs_ret::starpurm_DRS_DISABLD
+  Dynamic resource sharing is disabled.
+\var starpurm_drs_ret::starpurm_DRS_PERM
+  Dynamic resource sharing operation is not authorized or implemented.
+\var starpurm_drs_ret::starpurm_DRS_EINVAL
+  Dynamic resource sharing operation has been called with one or more invalid parameters.
+
+@name Initialisation
+\ingroup API_Interop_Support
+
+\fn void starpurm_initialize(void)
+\ingroup API_Interop_Support
+Initialize StarPU and the StarPU-RM resource management module. The \ref starpu_init function should not have been called before the call to \c starpurm_initialize. The \c starpurm_initialize function will take care of this
+
+\fn void starpurm_shutdown(void)
+\ingroup API_Interop_Support
+Shutdown StarPU-RM and StarPU. The \ref starpu_shutdown function should not be called before. The \c starpurm_shutdown function will take care of this.
+
+
+@name Spawn
+\ingroup API_Interop_Support
+
+\fn void starpurm_spawn_kernel_on_cpus(void *data, void(*f)(void *), void *args, hwloc_cpuset_t cpuset)
+\ingroup API_Interop_Support
+Allocate a temporary context spanning the units selected in the cpuset bitmap,
+set it as the default context for the current thread, and call user function \c f.
+Upon the return of user function \c f, the temporary context is freed and the previous
+default context for the current thread is restored.
+
+\fn void starpurm_spawn_kernel_on_cpus_callback(void *data, void(*f)(void *), void *args, hwloc_cpuset_t cpuset, void(*cb_f)(void *), void *cb_args)
+\ingroup API_Interop_Support
+Spawn a POSIX thread and returns immediately. The thread spawned will allocate
+a temporary context spanning the units selected in the cpuset bitmap, set it as
+the default context for the current thread, and call user function \c f. Upon
+the return of user function \c f, the temporary context will be freed and the
+previous default context for the current thread restored. A user specified callback \c cb_f
+will be called just before the termination of the thread.
+
+
+@name DynamicResourceSharing
+\ingroup API_Interop_Support
+
+
+\fn starpurm_drs_ret_t starpurm_set_drs_enable(starpurm_drs_desc_t *spd)
+\ingroup API_Interop_Support
+Turn-on dynamic resource sharing support.
+
+\fn starpurm_drs_ret_t starpurm_set_drs_disable(starpurm_drs_desc_t *spd)
+\ingroup API_Interop_Support
+Turn-off dynamic resource sharing support.
+
+\fn int starpurm_drs_enabled_p(void)
+\ingroup API_Interop_Support
+Return the state of the dynamic resource sharing support (\c =!0 enabled, \c =0 disabled).
+
+\fn starpurm_drs_ret_t starpurm_set_max_parallelism(starpurm_drs_desc_t *spd, int max)
+\ingroup API_Interop_Support
+Set the maximum number of CPU computing units available for StarPU computations
+to \c max. This number cannot exceed the maximum number of StarPU's CPU worker
+allocated at start-up time.
+
+
+\fn starpurm_drs_ret_t starpurm_assign_cpu_to_starpu(starpurm_drs_desc_t *spd, int cpuid)
+\ingroup API_Interop_Support
+
+Extend StarPU's default scheduling context to execute tasks on worker
+corresponding to logical unit \c cpuid. If StarPU does not have a worker
+thread initialized for logical unit \c cpuid, do nothing.
+
+\fn starpurm_drs_ret_t starpurm_assign_cpus_to_starpu(starpurm_drs_desc_t *spd, int ncpus)
+\ingroup API_Interop_Support
+
+Extend StarPU's default scheduling context to execute tasks on \c ncpus
+more workers, up to the number of StarPU worker threads initialized.
+
+\fn starpurm_drs_ret_t starpurm_assign_cpu_mask_to_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+
+Extend StarPU's default scheduling context to execute tasks on the
+additional logical units selected in \c mask. Logical units of \c mask for which no
+StarPU worker is initialized are silently ignored.
+
+\fn starpurm_drs_ret_t starpurm_assign_all_cpus_to_starpu(starpurm_drs_desc_t *spd)
+\ingroup API_Interop_Support
+
+Set StarPU's default scheduling context to execute tasks on all
+available logical units for which a StarPU worker has been initialized.
+
+
+\fn starpurm_drs_ret_t starpurm_withdraw_cpu_from_starpu(starpurm_drs_desc_t *spd, int cpuid)
+\ingroup API_Interop_Support
+
+Shrink StarPU's default scheduling context so as to not execute tasks on worker
+corresponding to logical unit \c cpuid. If StarPU does not have a worker
+thread initialized for logical unit \c cpuid, do nothing.
+
+\fn starpurm_drs_ret_t starpurm_withdraw_cpus_from_starpu(starpurm_drs_desc_t *spd, int ncpus)
+\ingroup API_Interop_Support
+
+Shrink StarPU's default scheduling context to execute tasks on \c ncpus
+less workers.
+
+\fn starpurm_drs_ret_t starpurm_withdraw_cpu_mask_from_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+
+Shrink StarPU's default scheduling context so as to not execute tasks on the
+logical units selected in \c mask. Logical units of \c mask for which no
+StarPU worker is initialized are silently ignored.
+
+\fn starpurm_drs_ret_t starpurm_withdraw_all_cpus_from_starpu(starpurm_drs_desc_t *spd)
+\ingroup API_Interop_Support
+Shrink StarPU's default scheduling context so as to remove all logical units.
+
+\fn starpurm_drs_ret_t starpurm_lend(starpurm_drs_desc_t *spd)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_all_cpus_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_lend_cpu(starpurm_drs_desc_t *spd, int cpuid)
+\ingroup API_Interop_Support
+
+Synonym for \ref starpurm_assign_cpu_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_lend_cpus(starpurm_drs_desc_t *spd, int ncpus)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_cpus_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_lend_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_cpu_mask_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_reclaim(starpurm_drs_desc_t *spd)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_all_cpus_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_reclaim_cpu(starpurm_drs_desc_t *spd, int cpuid)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_cpu_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_reclaim_cpus(starpurm_drs_desc_t *spd, int ncpus)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_cpus_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_reclaim_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_cpu_mask_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_acquire(starpurm_drs_desc_t *spd)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_all_cpus_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_acquire_cpu(starpurm_drs_desc_t *spd, int cpuid)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_cpu_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_acquire_cpus(starpurm_drs_desc_t *spd, int ncpus)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_cpus_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_acquire_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_cpu_mask_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_return_all(starpurm_drs_desc_t *spd)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_all_cpus_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_return_cpu(starpurm_drs_desc_t *spd, int cpuid)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_cpu_to_starpu.
+
+
+@name Devices
+\ingroup API_Interop_Support
+
+\fn int starpurm_get_device_type_id(const char *type_str)
+\ingroup API_Interop_Support
+Return the device type ID constant associated to the device type name.
+Valid names for \c type_str are:
+- \c "cpu": regular CPU unit;
+- \c "opencl": OpenCL device unit;
+- \c "cuda": nVidia CUDA device unit;
+- \c "mic": Intel KNC type device unit.
+
+\fn const char *starpurm_get_device_type_name(int type_id)
+\ingroup API_Interop_Support
+Return the device type name associated to the device type ID constant.
+
+\fn int starpurm_get_nb_devices_by_type(int type_id)
+\ingroup API_Interop_Support
+Return the number of initialized StarPU worker for the device type \c type_id.
+
+\fn int starpurm_get_device_id(int type_id, int device_rank)
+\ingroup API_Interop_Support
+Return the unique ID assigned to the \c device_rank nth device of type
+\c type_id.
+
+\fn starpurm_drs_ret_t starpurm_assign_device_to_starpu(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
+\ingroup API_Interop_Support
+Extend StarPU's default scheduling context to use \c unit_rank nth
+device of type \c type_id.
+
+\fn starpurm_drs_ret_t starpurm_assign_devices_to_starpu(starpurm_drs_desc_t *spd, int type_id, int ndevices)
+\ingroup API_Interop_Support
+Extend StarPU's default scheduling context to use \c ndevices more
+devices of type \c type_id, up to the number of StarPU workers
+initialized for such device type.
+
+\fn starpurm_drs_ret_t starpurm_assign_device_mask_to_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+Extend StarPU's default scheduling context to use additional devices as
+designated by their corresponding StarPU worker thread(s) CPU-set \c mask.
+
+\fn starpurm_drs_ret_t starpurm_assign_all_devices_to_starpu(starpurm_drs_desc_t *spd, int type_id)
+\ingroup API_Interop_Support
+Extend StarPU's default scheduling context to use all devices of type \c
+type_id for which it has a worker thread initialized.
+
+\fn starpurm_drs_ret_t starpurm_withdraw_device_from_starpu(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
+\ingroup API_Interop_Support
+
+Shrink StarPU's default scheduling context to not use \c unit_rank nth
+device of type \c type_id.
+
+\fn starpurm_drs_ret_t starpurm_withdraw_devices_from_starpu(starpurm_drs_desc_t *spd, int type_id, int ndevices)
+\ingroup API_Interop_Support
+
+Shrink StarPU's default scheduling context to use \c ndevices less
+devices of type \c type_id.
+
+\fn starpurm_drs_ret_t starpurm_withdraw_device_mask_from_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+
+Shrink StarPU's default scheduling context to not use devices
+designated by their corresponding StarPU worker thread(s) CPU-set \c mask.
+
+\fn starpurm_drs_ret_t starpurm_withdraw_all_devices_from_starpu(starpurm_drs_desc_t *spd, int type_id)
+\ingroup API_Interop_Support
+
+Shrink StarPU's default scheduling context to use no devices of type \c
+type_id.
+
+\fn starpurm_drs_ret_t starpurm_lend_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_device_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_lend_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_devices_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_lend_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_device_mask_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_lend_all_devices(starpurm_drs_desc_t *spd, int type_id)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_all_devices_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_reclaim_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_device_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_reclaim_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_devices_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_reclaim_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_device_mask_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_reclaim_all_devices(starpurm_drs_desc_t *spd, int type_id)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_all_devices_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_acquire_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_device_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_acquire_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_devices_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_acquire_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_device_mask_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_acquire_all_devices(starpurm_drs_desc_t *spd, int type_id)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_withdraw_all_devices_from_starpu.
+
+\fn starpurm_drs_ret_t starpurm_return_all_devices(starpurm_drs_desc_t *spd, int type_id)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_all_devices_to_starpu.
+
+\fn starpurm_drs_ret_t starpurm_return_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
+\ingroup API_Interop_Support
+Synonym for \ref starpurm_assign_device_to_starpu.
+
+
+@name CpusetsQueries
+\ingroup API_Interop_Support
+
+\fn hwloc_cpuset_t starpurm_get_device_worker_cpuset(int type_id, int unit_rank)
+\ingroup API_Interop_Support
+Return the CPU-set of the StarPU worker associated to the \c unit_rank
+nth unit of type \c type_id.
+
+\fn hwloc_cpuset_t starpurm_get_global_cpuset(void)
+\ingroup API_Interop_Support
+Return the cumulated CPU-set of all StarPU worker threads.
+
+\fn hwloc_cpuset_t starpurm_get_selected_cpuset(void)
+\ingroup API_Interop_Support
+
+Return the CPU-set of the StarPU worker threads currently selected in
+the default StarPU's scheduling context.
+
+\fn hwloc_cpuset_t starpurm_get_all_cpu_workers_cpuset(void)
+\ingroup API_Interop_Support
+
+Return the cumulated CPU-set of all CPU StarPU worker threads.
+
+\fn hwloc_cpuset_t starpurm_get_all_device_workers_cpuset(void)
+\ingroup API_Interop_Support
+
+Return the cumulated CPU-set of all "non-CPU" StarPU worker threads.
+
+\fn hwloc_cpuset_t starpurm_get_all_device_workers_cpuset_by_type(int typeid)
+\ingroup API_Interop_Support
+
+Return the cumulated CPU-set of all StarPU worker threads for devices of
+type \c typeid.
+
+*/

+ 2 - 1
doc/doxygen/doxygen-config.cfg.in

@@ -64,7 +64,8 @@ INPUT                  = @top_srcdir@/doc/doxygen/chapters \
 			 @top_srcdir@/mpi/include/ \
 			 @top_srcdir@/mpi/include/fstarpu_mpi_mod.f90 \
 			 @top_srcdir@/starpufft/include/starpufft.h \
-			 @top_srcdir@/sc_hypervisor/include
+			 @top_srcdir@/sc_hypervisor/include \
+			 @top_srcdir@/starpurm/include/starpurm.h
 
 EXAMPLE_PATH           = @top_srcdir@/doc/doxygen \
 		       	 @top_srcdir@/doc/doxygen/chapters \

+ 7 - 0
doc/doxygen/refman.tex

@@ -193,6 +193,11 @@ Documentation License”.
 \hypertarget{ClusteringAMachine}{}
 \input{ClusteringAMachine}
 
+\chapter{Interoperability Support}
+\label{InteropSupport}
+\hypertarget{InteropSupport}{}
+\input{InteroperabilitySupport}
+
 \part{StarPU Reference API}
 
 \chapter{Execution Configuration Through Environment Variables}
@@ -256,6 +261,7 @@ Documentation License”.
 \input{group__API__SC__Hypervisor}
 \input{group__API__Modularized__Scheduler}
 \input{group__API__Clustering__Machine}
+\input{group__API__Interop__Support}
 
 \chapter{File Index}
 \input{files}
@@ -312,6 +318,7 @@ Documentation License”.
 \input{sc__hypervisor__lp_8h}
 \input{sc__hypervisor__monitoring_8h}
 \input{sc__hypervisor__policy_8h}
+\input{starpurm_8h}
 
 \chapter{Deprecated List}
 \label{deprecated}

+ 15 - 5
starpurm/include/starpurm.h

@@ -27,11 +27,16 @@ extern "C"
 /* type mapping */
 enum e_starpurm_drs_ret
 {
-	starpurm_DRS_SUCCESS,
-	starpurm_DRS_DISABLD,
-	starpurm_DRS_PERM,
+	starpurm_DRS_SUCCESS = 0,
+
+	starpurm_DRS_DISABLD = -1,
+	starpurm_DRS_PERM    = -2,
+	starpurm_DRS_EINVAL  = -3
+#if 0
+	/* Unused for now */
 	starpurm_DRS_NOTED,
 	starpurm_DRS_REQST
+#endif
 };
 typedef int starpurm_drs_ret_t;
 typedef void *starpurm_drs_desc_t;
@@ -55,8 +60,11 @@ int starpurm_drs_enabled_p(void);
 
 starpurm_drs_ret_t starpurm_set_max_parallelism(starpurm_drs_desc_t *spd, int max);
 
+#if 0
+/* Unused for now */
 starpurm_drs_ret_t starpurm_callback_set(starpurm_drs_desc_t *spd, starpurm_drs_cbs_t which, starpurm_drs_cb_t callback);
 starpurm_drs_ret_t starpurm_callback_get(starpurm_drs_desc_t *spd, starpurm_drs_cbs_t which, starpurm_drs_cb_t *callback);
+#endif
 
 starpurm_drs_ret_t starpurm_assign_cpu_to_starpu(starpurm_drs_desc_t *spd, int cpuid);
 starpurm_drs_ret_t starpurm_assign_cpus_to_starpu(starpurm_drs_desc_t *spd, int ncpus);
@@ -88,13 +96,15 @@ starpurm_drs_ret_t starpurm_acquire_cpu_mask(starpurm_drs_desc_t *spd, const hwl
 starpurm_drs_ret_t starpurm_return_all(starpurm_drs_desc_t *spd);
 starpurm_drs_ret_t starpurm_return_cpu(starpurm_drs_desc_t *spd, int cpuid);
 
-/* Pause/resume */
+#if 0
+/* Pause/resume (not implemented) */
 starpurm_drs_ret_t starpurm_create_block_condition(starpurm_block_cond_t *cond);
 void starpurm_block_current_task(starpurm_block_cond_t *cond);
 void starpurm_signal_block_condition(starpurm_block_cond_t *cond);
- 
+
 void starpurm_register_polling_service(const char *service_name, starpurm_polling_t function, void *data);
 void starpurm_unregister_polling_service(const char *service_name, starpurm_polling_t function, void *data);
+#endif
 
 /* Devices */
 int starpurm_get_device_type_id(const char *type_str);

+ 49 - 76
starpurm/src/starpurm.c

@@ -359,7 +359,7 @@ static starpurm_drs_ret_t _starpurm_update_cpuset(hwloc_cpuset_t cpuset)
 	struct s_starpurm *rm = _starpurm;
 	if (hwloc_bitmap_isequal(cpuset, rm->selected_cpuset))
 	{
-		return 0;
+		return starpurm_DRS_SUCCESS;
 	}
 	pthread_mutex_lock(&rm->temporary_ctxs_mutex);
 	if (rm->starpu_in_pause)
@@ -448,7 +448,7 @@ static starpurm_drs_ret_t _starpurm_update_cpuset(hwloc_cpuset_t cpuset)
 		starpu_pause();
 	}
 	pthread_mutex_unlock(&rm->temporary_ctxs_mutex);
-	return 0;
+	return starpurm_DRS_SUCCESS;
 }
 
 static unsigned _starpurm_temporary_context_alloc(hwloc_cpuset_t cpuset)
@@ -535,7 +535,7 @@ static starpurm_drs_ret_t _starpurm_set_ncpus(unsigned int ncpus)
 	}
 	if (ncpus == rm->selected_ncpus)
 	{
-		return 0;
+		return starpurm_DRS_SUCCESS;
 	}
 	pthread_mutex_lock(&rm->temporary_ctxs_mutex);
 	if (rm->starpu_in_pause)
@@ -584,7 +584,7 @@ static starpurm_drs_ret_t _starpurm_set_ncpus(unsigned int ncpus)
 		starpu_pause();
 	}
 	pthread_mutex_unlock(&rm->temporary_ctxs_mutex);
-	return 0;
+	return starpurm_DRS_SUCCESS;
 }
 
 /* Initialize rm state for StarPU */
@@ -967,7 +967,7 @@ starpurm_drs_ret_t starpurm_set_drs_enable(starpurm_drs_desc_t *spd)
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	rm->dynamic_resource_sharing = 1;
-	return 0;
+	return starpurm_DRS_SUCCESS;
 }
 
 starpurm_drs_ret_t starpurm_set_drs_disable(starpurm_drs_desc_t *spd)
@@ -978,7 +978,7 @@ starpurm_drs_ret_t starpurm_set_drs_disable(starpurm_drs_desc_t *spd)
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	rm->dynamic_resource_sharing = 0;
-	return 0;
+	return starpurm_DRS_SUCCESS;
 }
 
 int starpurm_drs_enabled_p(void)
@@ -998,7 +998,7 @@ starpurm_drs_ret_t starpurm_set_max_parallelism(starpurm_drs_desc_t *spd, int nc
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	if (ncpus > rm->nunits_by_type[starpurm_unit_cpu])
 	{
 		ncpus = rm->nunits_by_type[starpurm_unit_cpu];
@@ -1008,7 +1008,7 @@ starpurm_drs_ret_t starpurm_set_max_parallelism(starpurm_drs_desc_t *spd, int nc
 	{
 		return _starpurm_set_ncpus(ncpus);
 	}
-	return 0;
+	return starpurm_DRS_SUCCESS;
 }
 
 
@@ -1017,13 +1017,9 @@ starpurm_drs_ret_t starpurm_callback_set(starpurm_drs_desc_t *spd, starpurm_drs_
 	(void)spd;
 	(void)which;
 	(void)callback;
-	assert(_starpurm != NULL);
-	assert(_starpurm->state != state_uninitialized);
-	struct s_starpurm *rm = _starpurm;
-	if (!rm->dynamic_resource_sharing)
-		return -1;
-	/* TODO */
-	return 0;
+	/* unimplemented */
+	assert(0);
+	return starpurm_DRS_PERM;
 }
 
 starpurm_drs_ret_t starpurm_callback_get(starpurm_drs_desc_t *spd, starpurm_drs_cbs_t which, starpurm_drs_cb_t *callback)
@@ -1031,13 +1027,9 @@ starpurm_drs_ret_t starpurm_callback_get(starpurm_drs_desc_t *spd, starpurm_drs_
 	(void)spd;
 	(void)which;
 	(void)callback;
-	assert(_starpurm != NULL);
-	assert(_starpurm->state != state_uninitialized);
-	struct s_starpurm *rm = _starpurm;
-	if (!rm->dynamic_resource_sharing)
-		return -1;
-	/* TODO */
-	return 0;
+	/* unimplemented */
+	assert(0);
+	return starpurm_DRS_PERM;
 }
 
 starpurm_drs_ret_t starpurm_assign_cpu_to_starpu(starpurm_drs_desc_t *spd, int cpuid)
@@ -1046,7 +1038,7 @@ starpurm_drs_ret_t starpurm_assign_cpu_to_starpu(starpurm_drs_desc_t *spd, int c
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	starpurm_drs_ret_t ret = 0;
 	assert(hwloc_bitmap_isset(rm->global_cpuset, cpuid));
 	if (!hwloc_bitmap_isset(rm->selected_cpuset, cpuid))
@@ -1066,7 +1058,7 @@ starpurm_drs_ret_t starpurm_assign_cpus_to_starpu(starpurm_drs_desc_t *spd, int
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	/* add ncpus more CPUs to the CPUs pool */
 	return _starpurm_set_ncpus(rm->selected_ncpus+ncpus);
 }
@@ -1078,7 +1070,7 @@ starpurm_drs_ret_t starpurm_assign_cpu_mask_to_starpu(starpurm_drs_desc_t *spd,
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	hwloc_cpuset_t temp_cpuset = hwloc_bitmap_dup(rm->selected_cpuset);
 	hwloc_bitmap_or(temp_cpuset, temp_cpuset, mask);
 	starpurm_drs_ret_t ret = _starpurm_update_cpuset(temp_cpuset);
@@ -1092,7 +1084,7 @@ starpurm_drs_ret_t starpurm_assign_all_cpus_to_starpu(starpurm_drs_desc_t *spd)
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	return starpurm_assign_cpus_to_starpu(spd, rm->nunits_by_type[starpurm_unit_cpu]);
 }
 
@@ -1102,7 +1094,7 @@ starpurm_drs_ret_t starpurm_withdraw_cpu_from_starpu(starpurm_drs_desc_t *spd, i
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	starpurm_drs_ret_t ret = 0;
 	assert(hwloc_bitmap_isset(rm->global_cpuset, cpuid));
 	if (hwloc_bitmap_isset(rm->selected_cpuset, cpuid))
@@ -1122,7 +1114,7 @@ starpurm_drs_ret_t starpurm_withdraw_cpus_from_starpu(starpurm_drs_desc_t *spd,
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	/* add ncpus more CPUs to the CPUs pool */
 	starpurm_drs_ret_t ret = 0;
 	if (ncpus <= rm->nunits_by_type[starpurm_unit_cpu])
@@ -1143,7 +1135,7 @@ starpurm_drs_ret_t starpurm_withdraw_cpu_mask_from_starpu(starpurm_drs_desc_t *s
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	hwloc_cpuset_t temp_cpuset = hwloc_bitmap_dup(rm->selected_cpuset);
 	hwloc_bitmap_andnot(temp_cpuset, temp_cpuset, mask);
 	starpurm_drs_ret_t ret = _starpurm_update_cpuset(temp_cpuset);
@@ -1157,7 +1149,7 @@ starpurm_drs_ret_t starpurm_withdraw_all_cpus_from_starpu(starpurm_drs_desc_t *s
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	return starpurm_withdraw_cpus_from_starpu(spd, rm->nunits_by_type[starpurm_unit_cpu]);
 }
 
@@ -1239,53 +1231,34 @@ starpurm_drs_ret_t starpurm_return_cpu(starpurm_drs_desc_t *spd, int cpuid)
 /* Pause/resume */
 starpurm_drs_ret_t starpurm_create_block_condition(starpurm_block_cond_t *cond)
 {
-	assert(_starpurm != NULL);
-	assert(_starpurm->state != state_uninitialized);
-	struct s_starpurm *rm = _starpurm;
-	if (!rm->dynamic_resource_sharing)
-		return -1;
-	return 0;
+	/* unimplemented */
+	assert(0);
+	return starpurm_DRS_PERM;
 }
 
 void starpurm_block_current_task(starpurm_block_cond_t *cond)
 {
-	assert(_starpurm != NULL);
-	assert(_starpurm->state != state_uninitialized);
-	struct s_starpurm *rm = _starpurm;
-	if (!rm->dynamic_resource_sharing)
-		return;
-	/* TODO */
+	/* unimplemented */
+	assert(0);
 }
 
 void starpurm_signal_block_condition(starpurm_block_cond_t *cond)
 {
-	assert(_starpurm != NULL);
-	assert(_starpurm->state != state_uninitialized);
-	struct s_starpurm *rm = _starpurm;
-	if (!rm->dynamic_resource_sharing)
-		return;
-	/* TODO */
+	/* unimplemented */
+	assert(0);
 }
 
  
 void starpurm_register_polling_service(const char *service_name, starpurm_polling_t function, void *data)
 {
-	assert(_starpurm != NULL);
-	assert(_starpurm->state != state_uninitialized);
-	struct s_starpurm *rm = _starpurm;
-	if (!rm->dynamic_resource_sharing)
-		return;
-	/* TODO */
+	/* unimplemented */
+	assert(0);
 }
 
 void starpurm_unregister_polling_service(const char *service_name, starpurm_polling_t function, void *data)
 {
-	assert(_starpurm != NULL);
-	assert(_starpurm->state != state_uninitialized);
-	struct s_starpurm *rm = _starpurm;
-	if (!rm->dynamic_resource_sharing)
-		return;
-	/* TODO */
+	/* unimplemented */
+	assert(0);
 }
 
 /* devices */
@@ -1346,11 +1319,11 @@ starpurm_drs_ret_t starpurm_assign_device_to_starpu(starpurm_drs_desc_t *spd, in
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	if (type_id < 0 || type_id >= starpurm_unit_ntypes)
-		return -1;
+		return starpurm_DRS_EINVAL;
 	if (unit_rank < 0 || unit_rank >= rm->nunits_by_type[type_id])
-		return -1;
+		return starpurm_DRS_EINVAL;
 	hwloc_cpuset_t temp_cpuset = hwloc_bitmap_dup(rm->selected_cpuset);
 	hwloc_bitmap_or(temp_cpuset, temp_cpuset, rm->units[rm->unit_offsets_by_type[type_id] + unit_rank].worker_cpuset);
 	starpurm_drs_ret_t ret = _starpurm_update_cpuset(temp_cpuset);
@@ -1365,9 +1338,9 @@ starpurm_drs_ret_t starpurm_assign_devices_to_starpu(starpurm_drs_desc_t *spd, i
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	if (type_id < 0 || type_id >= starpurm_unit_ntypes)
-		return -1;
+		return starpurm_DRS_EINVAL;
 	hwloc_cpuset_t temp_cpuset = hwloc_bitmap_dup(rm->selected_cpuset);
 	if (ndevices > rm->nunits_by_type[type_id])
 	{
@@ -1390,7 +1363,7 @@ starpurm_drs_ret_t starpurm_assign_device_mask_to_starpu(starpurm_drs_desc_t *sp
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	hwloc_cpuset_t temp_cpuset = hwloc_bitmap_dup(rm->selected_cpuset);
 	hwloc_bitmap_or(temp_cpuset, temp_cpuset, mask);
 	starpurm_drs_ret_t ret = _starpurm_update_cpuset(temp_cpuset);
@@ -1404,9 +1377,9 @@ starpurm_drs_ret_t starpurm_assign_all_devices_to_starpu(starpurm_drs_desc_t *sp
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	if (type_id < 0 || type_id >= starpurm_unit_ntypes)
-		return -1;
+		return starpurm_DRS_EINVAL;
 	return starpurm_assign_devices_to_starpu(spd, type_id, rm->nunits_by_type[type_id]);
 }
 
@@ -1416,11 +1389,11 @@ starpurm_drs_ret_t starpurm_withdraw_device_from_starpu(starpurm_drs_desc_t *spd
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	if (type_id < 0 || type_id >= starpurm_unit_ntypes)
-		return -1;
+		return starpurm_DRS_EINVAL;
 	if (unit_rank < 0 || unit_rank >= rm->nunits_by_type[type_id])
-		return -1;
+		return starpurm_DRS_EINVAL;
 	hwloc_cpuset_t temp_cpuset = hwloc_bitmap_dup(rm->selected_cpuset);
 	hwloc_bitmap_andnot(temp_cpuset, temp_cpuset, rm->units[rm->unit_offsets_by_type[type_id] + unit_rank].worker_cpuset);
 	starpurm_drs_ret_t ret = _starpurm_update_cpuset(temp_cpuset);
@@ -1435,9 +1408,9 @@ starpurm_drs_ret_t starpurm_withdraw_devices_from_starpu(starpurm_drs_desc_t *sp
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	if (type_id < 0 || type_id >= starpurm_unit_ntypes)
-		return -1;
+		return starpurm_DRS_EINVAL;
 	hwloc_cpuset_t temp_cpuset = hwloc_bitmap_dup(rm->selected_cpuset);
 	if (ndevices > rm->nunits_by_type[type_id])
 	{
@@ -1460,7 +1433,7 @@ starpurm_drs_ret_t starpurm_withdraw_device_mask_from_starpu(starpurm_drs_desc_t
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	hwloc_cpuset_t temp_cpuset = hwloc_bitmap_dup(rm->selected_cpuset);
 	hwloc_bitmap_andnot(temp_cpuset, temp_cpuset, mask);
 	starpurm_drs_ret_t ret = _starpurm_update_cpuset(temp_cpuset);
@@ -1474,9 +1447,9 @@ starpurm_drs_ret_t starpurm_withdraw_all_devices_from_starpu(starpurm_drs_desc_t
 	assert(_starpurm->state != state_uninitialized);
 	struct s_starpurm *rm = _starpurm;
 	if (!rm->dynamic_resource_sharing)
-		return -1;
+		return starpurm_DRS_DISABLD;
 	if (type_id < 0 || type_id >= starpurm_unit_ntypes)
-		return -1;
+		return starpurm_DRS_EINVAL;
 	return starpurm_withdraw_devices_from_starpu(spd, type_id, rm->nunits_by_type[type_id]);
 }