소스 검색

add missing functions to use a mpi node as master-slave

Corentin Salingue 8 년 전
부모
커밋
80dde6e7b2
3개의 변경된 파일22개의 추가작업 그리고 13개의 파일을 삭제
  1. 13 13
      src/drivers/mp_common/mp_common.c
  2. 8 0
      src/drivers/mpi/driver_mpi_sink.c
  3. 1 0
      src/drivers/mpi/driver_mpi_sink.h

+ 13 - 13
src/drivers/mp_common/mp_common.c

@@ -234,9 +234,9 @@ _starpu_mp_common_node_create(enum _starpu_mp_node_kind node_kind,
         node->init = _starpu_mpi_source_init;
         node->launch_workers = NULL;
         node->deinit = _starpu_mpi_source_deinit;
-   /*     node->report_error = 
+   /*     node->report_error = */
 
-	*/	node->mp_recv_is_ready = _starpu_mpi_common_recv_is_ready;
+	 	node->mp_recv_is_ready = _starpu_mpi_common_recv_is_ready;
 		node->mp_send = _starpu_mpi_common_send;
 		node->mp_recv = _starpu_mpi_common_recv;
 		node->dt_send = _starpu_mpi_common_send;
@@ -245,8 +245,8 @@ _starpu_mp_common_node_create(enum _starpu_mp_node_kind node_kind,
         node->dt_recv_from_device = _starpu_mpi_common_recv_from_device;
 
 		node->get_kernel_from_job = _starpu_mpi_ms_src_get_kernel_from_job;
-/*		node->lookup = 
-*/		node->bind_thread = NULL;
+		node->lookup = NULL;
+		node->bind_thread = NULL;
 		node->execute = NULL;
 		node->allocate = NULL;
 		node->free = NULL;
@@ -264,22 +264,22 @@ _starpu_mp_common_node_create(enum _starpu_mp_node_kind node_kind,
         node->init = _starpu_mpi_sink_init;
         node->launch_workers = _starpu_mpi_sink_launch_workers;
         node->deinit = _starpu_mpi_sink_deinit;
-    /*    node->report_error = 
+    /*    node->report_error =  */
 
-	*/	node->mp_recv_is_ready = _starpu_mpi_common_recv_is_ready;
+    	node->mp_recv_is_ready = _starpu_mpi_common_recv_is_ready;
         node->mp_send = _starpu_mpi_common_send;
 		node->mp_recv = _starpu_mpi_common_recv;
 		node->dt_send = _starpu_mpi_common_send;
 		node->dt_recv = _starpu_mpi_common_recv;
 
-	/*	node->get_kernel_from_job = 
-		node->lookup = 
-*/		node->bind_thread = _starpu_mpi_sink_bind_thread;
-/*		node->execute = 
-		node->allocate = 
-		node->free = 
+		node->get_kernel_from_job = NULL;
+		node->lookup = _starpu_mpi_sink_lookup;
+		node->bind_thread = _starpu_mpi_sink_bind_thread;
+		node->execute = _starpu_sink_common_execute;
+		node->allocate = _starpu_sink_common_allocate;
+		node->free = _starpu_sink_common_free;
 
-        */
+        
     }
 		break;
 #endif /* STARPU_USE_MPI_MASTER_SLAVE */

+ 8 - 0
src/drivers/mpi/driver_mpi_sink.c

@@ -17,6 +17,8 @@
 
 
 #include <mpi.h>
+#include <dlfcn.h>
+
 #include "driver_mpi_sink.h"
 #include "driver_mpi_common.h"
 
@@ -34,6 +36,12 @@ void _starpu_mpi_sink_deinit(struct _starpu_mp_node *node)
     //TODO
 }
 
+void (*_starpu_mpi_sink_lookup (const struct _starpu_mp_node * node STARPU_ATTRIBUTE_UNUSED, char* func_name))(void)
+{
+	void *dl_handle = dlopen(NULL, RTLD_NOW);
+	return dlsym(dl_handle, func_name);
+}
+
 void _starpu_mpi_sink_launch_workers(struct _starpu_mp_node *node)
 {
     //TODO

+ 1 - 0
src/drivers/mpi/driver_mpi_sink.h

@@ -26,6 +26,7 @@ void _starpu_mpi_sink_init(struct _starpu_mp_node *node);
 void _starpu_mpi_sink_deinit(struct _starpu_mp_node *node);
 void _starpu_mpi_sink_launch_workers(struct _starpu_mp_node *node);
 void _starpu_mpi_sink_bind_thread(const struct _starpu_mp_node *mp_node STARPU_ATTRIBUTE_UNUSED, int coreid, int * core_table, int nb_core);
+void (*_starpu_mpi_sink_lookup (const struct _starpu_mp_node * node STARPU_ATTRIBUTE_UNUSED, char* func_name))(void);
 
 ///* Send *MSG which can be an answer or data, to MPI SOURCE. */
 //extern void _starpu_mpi_sink_send(const struct _starpu_mp_node *source,