Browse Source

merge branches/mpi_engine@18360: mpi: code cleaning

Nathalie Furmento 8 years ago
parent
commit
a1ccfcdcd5

+ 2 - 2
mpi/src/load_balancer/policy/load_heat_propagation.c

@@ -252,7 +252,7 @@ static void update_data_ranks()
 
 			for (j = 0; j < ndata_to_update; j++)
 			{
-				starpu_data_handle_t handle = _starpu_mpi_data_get_data_handle_from_tag((data_movements_get_tags_table(data_movements_handles[i]))[j]);
+				starpu_data_handle_t handle = _starpu_mpi_tag_get_data_handle_from_tag((data_movements_get_tags_table(data_movements_handles[i]))[j]);
 				STARPU_ASSERT(handle);
 				int dst_rank = (data_movements_get_ranks_table(data_movements_handles[i]))[j];
 
@@ -517,7 +517,7 @@ static void move_back_data()
 
 			for (j = 0; j < ndata_to_update; j++)
 			{
-				starpu_data_handle_t handle = _starpu_mpi_data_get_data_handle_from_tag((data_movements_get_tags_table(data_movements_handles[i]))[j]);
+				starpu_data_handle_t handle = _starpu_mpi_tag_get_data_handle_from_tag((data_movements_get_tags_table(data_movements_handles[i]))[j]);
 				STARPU_ASSERT(handle);
 
 				int dst_rank = (data_movements_get_ranks_table(data_movements_handles[i]))[j];

+ 12 - 12
mpi/src/starpu_mpi.c

@@ -207,7 +207,7 @@ static void _starpu_mpi_submit_ready_request(void *arg)
 		 * before the next submission of the envelope-catching request. */
 		if (req->is_internal_req)
 		{
-			_starpu_mpi_handle_allocate_datatype(req->data_handle, req);
+			_starpu_mpi_datatype_allocate(req->data_handle, req);
 			if (req->registered_datatype == 1)
 			{
 				req->count = 1;
@@ -276,7 +276,7 @@ static void _starpu_mpi_submit_ready_request(void *arg)
 				if (sync_req)
 				{
 					req->sync = 1;
-					_starpu_mpi_handle_allocate_datatype(req->data_handle, req);
+					_starpu_mpi_datatype_allocate(req->data_handle, req);
 					if (req->registered_datatype == 1)
 					{
 						req->count = 1;
@@ -463,7 +463,7 @@ static void _starpu_mpi_isend_data_func(struct _starpu_mpi_req *req)
 
 static void _starpu_mpi_isend_size_func(struct _starpu_mpi_req *req)
 {
-	_starpu_mpi_handle_allocate_datatype(req->data_handle, req);
+	_starpu_mpi_datatype_allocate(req->data_handle, req);
 
 	_STARPU_MPI_CALLOC(req->envelope, 1,sizeof(struct _starpu_mpi_envelope));
 	req->envelope->mode = _STARPU_MPI_ENVELOPE_DATA;
@@ -1061,7 +1061,7 @@ static void _starpu_mpi_handle_request_termination(struct _starpu_mpi_req *req)
 			}
 			else
 			{
-				_starpu_mpi_handle_free_datatype(req->data_handle, &req->datatype);
+				_starpu_mpi_datatype_free(req->data_handle, &req->datatype);
 			}
 		}
 	}
@@ -1251,7 +1251,7 @@ static void _starpu_mpi_receive_early_data(struct _starpu_mpi_envelope *envelope
 
 	starpu_data_handle_t data_handle = NULL;
 	STARPU_PTHREAD_MUTEX_UNLOCK(&progress_mutex);
-	data_handle = _starpu_mpi_data_get_data_handle_from_tag(envelope->data_tag);
+	data_handle = _starpu_mpi_tag_get_data_handle_from_tag(envelope->data_tag);
 	STARPU_PTHREAD_MUTEX_LOCK(&progress_mutex);
 
 	if (data_handle && starpu_data_get_interface_id(data_handle) < STARPU_MAX_INTERFACE_ID)
@@ -1508,7 +1508,7 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 						_STARPU_MPI_DEBUG(2000, "Request sync %d\n", envelope->sync);
 
 						early_request->sync = envelope->sync;
-						_starpu_mpi_handle_allocate_datatype(early_request->data_handle, early_request);
+						_starpu_mpi_datatype_allocate(early_request->data_handle, early_request);
 						if (early_request->registered_datatype == 1)
 						{
 							early_request->count = 1;
@@ -1583,10 +1583,10 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 
 	STARPU_PTHREAD_MUTEX_UNLOCK(&progress_mutex);
 
-	_starpu_mpi_sync_data_free();
-	_starpu_mpi_early_data_free();
-	_starpu_mpi_early_request_free();
-	_starpu_mpi_datatype_free();
+	_starpu_mpi_sync_data_shutdown();
+	_starpu_mpi_early_data_shutdown();
+	_starpu_mpi_early_request_shutdown();
+	_starpu_mpi_datatype_shutdown();
 	free(argc_argv);
 
 	return NULL;
@@ -1699,7 +1699,7 @@ void _starpu_mpi_progress_shutdown(int *value)
 
 void _starpu_mpi_clear_cache(starpu_data_handle_t data_handle)
 {
-	_starpu_mpi_data_release_tag(data_handle);
+	_starpu_mpi_tag_data_release(data_handle);
 	struct _starpu_mpi_node_tag *mpi_data = data_handle->mpi_data;
 	_starpu_mpi_cache_flush(mpi_data->comm, data_handle);
 	free(data_handle->mpi_data);
@@ -1719,7 +1719,7 @@ void starpu_mpi_data_register_comm(starpu_data_handle_t data_handle, int tag, in
 		mpi_data->rank = -1;
 		mpi_data->comm = MPI_COMM_WORLD;
 		data_handle->mpi_data = mpi_data;
-		_starpu_mpi_data_register_tag(data_handle, tag);
+		_starpu_mpi_tag_data_register(data_handle, tag);
 		_starpu_data_set_unregister_hook(data_handle, _starpu_mpi_clear_cache);
 	}
 

+ 3 - 3
mpi/src/starpu_mpi_cache.c

@@ -55,7 +55,7 @@ int starpu_mpi_cache_set(int enabled)
 		{
 			// We need to clean the cache
 			starpu_mpi_cache_flush_all_data(_starpu_cache_comm);
-			_starpu_mpi_cache_free(_starpu_cache_comm_size);
+			_starpu_mpi_cache_shutdown(_starpu_cache_comm_size);
 		}
 		_starpu_cache_enabled = 0;
 	}
@@ -129,7 +129,7 @@ void _starpu_mpi_cache_empty_tables(int world_size)
 	}
 }
 
-void _starpu_mpi_cache_free()
+void _starpu_mpi_cache_shutdown()
 {
 	int i;
 
@@ -147,7 +147,7 @@ void _starpu_mpi_cache_free()
 	free(_cache_sent_mutex);
 	free(_cache_received_mutex);
 
-	_starpu_mpi_cache_stats_free();
+	_starpu_mpi_cache_stats_shutdown();
 }
 
 void _starpu_mpi_cache_sent_data_clear(MPI_Comm comm, starpu_data_handle_t data)

+ 2 - 2
mpi/src/starpu_mpi_cache.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2011, 2012, 2013, 2014, 2015  CNRS
+ * Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016  CNRS
  * Copyright (C) 2011-2014  Université de Bordeaux
  * Copyright (C) 2014 INRIA
  *
@@ -29,7 +29,7 @@ extern "C" {
 
 extern int _starpu_cache_enabled;
 void _starpu_mpi_cache_init(MPI_Comm comm);
-void _starpu_mpi_cache_free();
+void _starpu_mpi_cache_shutdown();
 
 /*
  * If the data is already available in the cache, return a pointer to the data

+ 1 - 1
mpi/src/starpu_mpi_cache_stats.c

@@ -41,7 +41,7 @@ void _starpu_mpi_cache_stats_init(MPI_Comm comm)
 	_STARPU_MPI_CALLOC(comm_cache_amount, world_size, sizeof(size_t));
 }
 
-void _starpu_mpi_cache_stats_free()
+void _starpu_mpi_cache_stats_shutdown()
 {
 	if (stats_enabled == 0) return;
 	free(comm_cache_amount);

+ 2 - 2
mpi/src/starpu_mpi_cache_stats.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014, 2015  CNRS
+ * Copyright (C) 2014, 2015, 2016  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -26,7 +26,7 @@ extern "C" {
 #endif
 
 void _starpu_mpi_cache_stats_init(MPI_Comm comm);
-void _starpu_mpi_cache_stats_free();
+void _starpu_mpi_cache_stats_shutdown();
 
 void _starpu_mpi_cache_stats_update(unsigned dst, starpu_data_handle_t data_handle, int count);
 

+ 1 - 1
mpi/src/starpu_mpi_comm.c

@@ -61,7 +61,7 @@ void _starpu_mpi_comm_init(MPI_Comm comm)
 	_starpu_mpi_comm_register(comm);
 }
 
-void _starpu_mpi_comm_free()
+void _starpu_mpi_comm_shutdown()
 {
 	int i;
 	for(i=0 ; i<_starpu_mpi_comm_nb ; i++)

+ 2 - 2
mpi/src/starpu_mpi_comm.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015  CNRS
+ * Copyright (C) 2015, 2016  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -26,7 +26,7 @@ extern "C" {
 #endif
 
 void _starpu_mpi_comm_init(MPI_Comm comm);
-void _starpu_mpi_comm_free();
+void _starpu_mpi_comm_shutdown();
 void _starpu_mpi_comm_register(MPI_Comm comm);
 void _starpu_mpi_comm_post_recv();
 int _starpu_mpi_comm_test_recv(MPI_Status *status, struct _starpu_mpi_envelope **envelope, MPI_Comm *comm);

+ 3 - 3
mpi/src/starpu_mpi_datatype.c

@@ -35,7 +35,7 @@ void _starpu_mpi_datatype_init(void)
 	STARPU_PTHREAD_MUTEX_INIT(&_starpu_mpi_datatype_funcs_table_mutex, NULL);
 }
 
-void _starpu_mpi_datatype_free(void)
+void _starpu_mpi_datatype_shutdown(void)
 {
 	STARPU_PTHREAD_MUTEX_DESTROY(&_starpu_mpi_datatype_funcs_table_mutex);
 }
@@ -155,7 +155,7 @@ static starpu_mpi_datatype_allocate_func_t handle_to_datatype_funcs[STARPU_MAX_I
 	[STARPU_MULTIFORMAT_INTERFACE_ID] = NULL,
 };
 
-void _starpu_mpi_handle_allocate_datatype(starpu_data_handle_t data_handle, struct _starpu_mpi_req *req)
+void _starpu_mpi_datatype_allocate(starpu_data_handle_t data_handle, struct _starpu_mpi_req *req)
 {
 	enum starpu_data_interface_id id = starpu_data_get_interface_id(data_handle);
 
@@ -243,7 +243,7 @@ static starpu_mpi_datatype_free_func_t handle_free_datatype_funcs[STARPU_MAX_INT
 	[STARPU_MULTIFORMAT_INTERFACE_ID] = NULL,
 };
 
-void _starpu_mpi_handle_free_datatype(starpu_data_handle_t data_handle, MPI_Datatype *datatype)
+void _starpu_mpi_datatype_free(starpu_data_handle_t data_handle, MPI_Datatype *datatype)
 {
 	enum starpu_data_interface_id id = starpu_data_get_interface_id(data_handle);
 

+ 3 - 3
mpi/src/starpu_mpi_datatype.h

@@ -26,10 +26,10 @@ extern "C" {
 #endif
 
 void _starpu_mpi_datatype_init(void);
-void _starpu_mpi_datatype_free(void);
+void _starpu_mpi_datatype_shutdown(void);
 
-void _starpu_mpi_handle_allocate_datatype(starpu_data_handle_t data_handle, struct _starpu_mpi_req *req);
-void _starpu_mpi_handle_free_datatype(starpu_data_handle_t data_handle, MPI_Datatype *datatype);
+void _starpu_mpi_datatype_allocate(starpu_data_handle_t data_handle, struct _starpu_mpi_req *req);
+void _starpu_mpi_datatype_free(starpu_data_handle_t data_handle, MPI_Datatype *datatype);
 
 #ifdef __cplusplus
 }

+ 1 - 1
mpi/src/starpu_mpi_early_data.c

@@ -45,7 +45,7 @@ void _starpu_mpi_early_data_check_termination(void)
 	STARPU_ASSERT_MSG(_starpu_mpi_early_data_handle_hashmap_count == 0, "Number of unexpected received messages left is not zero (but %d), did you forget to post a receive corresponding to a send?", _starpu_mpi_early_data_handle_hashmap_count);
 }
 
-void _starpu_mpi_early_data_free(void)
+void _starpu_mpi_early_data_shutdown(void)
 {
 	struct _starpu_mpi_early_data_handle_hashlist *current, *tmp;
 	HASH_ITER(hh, _starpu_mpi_early_data_handle_hashmap, current, tmp)

+ 1 - 1
mpi/src/starpu_mpi_early_data.h

@@ -42,7 +42,7 @@ LIST_TYPE(_starpu_mpi_early_data_handle,
 
 void _starpu_mpi_early_data_init(void);
 void _starpu_mpi_early_data_check_termination(void);
-void _starpu_mpi_early_data_free(void);
+void _starpu_mpi_early_data_shutdown(void);
 
 struct _starpu_mpi_early_data_handle *_starpu_mpi_early_data_create(struct _starpu_mpi_envelope *envelope, int source, MPI_Comm comm) STARPU_ATTRIBUTE_MALLOC;
 struct _starpu_mpi_early_data_handle *_starpu_mpi_early_data_find(struct _starpu_mpi_node_tag *node_tag);

+ 1 - 1
mpi/src/starpu_mpi_early_request.c

@@ -40,7 +40,7 @@ void _starpu_mpi_early_request_init()
 	STARPU_PTHREAD_MUTEX_INIT(&_starpu_mpi_early_request_mutex, NULL);
 }
 
-void _starpu_mpi_early_request_free()
+void _starpu_mpi_early_request_shutdown()
 {
 	struct _starpu_mpi_early_request_hashlist *entry, *tmp;
 	HASH_ITER(hh, _starpu_mpi_early_request_hash, entry, tmp)

+ 2 - 2
mpi/src/starpu_mpi_early_request.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2014  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -29,7 +29,7 @@ extern "C" {
 #endif
 
 void _starpu_mpi_early_request_init(void);
-void _starpu_mpi_early_request_free(void);
+void _starpu_mpi_early_request_shutdown(void);
 int _starpu_mpi_early_request_count(void);
 void _starpu_mpi_early_request_check_termination(void);
 

+ 4 - 4
mpi/src/starpu_mpi_init.c

@@ -166,10 +166,10 @@ int starpu_mpi_shutdown(void)
 	_STARPU_MPI_TRACE_STOP(rank, world_size);
 
 	_starpu_mpi_comm_amounts_display(stderr, rank);
-	_starpu_mpi_comm_amounts_free();
-	_starpu_mpi_cache_free(world_size);
-	_starpu_mpi_tag_free();
-	_starpu_mpi_comm_free();
+	_starpu_mpi_comm_amounts_shutdown();
+	_starpu_mpi_cache_shutdown(world_size);
+	_starpu_mpi_tag_shutdown();
+	_starpu_mpi_comm_shutdown();
 
 	return 0;
 }

+ 1 - 1
mpi/src/starpu_mpi_stats.c

@@ -42,7 +42,7 @@ void _starpu_mpi_comm_amounts_init(MPI_Comm comm)
 	_STARPU_MPI_CALLOC(comm_amount, world_size, sizeof(size_t));
 }
 
-void _starpu_mpi_comm_amounts_free()
+void _starpu_mpi_comm_amounts_shutdown()
 {
 	if (stats_enabled == 0) return;
 	free(comm_amount);

+ 2 - 2
mpi/src/starpu_mpi_stats.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012, 2017  CNRS
+ * Copyright (C) 2012, 2016, 2017  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -26,7 +26,7 @@ extern "C" {
 #endif
 
 void _starpu_mpi_comm_amounts_init(MPI_Comm comm);
-void _starpu_mpi_comm_amounts_free();
+void _starpu_mpi_comm_amounts_shutdown();
 void _starpu_mpi_comm_amounts_inc(MPI_Comm comm, unsigned dst, MPI_Datatype datatype, int count);
 void _starpu_mpi_comm_amounts_display(FILE *stream, int node);
 

+ 1 - 1
mpi/src/starpu_mpi_sync_data.c

@@ -39,7 +39,7 @@ void _starpu_mpi_sync_data_init(void)
 	_starpu_mpi_sync_data_handle_hashmap_count = 0;
 }
 
-void _starpu_mpi_sync_data_free(void)
+void _starpu_mpi_sync_data_shutdown(void)
 {
 	struct _starpu_mpi_sync_data_handle_hashlist *current, *tmp;
 	HASH_ITER(hh, _starpu_mpi_sync_data_handle_hashmap, current, tmp)

+ 2 - 2
mpi/src/starpu_mpi_sync_data.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015  CNRS
+ * Copyright (C) 2015, 2016  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -29,7 +29,7 @@ extern "C" {
 
 void _starpu_mpi_sync_data_init(void);
 void _starpu_mpi_sync_data_check_termination(void);
-void _starpu_mpi_sync_data_free(void);
+void _starpu_mpi_sync_data_shutdown(void);
 
 struct _starpu_mpi_req *_starpu_mpi_sync_data_find(int data_tag, int source, MPI_Comm comm);
 void _starpu_mpi_sync_data_add(struct _starpu_mpi_req *req);

+ 6 - 6
mpi/src/starpu_mpi_tag.c

@@ -40,7 +40,7 @@ void _starpu_mpi_tag_init(void)
 	_starpu_spin_init(&registered_tag_handles_lock);
 }
 
-void _starpu_mpi_tag_free(void)
+void _starpu_mpi_tag_shutdown(void)
 {
      	struct handle_tag_entry *tag_entry, *tag_tmp;
 
@@ -55,7 +55,7 @@ void _starpu_mpi_tag_free(void)
 	registered_tag_handles = NULL;
 }
 
-starpu_data_handle_t _starpu_mpi_data_get_data_handle_from_tag(int tag)
+starpu_data_handle_t _starpu_mpi_tag_get_data_handle_from_tag(int tag)
 {
 	struct handle_tag_entry *ret;
 
@@ -73,13 +73,13 @@ starpu_data_handle_t _starpu_mpi_data_get_data_handle_from_tag(int tag)
 	}
 }
 
-void _starpu_mpi_data_register_tag(starpu_data_handle_t handle, int tag)
+void _starpu_mpi_tag_data_register(starpu_data_handle_t handle, int tag)
 {
 	struct handle_tag_entry *entry;
 	_STARPU_MPI_MALLOC(entry, sizeof(*entry));
 
-	STARPU_ASSERT_MSG(!(_starpu_mpi_data_get_data_handle_from_tag(tag)),
-			  "There is already a data handle %p registered with the tag %d\n", _starpu_mpi_data_get_data_handle_from_tag(tag), tag);
+	STARPU_ASSERT_MSG(!(_starpu_mpi_tag_get_data_handle_from_tag(tag)),
+			  "There is already a data handle %p registered with the tag %d\n", _starpu_mpi_tag_get_data_handle_from_tag(tag), tag);
 
 	_STARPU_MPI_DEBUG(42, "Adding handle %p with tag %d in hashtable\n", handle, tag);
 
@@ -91,7 +91,7 @@ void _starpu_mpi_data_register_tag(starpu_data_handle_t handle, int tag)
 	_starpu_spin_unlock(&registered_tag_handles_lock);
 }
 
-int _starpu_mpi_data_release_tag(starpu_data_handle_t handle)
+int _starpu_mpi_tag_data_release(starpu_data_handle_t handle)
 {
 	int tag = starpu_mpi_data_get_tag(handle);
 

+ 6 - 5
mpi/src/starpu_mpi_tag.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015  CNRS
+ * Copyright (C) 2015, 2016  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -26,10 +26,11 @@ extern "C" {
 #endif
 
 void _starpu_mpi_tag_init(void);
-void _starpu_mpi_tag_free(void);
-void _starpu_mpi_data_register_tag(starpu_data_handle_t handle, int tag);
-int _starpu_mpi_data_release_tag(starpu_data_handle_t handle);
-starpu_data_handle_t _starpu_mpi_data_get_data_handle_from_tag(int tag);
+void _starpu_mpi_tag_shutdown(void);
+
+void _starpu_mpi_tag_data_register(starpu_data_handle_t handle, int tag);
+int _starpu_mpi_tag_data_release(starpu_data_handle_t handle);
+starpu_data_handle_t _starpu_mpi_tag_get_data_handle_from_tag(int tag);
 
 #ifdef __cplusplus
 }