Sfoglia il codice sorgente

Workers can handling disks operations

Corentin Salingue 7 anni fa
parent
commit
22979c5fa9
4 ha cambiato i file con 30 aggiunte e 21 eliminazioni
  1. 23 1
      src/core/disk.c
  2. 1 1
      src/core/disk.h
  3. 6 17
      src/datawizard/coherency.c
  4. 0 2
      src/datawizard/data_request.c

+ 23 - 1
src/core/disk.c

@@ -89,6 +89,28 @@ int starpu_disk_register(struct starpu_disk_ops *func, void *parameter, starpu_s
                 _starpu_register_bus(numa_node, disk_memnode);
         }
 
+	/* workers can manage disk memnode */
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
+	int worker;
+	for (worker = 0; worker < starpu_worker_get_count(); worker++)
+	{
+		struct _starpu_worker *workerarg = &config->workers[worker];
+		_starpu_memory_node_add_nworkers(disk_memnode);
+		_starpu_worker_drives_memory_node(workerarg, disk_memnode);
+	}
+	
+	//Add bus for disk <-> disk copy
+	if (func->copy != NULL)
+	{
+		int disk;
+		for (disk = 0; disk < disk_number; disk++)
+			if (disk_register_list[disk]->functions->copy != NULL)
+			{
+				_starpu_register_bus(disk_memnode, disk);
+				_starpu_register_bus(disk, disk_memnode);
+			}
+	}
+
 	/* connect disk */
 	void *base = func->plug(parameter, size);
 
@@ -418,7 +440,7 @@ static int get_location_with_node(unsigned node)
 	return -1;
 }
 
-int _starpu_is_same_kind_disk(unsigned node1, unsigned node2)
+int _starpu_disk_can_copy(unsigned node1, unsigned node2)
 {
 	if (starpu_node_get_kind(node1) == STARPU_DISK_RAM && starpu_node_get_kind(node2) == STARPU_DISK_RAM)
 	{

+ 1 - 1
src/core/disk.h

@@ -49,7 +49,7 @@ int starpu_disk_test_request(struct _starpu_async_channel *async_channel);
 void starpu_disk_free_request(struct _starpu_async_channel *async_channel);
 
 /* interface to compare memory disk */
-int _starpu_is_same_kind_disk(unsigned node1, unsigned node2);
+int _starpu_disk_can_copy(unsigned node1, unsigned node2);
 
 /* change disk flag */
 

+ 6 - 17
src/datawizard/coherency.c

@@ -220,10 +220,6 @@ void _starpu_update_data_state(starpu_data_handle_t handle,
 
 static int worker_supports_direct_access(unsigned node, unsigned handling_node)
 {
-	/* only support disk <-> ram and disk <-> disk */
-	if (starpu_node_get_kind(node) == STARPU_DISK_RAM || starpu_node_get_kind(handling_node) == STARPU_DISK_RAM)
-		return 0;
-
 	if (node == handling_node)
 		return 1;
 
@@ -261,6 +257,12 @@ static int worker_supports_direct_access(unsigned node, unsigned handling_node)
 		case STARPU_MIC_RAM:
 			/* TODO: We don't handle direct MIC-MIC transfers yet */
 			return 0;
+		case STARPU_DISK_RAM:
+			/* Each worker can manage disks but disk <-> disk is not always allowed */
+			if (starpu_node_get_kind(handling_node) == STARPU_DISK_RAM && !(_starpu_disk_can_copy(node, handling_node)))
+				return 0;
+
+			return 1;
                 case STARPU_MPI_MS_RAM:
                 {
                         enum starpu_node_kind kind = starpu_node_get_kind(handling_node);
@@ -304,19 +306,6 @@ static int link_supports_direct_transfers(starpu_data_handle_t handle, unsigned
 		return 1;
 	}
 
-	/* Link between disk and ram */
-	if ((starpu_node_get_kind(src_node) == STARPU_DISK_RAM && starpu_node_get_kind(dst_node) == STARPU_CPU_RAM) ||
-	    (starpu_node_get_kind(src_node) == STARPU_CPU_RAM && starpu_node_get_kind(dst_node) == STARPU_DISK_RAM))
-	{
-		/* FIXME: not necessarily a worker :/ */
-		*handling_node = STARPU_MAIN_RAM;
-		return 1;
-	}
-
-	/* link between disk and disk, and they have the same kind */
-	if (_starpu_is_same_kind_disk(src_node, dst_node))
-		return 1;
-
 	return 0;
 }
 

+ 0 - 2
src/datawizard/data_request.c

@@ -274,8 +274,6 @@ int _starpu_wait_data_request_completion(struct _starpu_data_request *r, unsigne
 void _starpu_post_data_request(struct _starpu_data_request *r)
 {
 	unsigned handling_node = r->handling_node;
-	/* We don't have a worker for disk nodes, these should have been posted to a main RAM node */
-	STARPU_ASSERT(starpu_node_get_kind(handling_node) != STARPU_DISK_RAM);
 	STARPU_ASSERT(starpu_node_get_kind(handling_node) == STARPU_CPU_RAM || _starpu_memory_node_get_nworkers(handling_node));
 
 //	_STARPU_DEBUG("POST REQUEST\n");