Parcourir la source

Restore bitmap as public interface

Samuel Thibault il y a 5 ans
Parent
commit
d9fac67c31

+ 1 - 0
Makefile.am

@@ -68,6 +68,7 @@ versincludedir = $(includedir)/starpu/$(STARPU_EFFECTIVE_VERSION)
 versinclude_HEADERS = 				\
 	include/starpu.h			\
 	include/starpu_helper.h			\
+	include/starpu_bitmap.h			\
 	include/starpu_data_filters.h		\
 	include/starpu_data_interfaces.h	\
 	include/starpu_worker.h			\

+ 1 - 0
include/starpu.h

@@ -79,6 +79,7 @@ typedef INT_PTR intptr_t;
 #include <starpu_tree.h>
 #include <starpu_openmp.h>
 #include <starpu_simgrid_wrap.h>
+#include <starpu_bitmap.h>
 #include <starpu_clusters.h>
 #include <starpu_perf_monitoring.h>
 #include <starpu_perf_steering.h>

+ 30 - 12
src/common/starpu_bitmap.h

@@ -1,20 +1,42 @@
-#ifndef __STARPU_STATIC_INLINE_BITMAP_H__
-#define __STARPU_STATIC_INLINE_BITMAP_H__
-
-#include <common/utils.h>
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2013-2020  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ * Copyright (C) 2013       Simon Archipoff
+ *
+ * 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.
+ */
+
+#ifndef __STARPU_BITMAP_H__
+#define __STARPU_BITMAP_H__
+
+#include <starpu_util.h>
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
+/**
+   @defgroup API_Bitmap Bitmap
+   @brief This is the interface for the bitmap utilities provided by StarPU.
+   @{
+ */
 #ifndef LONG_BIT
 #define LONG_BIT (sizeof(unsigned long) * 8)
 #endif
 
 #define BITMAP_SIZE ((STARPU_NMAXWORKERS - 1)/LONG_BIT) + 1
 
-/** */
+/** create a empty starpu_bitmap */
 static inline struct starpu_bitmap *starpu_bitmap_create(void) STARPU_ATTRIBUTE_MALLOC;
 /** free \p b */
 static inline void starpu_bitmap_destroy(struct starpu_bitmap *b);
@@ -46,7 +68,7 @@ static inline int starpu_bitmap_next(struct starpu_bitmap *b, int e);
 /** todo */
 static inline int starpu_bitmap_has_next(struct starpu_bitmap *b, int e);
 
-
+/** @} */
 
 struct starpu_bitmap
 {
@@ -94,11 +116,7 @@ static int _count_bit_static(unsigned long e)
 
 static inline struct starpu_bitmap *starpu_bitmap_create()
 {
-	struct starpu_bitmap *b;
-	_STARPU_CALLOC(b, 1, sizeof(*b));
-	for(int i=0 ; i < BITMAP_SIZE; i++)
-		b->bits[i] = 0;	
-	return b;
+	return (struct starpu_bitmap *) calloc(1, sizeof(struct starpu_bitmap));
 }
 
 static inline void starpu_bitmap_destroy(struct starpu_bitmap * b)
@@ -272,4 +290,4 @@ static inline int starpu_bitmap_next(struct starpu_bitmap *b, int e)
 }
 #endif
 
-#endif /* __STARPU_STATIC_INLINE_BITMAP_H__ */
+#endif /* __STARPU_BITMAP_H__ */

+ 0 - 1
include/starpu_sched_component.h

@@ -20,7 +20,6 @@
 #define __STARPU_SCHED_COMPONENT_H__
 
 #include <starpu.h>
-#include <common/starpu_bitmap.h>
 
 #ifdef STARPU_HAVE_HWLOC
 #include <hwloc.h>

+ 0 - 1
src/Makefile.am

@@ -130,7 +130,6 @@ noinst_HEADERS = 						\
 	common/prio_list.h					\
 	common/graph.h						\
 	common/knobs.h						\
-	common/starpu_bitmap.h					\
 	drivers/driver_common/driver_common.h			\
 	drivers/mp_common/mp_common.h				\
 	drivers/mp_common/source_common.h			\

+ 1 - 1
src/sched_policies/eager_central_policy.c

@@ -24,7 +24,7 @@
 #include <starpu_scheduler.h>
 #include <sched_policies/fifo_queues.h>
 #include <common/thread.h>
-#include <common/starpu_bitmap.h>
+#include <starpu_bitmap.h>
 #include <core/workers.h>
 
 struct _starpu_eager_center_policy_data

+ 1 - 1
src/sched_policies/eager_central_priority_policy.c

@@ -24,7 +24,7 @@
 
 #include <starpu.h>
 #include <starpu_scheduler.h>
-#include <common/starpu_bitmap.h>
+#include <starpu_bitmap.h>
 #include "prio_deque.h"
 #include <limits.h>
 

+ 1 - 1
src/sched_policies/graph_test_policy.c

@@ -30,7 +30,7 @@
 #include <sched_policies/prio_deque.h>
 #include <common/graph.h>
 #include <common/thread.h>
-#include <common/starpu_bitmap.h>
+#include <starpu_bitmap.h>
 #include <core/task.h>
 #include <core/workers.h>
 

+ 0 - 1
src/sched_policies/heteroprio.c

@@ -25,7 +25,6 @@
 #include <core/task.h>
 #include <core/workers.h>
 #include <core/debug.h>
-#include <common/starpu_bitmap.h>
 
 #include <sched_policies/prio_deque.h>
 #include <limits.h>