ソースを参照

Allow the application to launch multiple StarPU drivers itself (instead of just one).

* include/starpu.h:
	rename field "not_launched_driver" into "not_launched_drivers"
	add field "n_not_launched_drivers"

* src/core/workers.c:
	edit _starpu_may_launch_driver() so that it checks all of the drivers given by the user in conf->not_launched_drivers
Cyril Roelandt 13 年 前
コミット
f988104459
共有2 個のファイルを変更した19 個の追加12 個の削除を含む
  1. 2 1
      include/starpu.h
  2. 17 11
      src/core/workers.c

+ 2 - 1
include/starpu.h

@@ -112,7 +112,8 @@ struct starpu_conf
 	int disable_asynchronous_copy;
 
 	/* A driver that the application will run in one of its own threads. */
-	struct starpu_driver *not_launched_driver;
+	struct starpu_driver *not_launched_drivers;
+	unsigned n_not_launched_drivers;
 };
 
 /* Initialize a starpu_conf structure with default values. */

+ 17 - 11
src/core/workers.c

@@ -215,20 +215,26 @@ static void _starpu_init_worker_queue(struct _starpu_worker *workerarg)
 static unsigned _starpu_may_launch_driver(struct starpu_conf *conf,
 					  struct starpu_driver *d)
 {
-	if (!conf->not_launched_driver)
+	if (conf->n_not_launched_drivers == 0 ||
+	    conf->not_launched_drivers == NULL)
 		return 1;
 
-	if (d->type != conf->not_launched_driver->type)
-		return 1;
-
-	switch (d->type)
+	/* Is <d> in conf->not_launched_drivers ? */
+	unsigned i;
+	for (i = 0; i < conf->n_not_launched_drivers; i++)
 	{
-	case STARPU_CUDA_WORKER:
-		if (d->id.cuda_id == conf->not_launched_driver->id.cuda_id)
-			return 0;
-		break;
-	default:
-		STARPU_ABORT();
+		if (d->type != conf->not_launched_drivers[i].type)
+			continue;
+
+		switch (d->type)
+		{
+		case STARPU_CUDA_WORKER:
+			if (d->id.cuda_id == conf->not_launched_drivers[i].id.cuda_id)
+				return 0;
+			break;
+		default:
+			STARPU_ABORT();
+		}
 	}
 
 	return 1;