浏览代码

mpi: remove files which are no longer needed - clearing cache is now done directly and no longer through a task

Nathalie Furmento 12 年之前
父节点
当前提交
6ad304e82a
共有 4 个文件被更改,包括 10 次插入135 次删除
  1. 0 2
      mpi/Makefile.am
  2. 10 2
      mpi/starpu_mpi_insert_task.c
  3. 0 97
      mpi/starpu_mpi_insert_task_cache.c
  4. 0 34
      mpi/starpu_mpi_insert_task_cache.h

+ 0 - 2
mpi/Makefile.am

@@ -76,7 +76,6 @@ libstarpumpi_@STARPU_EFFECTIVE_VERSION@_la_LDFLAGS = $(ldflags) -no-undefined
 noinst_HEADERS =					\
 	starpu_mpi_private.h				\
 	starpu_mpi_fxt.h				\
-	starpu_mpi_insert_task_cache.h			\
 	starpu_mpi_stats.h
 
 versincludedir = $(includedir)/starpu/$(STARPU_EFFECTIVE_VERSION)
@@ -89,7 +88,6 @@ libstarpumpi_@STARPU_EFFECTIVE_VERSION@_la_SOURCES =	\
 	starpu_mpi_helper.c				\
 	starpu_mpi_datatype.c				\
 	starpu_mpi_insert_task.c			\
-	starpu_mpi_insert_task_cache.c			\
 	starpu_mpi_collective.c				\
 	starpu_mpi_stats.c
 

+ 10 - 2
mpi/starpu_mpi_insert_task.c

@@ -31,8 +31,16 @@
 /* Whether we are allowed to keep copies of remote data. Does not work
  * yet: the sender has to know whether the receiver has it, keeping it
  * in an array indexed by node numbers. */
-//#define MPI_CACHE 1
-#include <starpu_mpi_insert_task_cache.h>
+#define MPI_CACHE 1
+
+struct _starpu_data_entry
+{
+	UT_hash_handle hh;
+	void *data;
+};
+
+struct _starpu_data_entry **sent_data = NULL;
+struct _starpu_data_entry **received_data = NULL;
 
 static void _starpu_mpi_tables_init()
 {

+ 0 - 97
mpi/starpu_mpi_insert_task_cache.c

@@ -1,97 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2011, 2012  Centre National de la Recherche Scientifique
- * Copyright (C) 2011-2012  Université de Bordeaux 1
- *
- * 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
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <starpu_mpi_private.h>
-#include <starpu_mpi_insert_task_cache.h>
-#include <common/uthash.h>
-
-struct _starpu_mpi_clear_cache {
-        starpu_data_handle_t data;
-        int rank;
-        int mode;
-};
-
-struct _starpu_data_entry **sent_data = NULL;
-struct _starpu_data_entry **received_data = NULL;
-
-void _starpu_mpi_clear_cache_callback(void *callback_arg)
-{
-        struct _starpu_mpi_clear_cache *clear_cache = (struct _starpu_mpi_clear_cache *)callback_arg;
-
-        if (clear_cache->mode == _STARPU_MPI_CLEAR_SENT_DATA) {
-		struct _starpu_data_entry *entry;
-                _STARPU_MPI_DEBUG("Clearing sent cache for data %p and rank %d\n", clear_cache->data, clear_cache->rank);
-		HASH_FIND_PTR(sent_data[clear_cache->rank], &clear_cache->data, entry);
-		if (entry) HASH_DEL(sent_data[clear_cache->rank], entry);
-        }
-        else if (clear_cache->mode == _STARPU_MPI_CLEAR_RECEIVED_DATA) {
-		struct _starpu_data_entry *entry;
-                _STARPU_MPI_DEBUG("Clearing received cache for data %p and rank %d\n", clear_cache->data, clear_cache->rank);
-		HASH_FIND_PTR(received_data[clear_cache->rank], &clear_cache->data, entry);
-		if (entry) HASH_DEL(received_data[clear_cache->rank], entry);
-        }
-
-        free(clear_cache);
-}
-
-double _starpu_mpi_clear_cache_cost_function(struct starpu_task *task, unsigned nimpl)
-{
-	return 0;
-}
-
-static struct starpu_perfmodel _starpu_mpi_clear_cache_model =
-{
-	.cost_function = _starpu_mpi_clear_cache_cost_function,
-	.type = STARPU_COMMON,
-};
-
-static void _starpu_mpi_clear_cache_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
-{
-}
-
-static struct starpu_codelet _starpu_mpi_clear_cache_codelet =
-{
-	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
-	.cpu_funcs = {_starpu_mpi_clear_cache_func, NULL},
-	.cuda_funcs = {_starpu_mpi_clear_cache_func, NULL},
-	.opencl_funcs = {_starpu_mpi_clear_cache_func, NULL},
-	.nbuffers = 1,
-	.modes = {STARPU_RW},
-	.model = &_starpu_mpi_clear_cache_model
-	// The model has a cost function which returns 0 so as to allow the codelet to be scheduled anywhere
-};
-
-void _starpu_mpi_clear_cache_request(starpu_data_handle_t data_handle, int rank, int mode)
-{
-        struct starpu_task *task = starpu_task_create();
-
-	// We have a codelet with a empty function just to force the
-	// task being created to have a dependency on data_handle
-        task->cl = &_starpu_mpi_clear_cache_codelet;
-        task->handles[0] = data_handle;
-
-        struct _starpu_mpi_clear_cache *clear_cache = malloc(sizeof(struct _starpu_mpi_clear_cache));
-        clear_cache->data = data_handle;
-        clear_cache->rank = rank;
-        clear_cache->mode = mode;
-
-        task->callback_func = _starpu_mpi_clear_cache_callback;
-        task->callback_arg = clear_cache;
-        int ret = starpu_task_submit(task);
-        STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
-}
-

+ 0 - 34
mpi/starpu_mpi_insert_task_cache.h

@@ -1,34 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2011, 2012  Centre National de la Recherche Scientifique
- * Copyright (C) 2011  Université de Bordeaux 1
- *
- * 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
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-
-#include <starpu.h>
-#include <common/list.h>
-#include <common/uthash.h>
-
-#define _STARPU_MPI_CLEAR_SENT_DATA     0
-#define _STARPU_MPI_CLEAR_RECEIVED_DATA 1
-
-struct _starpu_data_entry
-{
-	UT_hash_handle hh;
-	void *data;
-};
-
-extern struct _starpu_data_entry **sent_data;
-extern struct _starpu_data_entry **received_data;
-
-void _starpu_mpi_clear_cache_request(starpu_data_handle_t data_handle, int rank, int mode);