Samuel Thibault 13 years ago
parent
commit
42a552e428

+ 8 - 8
include/starpu_scheduler.h

@@ -68,36 +68,36 @@ struct starpu_machine_topology_s {
  * field of the starpu_conf structure passed to the starpu_init function. */
 struct starpu_sched_policy_s {
 	/* Initialize the scheduling policy. */
-	void (*init_sched)(unsigned);
+	void (*init_sched)(unsigned ctx_id);
 
 	/* Initialize the scheduling policy only for certain workers. */
-	void (*init_sched_for_workers)(unsigned, unsigned);
+	void (*init_sched_for_workers)(unsigned ctx_id, unsigned n_added_workers);
 
 	/* Cleanup the scheduling policy. */
-	void (*deinit_sched)(unsigned);
+	void (*deinit_sched)(unsigned ctx_id);
 
 	/* Insert a task into the scheduler. */
-        int (*push_task)(struct starpu_task *, unsigned);
+        int (*push_task)(struct starpu_task *, unsigned ctx_id);
 	/* Notify the scheduler that a task was directly pushed to the worker
 	 * without going through the scheduler. This method is called when a
 	 * task is explicitely assigned to a worker. This method therefore
 	 * permits to keep the timing state of the scheduler coherent even
 	 * when StarPU bypasses the scheduling strategy. */
-	void (*push_task_notify)(struct starpu_task *, int workerid, unsigned);
+	void (*push_task_notify)(struct starpu_task *, int workerid, unsigned ctx_id);
 
 
 	/* Get a task from the scheduler. The mutex associated to the worker is
 	 * already taken when this method is called. */
-	struct starpu_task *(*pop_task)(unsigned);
+	struct starpu_task *(*pop_task)(unsigned ctx_id);
 
 	 /* Remove all available tasks from the scheduler (tasks are chained by
 	  * the means of the prev and next fields of the starpu_task
 	  * structure). The mutex associated to the worker is already taken
 	  * when this method is called. */
-	struct starpu_task *(*pop_every_task)(unsigned);
+	struct starpu_task *(*pop_every_task)(unsigned ctx_id);
 
 	/* This method is called every time a task has been executed. (optionnal) */
-	void (*post_exec_hook)(struct starpu_task *, unsigned);
+	void (*post_exec_hook)(struct starpu_task *, unsigned ctx_id);
 
 	/* Name of the policy (optionnal) */
 	const char *policy_name;

+ 3 - 3
include/starpu_task.h

@@ -174,9 +174,9 @@ struct starpu_task {
 	 * by hand (without starpu_task_create), this field should be set to
 	 * NULL. */
 	void *starpu_private;
-     
-    unsigned sched_ctx;
-  
+
+	/* Scheduling context */
+	unsigned sched_ctx;
 };
 
 /* It is possible to initialize statically allocated tasks with this value.

+ 2 - 2
include/starpu_util.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  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
@@ -238,7 +238,7 @@ int starpu_data_cpy(starpu_data_handle dst_handle, starpu_data_handle src_handle
 #define STARPU_PRIORITY		(1<<7)	/* Priority associated to the task */
 #define STARPU_EXECUTE_ON_NODE	(1<<8)	/* Used by MPI to define which task is going to execute the codelet */
 #define STARPU_EXECUTE_ON_DATA	(1<<9)	/* Used by MPI to define which task is going to execute the codelet */
-#define STARPU_CTX		(1<<10)	/* Used to define which ctx will execute the */
+#define STARPU_CTX		(1<<10)	/* Used to define which ctx will execute the codelet */
 
 /* Wrapper to create a task. */
 int starpu_insert_task(starpu_codelet *cl, ...);

+ 2 - 2
mpi/examples/cholesky/mpi_cholesky.c

@@ -161,7 +161,7 @@ static void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblo
 		double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 		fprintf(stderr, "Computation took (in ms)\n");
 		fprintf(stdout, "%2.2f\n", timing/1000);
-	
+
 		double flop = (1.0f*size*size*size)/3.0f;
 		fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 	}
@@ -181,7 +181,7 @@ int main(int argc, char **argv)
 
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
-	
+
 	conf.sched_policy_name = "heft";
 	conf.calibrate = 1;
 

+ 0 - 39
mpi/examples/cholesky/mpi_cholesky.h

@@ -18,7 +18,6 @@
 #ifndef __DW_CHOLESKY_H__
 #define __DW_CHOLESKY_H__
 
-#include <semaphore.h>
 #include <string.h>
 #include <math.h>
 #include <sys/time.h>
@@ -31,42 +30,8 @@
 #include <common/blas.h>
 #include <starpu.h>
 
-#define NMAXBLOCKS	32
-
-#define TAG11(k)	((starpu_tag_t)( (1ULL<<60) | (unsigned long long)(k)))
-#define TAG21(k,j)	((starpu_tag_t)(((3ULL<<60) | (((unsigned long long)(k))<<32)	\
-					| (unsigned long long)(j))))
-#define TAG22(k,i,j)	((starpu_tag_t)(((4ULL<<60) | ((unsigned long long)(k)<<32) 	\
-					| ((unsigned long long)(i)<<16)	\
-					| (unsigned long long)(j))))
-
-
-
-#define TAG11_AUX(k, prefix)	((starpu_tag_t)( (((unsigned long long)(prefix))<<60)  |  (1ULL<<56) | (unsigned long long)(k)))
-#define TAG21_AUX(k,j, prefix)	((starpu_tag_t)( (((unsigned long long)(prefix))<<60)  			\
-					|  ((3ULL<<56) | (((unsigned long long)(k))<<32)	\
-					| (unsigned long long)(j))))
-#define TAG22_AUX(k,i,j, prefix)    ((starpu_tag_t)(  (((unsigned long long)(prefix))<<60)	\
-					|  ((4ULL<<56) | ((unsigned long long)(k)<<32)  	\
-					| ((unsigned long long)(i)<<16) 			\
-					| (unsigned long long)(j))))
-
 #define BLOCKSIZE	(size/nblocks)
 
-
-#define BLAS3_FLOP(n1,n2,n3)    \
-        (2*((uint64_t)n1)*((uint64_t)n2)*((uint64_t)n3))
-
-typedef struct {
-	starpu_data_handle dataA;
-	unsigned i;
-	unsigned j;
-	unsigned k;
-	unsigned nblocks;
-	unsigned *remaining;
-	sem_t *sem;
-} cl_args;
-
 static unsigned size = 4*1024;
 static unsigned nblocks = 16;
 static unsigned nbigblocks = 8;
@@ -83,10 +48,6 @@ void chol_cublas_codelet_update_u21(void *descr[], void *_args);
 void chol_cublas_codelet_update_u22(void *descr[], void *_args);
 #endif
 
-extern struct starpu_perfmodel_t chol_model_11;
-extern struct starpu_perfmodel_t chol_model_21;
-extern struct starpu_perfmodel_t chol_model_22;
-
 static void __attribute__((unused)) parse_args(int argc, char **argv)
 {
 	int i;

+ 2 - 1
mpi/examples/cholesky/mpi_cholesky_distributed.c

@@ -81,6 +81,7 @@ static void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblo
 
 	starpu_mpi_barrier(MPI_COMM_WORLD);
 	gettimeofday(&start, NULL);
+
         for(x = 0; x < nblocks ;  x++) {
                 for (y = 0; y < nblocks; y++) {
                         int mpi_rank = my_distrib(x, y, nodes);
@@ -160,7 +161,7 @@ static void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblo
 		double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 		fprintf(stderr, "Computation took (in ms)\n");
 		fprintf(stdout, "%2.2f\n", timing/1000);
-	
+
 		double flop = (1.0f*size*size*size)/3.0f;
 		fprintf(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 	}

+ 1 - 1
mpi/examples/cholesky/mpi_cholesky_models.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * 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

+ 5 - 1
mpi/examples/cholesky/mpi_cholesky_models.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * 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
@@ -20,4 +20,8 @@
 
 #include <starpu.h>
 
+extern struct starpu_perfmodel_t chol_model_11;
+extern struct starpu_perfmodel_t chol_model_21;
+extern struct starpu_perfmodel_t chol_model_22;
+
 #endif // __DW_CHOLESKY_MODELS_H__

+ 1 - 1
src/core/sched_policy.c

@@ -90,7 +90,7 @@ static void load_sched_policy(struct starpu_sched_policy_s *sched_policy, struct
 	policy->deinit_sched = sched_policy->deinit_sched;
 	policy->push_task = sched_policy->push_task;
 	policy->pop_task = sched_policy->pop_task;
-    policy->post_exec_hook = sched_policy->post_exec_hook;
+	policy->post_exec_hook = sched_policy->post_exec_hook;
 	policy->pop_every_task = sched_policy->pop_every_task;
 	policy->push_task_notify = sched_policy->push_task_notify;
 	policy->policy_name = sched_policy->policy_name;