Browse Source

Add STARPU_TASK_SCHED_DATA

Samuel Thibault 5 years ago
parent
commit
ff10510e28

+ 1 - 0
ChangeLog

@@ -44,6 +44,7 @@ New features:
   * New modular-eager-prio scheduler.
   * New modular-eager-prio scheduler.
   * Add 'ready' heuristic to modular schedulers.
   * Add 'ready' heuristic to modular schedulers.
   * New modular-heteroprio scheduler.
   * New modular-heteroprio scheduler.
+  * Add STARPU_TASK_SCHED_DATA
 
 
 Changes:
 Changes:
   * Modification in the Native Fortran interface of the functions
   * Modification in the Native Fortran interface of the functions

+ 3 - 1
include/fstarpu_mod.f90

@@ -2,7 +2,7 @@
 !
 !
 ! Copyright (C) 2016,2017                                Inria
 ! Copyright (C) 2016,2017                                Inria
 ! Copyright (C) 2017,2018,2019                           CNRS
 ! Copyright (C) 2017,2018,2019                           CNRS
-! Copyright (C) 2016-2018                                Université de Bordeaux
+! Copyright (C) 2016-2019                                Université de Bordeaux
 !
 !
 ! StarPU is free software; you can redistribute it and/or modify
 ! 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
 ! it under the terms of the GNU Lesser General Public License as published by
@@ -60,6 +60,7 @@ module fstarpu_mod
         type(c_ptr), bind(C) :: FSTARPU_HANDLES_SEQUENTIAL_CONSISTENCY
         type(c_ptr), bind(C) :: FSTARPU_HANDLES_SEQUENTIAL_CONSISTENCY
         type(c_ptr), bind(C) :: FSTARPU_TASK_END_DEP
         type(c_ptr), bind(C) :: FSTARPU_TASK_END_DEP
         type(c_ptr), bind(C) :: FSTARPU_NODE_SELECTION_POLICY
         type(c_ptr), bind(C) :: FSTARPU_NODE_SELECTION_POLICY
+        type(c_ptr), bind(C) :: FSTARPU_TASK_SCHED_DATA
 
 
         type(c_ptr), bind(C) :: FSTARPU_VALUE
         type(c_ptr), bind(C) :: FSTARPU_VALUE
         type(c_ptr), bind(C) :: FSTARPU_SCHED_CTX
         type(c_ptr), bind(C) :: FSTARPU_SCHED_CTX
@@ -2279,6 +2280,7 @@ module fstarpu_mod
                         FSTARPU_TAG_ONLY        = fstarpu_get_constant(C_CHAR_"FSTARPU_TAG_ONLY"//C_NULL_CHAR)
                         FSTARPU_TAG_ONLY        = fstarpu_get_constant(C_CHAR_"FSTARPU_TAG_ONLY"//C_NULL_CHAR)
                         FSTARPU_NAME    = fstarpu_get_constant(C_CHAR_"FSTARPU_NAME"//C_NULL_CHAR)
                         FSTARPU_NAME    = fstarpu_get_constant(C_CHAR_"FSTARPU_NAME"//C_NULL_CHAR)
                         FSTARPU_NODE_SELECTION_POLICY   = fstarpu_get_constant(C_CHAR_"FSTARPU_NODE_SELECTION_POLICY"//C_NULL_CHAR)
                         FSTARPU_NODE_SELECTION_POLICY   = fstarpu_get_constant(C_CHAR_"FSTARPU_NODE_SELECTION_POLICY"//C_NULL_CHAR)
+                        FSTARPU_TASK_SCHED_DATA = fstarpu_get_constant(C_CHAR_"FSTARPU_TASK_SCHED_DATA"//C_NULL_CHAR)
 
 
                         FSTARPU_VALUE   = fstarpu_get_constant(C_CHAR_"FSTARPU_VALUE"//C_NULL_CHAR)
                         FSTARPU_VALUE   = fstarpu_get_constant(C_CHAR_"FSTARPU_VALUE"//C_NULL_CHAR)
                         FSTARPU_SCHED_CTX   = fstarpu_get_constant(C_CHAR_"FSTARPU_SCHED_CTX"//C_NULL_CHAR)
                         FSTARPU_SCHED_CTX   = fstarpu_get_constant(C_CHAR_"FSTARPU_SCHED_CTX"//C_NULL_CHAR)

+ 3 - 0
include/starpu_task.h

@@ -1170,6 +1170,9 @@ struct starpu_task
 	/**
 	/**
 	   This field is managed by the scheduler, is it allowed to do
 	   This field is managed by the scheduler, is it allowed to do
 	   whatever with it.  Typically, some area would be allocated on push, and released on pop.
 	   whatever with it.  Typically, some area would be allocated on push, and released on pop.
+
+	   With starpu_task_insert() and alike this is set when using
+	   ::STARPU_TASK_SCHED_DATA.
 	*/
 	*/
 	void *sched_data;
 	void *sched_data;
 };
 };

+ 8 - 1
include/starpu_task_util.h

@@ -303,7 +303,14 @@ extern "C"
 */
 */
 #define STARPU_PROLOGUE_CALLBACK_POP_ARG_NFREE (40<<STARPU_MODE_SHIFT)
 #define STARPU_PROLOGUE_CALLBACK_POP_ARG_NFREE (40<<STARPU_MODE_SHIFT)
 
 
-#define STARPU_SHIFTED_MODE_MAX (41<<STARPU_MODE_SHIFT)
+/**
+   Used when calling starpu_task_insert() and alike, must be followed
+   by a void* specifying the value to be set in the sched_data field of the
+   task.
+ */
+#define STARPU_TASK_SCHED_DATA (41<<STARPU_MODE_SHIFT)
+
+#define STARPU_SHIFTED_MODE_MAX (42<<STARPU_MODE_SHIFT)
 
 
 /**
 /**
    Set the given \p task corresponding to \p cl with the following arguments.
    Set the given \p task corresponding to \p cl with the following arguments.

+ 5 - 1
mpi/src/starpu_mpi_task_insert.c

@@ -2,7 +2,7 @@
  *
  *
  * Copyright (C) 2012,2014,2016,2017                      Inria
  * Copyright (C) 2012,2014,2016,2017                      Inria
  * Copyright (C) 2011-2019                                CNRS
  * Copyright (C) 2011-2019                                CNRS
- * Copyright (C) 2011-2018                                Université de Bordeaux
+ * Copyright (C) 2011-2019                                Université de Bordeaux
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * 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
  * it under the terms of the GNU Lesser General Public License as published by
@@ -503,6 +503,10 @@ int _starpu_mpi_task_decode_v(struct starpu_codelet *codelet, int me, int nb_nod
 		{
 		{
 			(void)va_arg(varg_list_copy, unsigned);
 			(void)va_arg(varg_list_copy, unsigned);
 		}
 		}
+		else if (arg_type==STARPU_TASK_SCHED_DATA)
+		{
+			(void)va_arg(varg_list_copy, void *);
+		}
 		else
 		else
 		{
 		{
 			STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", arg_type);
 			STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", arg_type);

+ 6 - 1
mpi/src/starpu_mpi_task_insert_fortran.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
  * Copyright (C) 2016-2019                                CNRS
  * Copyright (C) 2016-2019                                CNRS
- * Copyright (C) 2017,2018                                Université de Bordeaux
+ * Copyright (C) 2017,2018-2019                                Université de Bordeaux
  * Copyright (C) 2016                                     Inria
  * Copyright (C) 2016                                     Inria
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * StarPU is free software; you can redistribute it and/or modify
@@ -364,6 +364,11 @@ int _fstarpu_mpi_task_decode_v(struct starpu_codelet *codelet, int me, int nb_no
 			arg_i++;
 			arg_i++;
 			/* unsigned */
 			/* unsigned */
 		}
 		}
+		else if (arg_type==STARPU_TASK_SCHED_DATA)
+		{
+			arg_i++;
+			/* void * */
+		}
 		else
 		else
 		{
 		{
 			STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", arg_type);
 			STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", arg_type);

+ 3 - 1
src/util/fstarpu.c

@@ -2,7 +2,7 @@
  *
  *
  * Copyright (C) 2016,2017                                Inria
  * Copyright (C) 2016,2017                                Inria
  * Copyright (C) 2016-2019                                CNRS
  * Copyright (C) 2016-2019                                CNRS
- * Copyright (C) 2016-2018                                Université de Bordeaux
+ * Copyright (C) 2016-2019                                Université de Bordeaux
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * 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
  * it under the terms of the GNU Lesser General Public License as published by
@@ -71,6 +71,7 @@ static const intptr_t fstarpu_task_workerids = STARPU_TASK_WORKERIDS;
 static const intptr_t fstarpu_sequential_consistency = STARPU_SEQUENTIAL_CONSISTENCY;
 static const intptr_t fstarpu_sequential_consistency = STARPU_SEQUENTIAL_CONSISTENCY;
 static const intptr_t fstarpu_task_profiling_info = STARPU_TASK_PROFILING_INFO;
 static const intptr_t fstarpu_task_profiling_info = STARPU_TASK_PROFILING_INFO;
 static const intptr_t fstarpu_task_no_submitorder = STARPU_TASK_NO_SUBMITORDER;
 static const intptr_t fstarpu_task_no_submitorder = STARPU_TASK_NO_SUBMITORDER;
+static const intptr_t fstarpu_task_sched_data = STARPU_TASK_SCHED_DATA;
 
 
 static const intptr_t fstarpu_value = STARPU_VALUE;
 static const intptr_t fstarpu_value = STARPU_VALUE;
 static const intptr_t fstarpu_sched_ctx = STARPU_SCHED_CTX;
 static const intptr_t fstarpu_sched_ctx = STARPU_SCHED_CTX;
@@ -157,6 +158,7 @@ intptr_t fstarpu_get_constant(char *s)
 	else if (!strcmp(s, "FSTARPU_SEQUENTIAL_CONSISTENCY"))	{ return fstarpu_sequential_consistency; }
 	else if (!strcmp(s, "FSTARPU_SEQUENTIAL_CONSISTENCY"))	{ return fstarpu_sequential_consistency; }
 	else if (!strcmp(s, "FSTARPU_TASK_PROFILING_INFO"))	{ return fstarpu_task_profiling_info; }
 	else if (!strcmp(s, "FSTARPU_TASK_PROFILING_INFO"))	{ return fstarpu_task_profiling_info; }
 	else if (!strcmp(s, "FSTARPU_TASK_NO_SUBMITORDER"))	{ return fstarpu_task_no_submitorder; }
 	else if (!strcmp(s, "FSTARPU_TASK_NO_SUBMITORDER"))	{ return fstarpu_task_no_submitorder; }
+	else if	(!strcmp(s, "FSTARPU_TASK_SCHED_DATA"))	{ return fstarpu_task_sched_data; }
 
 
 	else if (!strcmp(s, "FSTARPU_CPU_WORKER"))	{ return fstarpu_cpu_worker; }
 	else if (!strcmp(s, "FSTARPU_CPU_WORKER"))	{ return fstarpu_cpu_worker; }
 	else if (!strcmp(s, "FSTARPU_CUDA_WORKER"))	{ return fstarpu_cuda_worker; }
 	else if (!strcmp(s, "FSTARPU_CUDA_WORKER"))	{ return fstarpu_cuda_worker; }

+ 13 - 0
src/util/starpu_task_insert_utils.c

@@ -247,6 +247,10 @@ int _starpu_codelet_pack_args(void **arg_buffer, size_t *arg_buffer_size, va_lis
 		{
 		{
 			(void)va_arg(varg_list, unsigned);
 			(void)va_arg(varg_list, unsigned);
 		}
 		}
+		else if (arg_type==STARPU_TASK_SCHED_DATA)
+		{
+			(void)va_arg(varg_list, void *);
+		}
 		else
 		else
 		{
 		{
 			STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", arg_type);
 			STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", arg_type);
@@ -604,6 +608,10 @@ int _starpu_task_insert_create(struct starpu_codelet *cl, struct starpu_task *ta
 		{
 		{
 			task->no_submitorder = va_arg(varg_list, unsigned);
 			task->no_submitorder = va_arg(varg_list, unsigned);
 		}
 		}
+		else if (arg_type==STARPU_TASK_SCHED_DATA)
+		{
+			task->sched_data = va_arg(varg_list, void *);
+		}
 		else
 		else
 		{
 		{
 			STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", arg_type);
 			STARPU_ABORT_MSG("Unrecognized argument %d, did you perhaps forget to end arguments with 0?\n", arg_type);
@@ -924,6 +932,11 @@ int _fstarpu_task_insert_create(struct starpu_codelet *cl, struct starpu_task *t
 			arg_i++;
 			arg_i++;
 			task->no_submitorder = *(unsigned *)arglist[arg_i];
 			task->no_submitorder = *(unsigned *)arglist[arg_i];
 		}
 		}
+		else if (arg_type == STARPU_TASK_SCHED_DATA)
+		{
+			arg_i++;
+			task->sched_data = (void*)arglist[arg_i];
+		}
 		else
 		else
 		{
 		{
 			STARPU_ABORT_MSG("unknown/unsupported argument %d, did you perhaps forget to end arguments with 0?", arg_type);
 			STARPU_ABORT_MSG("unknown/unsupported argument %d, did you perhaps forget to end arguments with 0?", arg_type);