Changeset: c3f94502c053 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c3f94502c053
Removed Files:
        gdk/gdk_mapreduce.c
        gdk/gdk_mapreduce.h
Modified Files:
        clients/Tests/exports.stable.out
        gdk/Makefile.ag
Branch: default
Log Message:

Removed gdk_mapreduce.  It's not used at all.
It can always be recovered from the attic when we do need it.


diffs (204 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -267,7 +267,6 @@ gdk_return HEAPextend(Heap *h, size_t si
 size_t HEAPmemsize(Heap *h);
 size_t HEAPvmsize(Heap *h);
 lng IMPSimprintsize(BAT *b);
-void MRschedule(int taskcnt, void **arg, void( *cmd)(void *p));
 int MT_check_nr_cores(void);
 int MT_create_thread(MT_Id *t, void( *function)(void *), void *arg, enum 
MT_thr_detach d);
 void MT_exiting_thread(void);
diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag
--- a/gdk/Makefile.ag
+++ b/gdk/Makefile.ag
@@ -25,7 +25,7 @@ lib_gdk = {
                gdk_private.h gdk_delta.h gdk_logger.h gdk_posix.h \
                gdk_system.h gdk_system_private.h gdk_tm.h gdk_storage.h \
                gdk_calc.c gdk_calc.h gdk_calc_compare.h gdk_calc_private.h \
-               gdk_aggr.c gdk_group.c gdk_mapreduce.c gdk_mapreduce.h \
+               gdk_aggr.c gdk_group.c \
                gdk_imprints.c gdk_imprints.h \
                gdk_join.c \
                gdk_unique.c \
diff --git a/gdk/gdk_mapreduce.c b/gdk/gdk_mapreduce.c
deleted file mode 100644
--- a/gdk/gdk_mapreduce.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0.  If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * Copyright 2008-2015 MonetDB B.V.
- */
-
-/*
- * (co)  Martin L. Kersten 
- * This module provide a lightweight map-reduce scheduler for multicore 
systems.
- * A limited number of workers are initialized upfront, which take the tasks
- * from a central queue. The header of these task descriptors should comply
- * with the MRtask structure.
- *
- */
-#include "monetdb_config.h"
-#include "gdk.h"
-#include "gdk_mapreduce.h"
-
-typedef struct {
-       MT_Sema *sema;                  /* micro scheduler handle */
-       void (*cmd) (void *);           /* the function to be executed */
-       void *arg;                      /* the arguments of the function */
-} MRtask;
-
-/* each entry in the queue contains a list of tasks */
-typedef struct MRQUEUE {
-       MRtask *tasks;
-       int index;              /* next available task */
-       int size;               /* number of tasks */
-} MRqueue;
-
-static MRqueue *mrqueue;
-static int mrqsize = -1;       /* size of queue */
-static int mrqlast = -1;
-/* it's a shared resource, so we need locks */
-static MT_Lock mrqlock MT_LOCK_INITIALIZER("mrqlock");
-static MT_Sema mrqsema;                /* threads wait on empty queues */
-
-
-static void MRworker(void *);
-
-/* There is just a single queue for the workers */
-static void
-MRqueueCreate(int sz)
-{
-       int i;
-       MT_Id tid;
-
-#ifdef NEED_MT_LOCK_INIT
-       MT_lock_init(&mrqlock, "mrqlock");
-#endif
-       MT_lock_set(&mrqlock, "MRqueueCreate");
-       MT_sema_init(&mrqsema, 0, "mrqsema");
-       if (mrqueue) {
-               MT_lock_unset(&mrqlock, "MRqueueCreate");
-               GDKerror("One map-reduce queue allowed");
-               return;
-       }
-       sz *= 2;
-       mrqueue = (MRqueue *) GDKzalloc(sizeof(MRqueue) * sz);
-       if (mrqueue == 0) {
-               MT_lock_unset(&mrqlock, "MRqueueCreate");
-               GDKerror("Could not create the map-reduce queue");
-               return;
-       }
-       mrqsize = sz;
-       mrqlast = 0;
-       /* create a worker thread for each core as specified as system 
parameter */
-       for (i = 0; i < GDKnr_threads; i++)
-               MT_create_thread(&tid, MRworker, (void *) 0, MT_THR_DETACHED);
-       MT_lock_unset(&mrqlock, "MRqueueCreate");
-}
-
-static void
-MRenqueue(int taskcnt, MRtask *tasks)
-{
-       assert(taskcnt > 0);
-       MT_lock_set(&mrqlock, "MRenqueue");
-       if (mrqlast == mrqsize) {
-               mrqsize <<= 1;
-               mrqueue = (MRqueue *) GDKrealloc(mrqueue, sizeof(MRqueue) * 
mrqsize);
-               if (mrqueue == 0) {
-                       MT_lock_unset(&mrqlock, "MRenqueue");
-                       GDKerror("Could not enlarge the map-reduce queue");
-                       return;
-               }
-       }
-       mrqueue[mrqlast].index = 0;
-       mrqueue[mrqlast].tasks = tasks;
-       mrqueue[mrqlast].size = taskcnt;
-       mrqlast++;
-       MT_lock_unset(&mrqlock, "MRenqueue");
-       /* a task list is added for consumption */
-       while (taskcnt-- > 0)
-               MT_sema_up(&mrqsema, "MRenqueue");
-}
-
-static MRtask *
-MRdequeue(void)
-{
-       MRtask *r = NULL;
-       int idx;
-
-       MT_sema_down(&mrqsema, "MRdequeue");
-       assert(mrqlast);
-       MT_lock_set(&mrqlock, "MRdequeue");
-       if (mrqlast > 0) {
-               idx = mrqueue[mrqlast - 1].index;
-               r = &mrqueue[mrqlast - 1].tasks[idx++];
-               if (mrqueue[mrqlast - 1].size == idx)
-                       mrqlast--;
-               else
-                       mrqueue[mrqlast - 1].index = idx;
-       }
-       MT_lock_unset(&mrqlock, "MRdequeue");
-       assert(r);
-       return r;
-}
-
-static void
-MRworker(void *arg)
-{
-       MRtask *task;
-       (void) arg;
-       do {
-               task = MRdequeue();
-               (task->cmd) (task->arg);
-               MT_sema_up(task->sema, "MRworker");
-       } while (1);
-}
-
-/* schedule the tasks and return when all are done */
-void
-MRschedule(int taskcnt, void **arg, void (*cmd) (void *p))
-{
-       int i;
-       MT_Sema sema;
-       MRtask *task = GDKmalloc(taskcnt * sizeof(MRtask));
-
-       if (mrqueue == 0)
-               MRqueueCreate(1024);
-
-       MT_sema_init(&sema, 0, "sema");
-       for (i = 0; i < taskcnt; i++) {
-               task[i].sema = &sema;
-               task[i].cmd = cmd;
-               task[i].arg = arg ? arg[i] : NULL;
-       }
-       MRenqueue(taskcnt, task);
-       /* waiting for all report result */
-       for (i = 0; i < taskcnt; i++)
-               MT_sema_down(&sema, "MRschedule");
-       MT_sema_destroy(&sema);
-       GDKfree(task);
-}
diff --git a/gdk/gdk_mapreduce.h b/gdk/gdk_mapreduce.h
deleted file mode 100644
--- a/gdk/gdk_mapreduce.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0.  If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * Copyright 2008-2015 MonetDB B.V.
- */
-
-#ifndef _GDK_MAPREDUCE_H_
-#define _GDK_MAPREDUCE_H_
-
-gdk_export void MRschedule(int taskcnt, void **arg, void (*cmd) (void *p));
-
-#endif /* _GDK_MAPREDUCE_H_ */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to