Thibaud Lambert 12 роки тому
батько
коміт
2804769eb5

+ 4 - 0
src/core/topology.c

@@ -629,6 +629,10 @@ _starpu_init_mic_config (struct _starpu_machine_config *config,
 
 	/* _starpu_initialize_workers_mic_deviceid (config); */
 
+	mic_nodes[mic_idx].min_nworkers = topology->nworkers;
+	_starpu_mp_common_send_command(mic_nodes[mic_idx], STARPU_MIN_NWORKERS, &(mic_nodes[mic_idx].min_nworkers), sizeof(int));
+	_STARPU_DEBUG("Host: the min_nworkers of the Mic is: %d.\n", mic_nodes[mic_idx].min_nworkers );	
+
 	unsigned miccore_id;
 	for (miccore_id = 0; miccore_id < topology->nmiccores[mic_idx]; miccore_id++)
 	{

+ 5 - 1
src/drivers/mp_common/mp_common.h

@@ -58,7 +58,8 @@ enum _starpu_mp_command
 	STARPU_SINK_NBCORES = 0x15,
 	STARPU_ANSWER_SINK_NBCORES = 0x16,
 	STARPU_EXECUTION_SUBMITTED = 0x17,
-	STARPU_EXECUTION_COMPLETED = 0x18
+	STARPU_EXECUTION_COMPLETED = 0x18,
+	STARPU_MIN_NWORKERS = 0x19
 };
 
 enum _starpu_mp_node_kind
@@ -116,6 +117,9 @@ struct _starpu_mp_node
 	 * This is the devid both for the sink and the host. */
 	int devid;
 
+        /*The id of the lowest worker for the mic*/
+	int min_nworkers;
+
 	/* Only MIC use this for now !!
 	*  Is the number ok MIC on the system. */
 	unsigned int nb_mp_sinks;

+ 14 - 0
src/drivers/mp_common/sink_common.c

@@ -213,6 +213,16 @@ static void _starpu_sink_common_copy_to_sink(const struct _starpu_mp_node *mp_no
     mp_node->dt_send_to_device(mp_node, cmd->devid, cmd->addr, cmd->size);
 }
 
+static void _starpu_sink_min_nworkers(const struct _starpu_mp_node *mp_node, void * arg, 
+				      int arg_size)
+{
+	STARPU_ASSERT(arg_size == sizeof(int));
+
+	mp_node->min_nworkers = *((int*)arg);
+
+	_STARPU_DEBUG("Mic: my min_nworkers is: %d.\n", mp_node->min_nworkers);	
+}
+
 /* Function looping on the sink, waiting for tasks to execute.
  * If the caller is the host, don't do anything.
  */
@@ -272,6 +282,10 @@ void _starpu_sink_common_worker(void)
 				_starpu_sink_common_copy_to_sink(node, arg, arg_size);
 				break;
 
+		        case STARPU_MIN_NWORKERS:
+				_starpu_sink_min_nworkers(node, arg, arg_size);
+				break;
+
 			default:
 				printf("Oops, command %x unrecognized\n", command);
 		}