[dcmf] [PATCH] This test will repeatedly call the low-level critical-section functions for performance testing.
Joe Ratterman
jratt at us.ibm.com
Tue Feb 5 11:19:15 CST 2008
This is helpful when trying to understand performance degradations in MPI_THREAD_MULTIPLE.
Signed-off-by: Joe Ratterman <jratt at us.ibm.com>
---
sys/tests/perf/Makefile.in | 2 +-
sys/tests/perf/dcmf/CS.c | 64 +++++++++++++++++++++++++++++++++
sys/tests/perf/{ => dcmf}/Makefile.in | 4 +-
3 files changed, 67 insertions(+), 3 deletions(-)
create mode 100644 sys/tests/perf/dcmf/CS.c
copy sys/tests/perf/{ => dcmf}/Makefile.in (96%)
diff --git a/sys/tests/perf/Makefile.in b/sys/tests/perf/Makefile.in
index 22a7ac7..4266989 100644
--- a/sys/tests/perf/Makefile.in
+++ b/sys/tests/perf/Makefile.in
@@ -12,6 +12,6 @@
# end_generated_IBM_copyright_prolog #
VPATH = @abs_srcdir@
-SUBDIRS = mpi spi mpid
+SUBDIRS = mpi spi mpid dcmf
TESTS =
include @abs_top_builddir@/Make.rules
diff --git a/sys/tests/perf/dcmf/CS.c b/sys/tests/perf/dcmf/CS.c
new file mode 100644
index 0000000..080f5df
--- /dev/null
+++ b/sys/tests/perf/dcmf/CS.c
@@ -0,0 +1,64 @@
+/* begin_generated_IBM_copyright_prolog */
+/* */
+/* ---------------------------------------------------------------- */
+/* (C)Copyright IBM Corp. 2007, 2008 */
+/* IBM CPL License */
+/* ---------------------------------------------------------------- */
+/* */
+/* end_generated_IBM_copyright_prolog */
+/**
+ * \file perf/dcmf/CS.c
+ * \brief Test the performance of the low-level critical-section functions
+ */
+
+
+#include <tests.h>
+#define NUM 10000
+DCMF_Configure_t config;
+
+
+double time_CS(uint32_t x)
+{
+ uint64_t start, stop;
+ uint32_t i;
+
+ start = DCMF_Timebase();
+ for (i=0; i<x; ++i) {
+ DCMF_CriticalSection_enter(0);
+ DCMF_CriticalSection_exit(0);
+ }
+ stop = DCMF_Timebase();
+
+ return (double)(stop-start)/(double)x;
+}
+
+
+#define time_run(c) time_run_long(c, #c)
+void time_run_long(DCMF_Thread thread_level, char* thread_string)
+{
+ double time;
+ DCMF_Result rc;
+
+ config.thread_level = thread_level;
+ rc = DCMF_Messager_configure (&config, &config);
+ assert(rc == DCMF_SUCCESS);
+ assert(config.thread_level == thread_level);
+ time = time_CS(NUM);
+ printf("%s: Called Enter/Exit %u times at %g cycles each.\n", thread_string, NUM, time);
+}
+
+
+int main()
+{
+ config.interrupts = DCMF_INTERRUPTS_OFF;
+
+ MPI_INIT;
+
+ time_run(DCMF_THREAD_SINGLE);
+ time_run(DCMF_THREAD_FUNNELED);
+ time_run(DCMF_THREAD_SERIALIZED);
+ time_run(DCMF_THREAD_MULTIPLE);
+
+ MPI_FINALIZE;
+ return (0);
+}
diff --git a/sys/tests/perf/Makefile.in b/sys/tests/perf/dcmf/Makefile.in
similarity index 96%
copy from sys/tests/perf/Makefile.in
copy to sys/tests/perf/dcmf/Makefile.in
index 22a7ac7..4c474b6 100644
--- a/sys/tests/perf/Makefile.in
+++ b/sys/tests/perf/dcmf/Makefile.in
@@ -12,6 +12,6 @@
# end_generated_IBM_copyright_prolog #
VPATH = @abs_srcdir@
-SUBDIRS = mpi spi mpid
-TESTS =
+SUBDIRS =
+TESTS = CS.c
include @abs_top_builddir@/Make.rules
--
1.5.4
More information about the dcmf
mailing list