Przeglądaj źródła

Add a debug function to display the size of some data structures.

Cédric Augonnet 14 lat temu
rodzic
commit
0700ca07a1

+ 2 - 0
src/Makefile.am

@@ -97,6 +97,7 @@ noinst_HEADERS = 						\
 	drivers/cuda/driver_cuda.h				\
 	drivers/opencl/driver_opencl.h				\
 	drivers/opencl/driver_opencl_utils.h			\
+	debug/starpu_debug_helpers.h				\
 	profiling/bound.h					\
 	profiling/profiling.h
 
@@ -172,6 +173,7 @@ libstarpu_la_SOURCES = 						\
 	util/starpu_insert_task.c				\
 	util/starpu_task_list.c					\
 	debug/latency.c						\
+	debug/structures_size.c					\
 	profiling/profiling.c					\
 	profiling/bound.c					\
 	profiling/bus_profiling_helpers.c

+ 1 - 0
src/debug/latency.c

@@ -15,6 +15,7 @@
  */
 
 #include <starpu.h>
+#include <debug/starpu_debug_helpers.h>
 #include <common/config.h>
 #include <datawizard/coherency.h>
 

+ 38 - 0
src/debug/starpu_debug_helpers.h

@@ -0,0 +1,38 @@
+/*
+ * StarPU
+ * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file)
+ *
+ * This program 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.
+ *
+ * This program 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_DEBUG_HELPERS_H__
+#define __STARPU_DEBUG_HELPERS_H__
+
+#include <starpu.h>
+#include <starpu_config.h>
+#include <starpu_util.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Perform a ping pong between the two memory nodes */
+void _starpu_benchmark_ping_pong(starpu_data_handle handle, unsigned node0, unsigned node1, unsigned niter);
+
+/* Display the size of different data structures */
+void _starpu_debug_display_structures_size(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __STARPU_DEBUG_HELPERS_H__

+ 37 - 0
src/debug/structures_size.c

@@ -0,0 +1,37 @@
+/*
+ * StarPU
+ * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file)
+ *
+ * This program 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.
+ *
+ * This program 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 <core/jobs.h>
+#include <core/workers.h>
+#include <datawizard/coherency.h>
+#include <profiling/bound.h>
+
+void _starpu_debug_display_structures_size(void)
+{
+	fprintf(stderr, "struct starpu_task\t\t%d bytes\t(%x)\n",
+			sizeof(struct starpu_task), sizeof(struct starpu_task));
+	fprintf(stderr, "struct starpu_job_s\t\t%d bytes\t(%x)\n",
+			sizeof(struct starpu_job_s), sizeof(struct starpu_job_s));
+	fprintf(stderr, "struct starpu_data_state_t\t%d bytes\t(%x)\n",
+			sizeof(struct starpu_data_state_t), sizeof(struct starpu_data_state_t));
+	fprintf(stderr, "struct starpu_tag_s\t\t%d bytes\t(%x)\n",
+			sizeof(struct starpu_tag_s), sizeof(struct starpu_tag_s));
+	fprintf(stderr, "struct starpu_cg_s\t\t%d bytes\t(%x)\n",
+			sizeof(struct starpu_cg_s), sizeof(struct starpu_cg_s));
+	fprintf(stderr, "struct starpu_worker_s\t\t%d bytes\t(%x)\n",
+			sizeof(struct starpu_worker_s), sizeof(struct starpu_worker_s));
+}

+ 6 - 1
tests/Makefile.am

@@ -16,7 +16,7 @@
 
 AM_CFLAGS = $(HWLOC_CFLAGS)
 LIBS = $(top_builddir)/src/libstarpu.la $(HWLOC_LIBS) @LIBS@
-AM_CPPFLAGS = -I$(top_srcdir)/include/
+AM_CPPFLAGS = -I$(top_srcdir)/include/ -I$(top_srcdir)/src/
 
 EXTRA_DIST =					\
 	microbenchs/null_kernel_gordon.c	\
@@ -457,6 +457,11 @@ microbenchs_redundant_buffer_SOURCES =		\
 	microbenchs/redundant_buffer.c
 
 testbin_PROGRAMS +=				\
+	microbenchs/display_structures_size
+microbenchs_display_structures_size_SOURCES =	\
+	microbenchs/display_structures_size.c
+
+testbin_PROGRAMS +=				\
 	microbenchs/local_pingpong
 microbenchs_local_pingpong_SOURCES =		\
 	microbenchs/local_pingpong.c

+ 25 - 0
tests/microbenchs/display_structures_size.c

@@ -0,0 +1,25 @@
+/*
+ * StarPU
+ * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file)
+ *
+ * This program 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.
+ *
+ * This program 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 <debug/starpu_debug_helpers.h>
+
+int main(int argc, char **argv)
+{
+	_starpu_debug_display_structures_size();
+
+	return 0;
+}