Kaynağa Gözat

mpi: Use req->node for memory reservation on Recv

Samuel Thibault 4 yıl önce
ebeveyn
işleme
6b8c17d93c

+ 1 - 1
mpi/src/mpi/starpu_mpi_mpi.c

@@ -173,7 +173,7 @@ void _starpu_mpi_submit_ready_request(void *arg)
 	if (req->reserved_size)
 	{
 		/* The core will have really allocated the reception buffer now, release our reservation */
-		starpu_memory_deallocate(STARPU_MAIN_RAM, req->reserved_size);
+		starpu_memory_deallocate(req->node, req->reserved_size);
 		req->reserved_size = 0;
 	}
 

+ 1 - 1
mpi/src/nmad/starpu_mpi_nmad.c

@@ -445,7 +445,7 @@ void _starpu_mpi_submit_ready_request(void *arg)
 	if (req->reserved_size)
 	{
 		/* The core will have really allocated the reception buffer now, release our reservation */
-		starpu_memory_deallocate(STARPU_MAIN_RAM, req->reserved_size);
+		starpu_memory_deallocate(req->node, req->reserved_size);
 		req->reserved_size = 0;
 	}
 

+ 7 - 3
mpi/src/starpu_mpi.c

@@ -36,6 +36,8 @@
 
 static void _starpu_mpi_isend_irecv_common(struct _starpu_mpi_req *req, enum starpu_data_access_mode mode, int sequential_consistency)
 {
+	unsigned node = STARPU_MAIN_RAM; // For now
+
 	/* Asynchronously request StarPU to fetch the data in main memory: when
 	 * it is available in main memory, _starpu_mpi_submit_ready_request(req) is called and
 	 * the request is actually submitted */
@@ -47,19 +49,21 @@ static void _starpu_mpi_isend_irecv_common(struct _starpu_mpi_req *req, enum sta
 		if (size)
 		{
 			/* This will potentially block */
-			starpu_memory_allocate(STARPU_MAIN_RAM, size, STARPU_MEMORY_WAIT);
+			starpu_memory_allocate(node, size, STARPU_MEMORY_WAIT);
 			req->reserved_size = size;
+			/* This also decides where we will store the data */
+			req->node = node;
 		}
 	}
 
 	if (sequential_consistency)
 	{
-		starpu_data_acquire_on_node_cb_sequential_consistency_sync_jobids(req->data_handle, STARPU_MAIN_RAM, mode, _starpu_mpi_submit_ready_request, (void *)req, 1 /*sequential consistency*/, 1, &req->pre_sync_jobid, &req->post_sync_jobid);
+		starpu_data_acquire_on_node_cb_sequential_consistency_sync_jobids(req->data_handle, node, mode, _starpu_mpi_submit_ready_request, (void *)req, 1 /*sequential consistency*/, 1, &req->pre_sync_jobid, &req->post_sync_jobid);
 	}
 	else
 	{
 		/* post_sync_job_id has already been filled */
-		starpu_data_acquire_on_node_cb_sequential_consistency_sync_jobids(req->data_handle, STARPU_MAIN_RAM, mode, _starpu_mpi_submit_ready_request, (void *)req, 0 /*sequential consistency*/, 1, &req->pre_sync_jobid, NULL);
+		starpu_data_acquire_on_node_cb_sequential_consistency_sync_jobids(req->data_handle, node, mode, _starpu_mpi_submit_ready_request, (void *)req, 0 /*sequential consistency*/, 1, &req->pre_sync_jobid, NULL);
 	}
 }