From 228746596b86ab667e7ee8f0252bb0cc007de652 Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Wed, 19 Feb 2020 15:37:19 -0600 Subject: [PATCH 1/4] Drop existing CFLAGS/CXXFLAGS Otherwise they conflict with our DBG/DEVEL/OPT flags later --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index c0c6c2c..1c6c905 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,12 @@ AC_DEFINE_UNQUOTED([MINOR_VERSION],$GENERIC_MINOR_VERSION,[Minor version]) AC_DEFINE_UNQUOTED([MICRO_VERSION],$GENERIC_MICRO_VERSION,[Micro version]) +# by default CFLAGS and CXXFLAGS are set to '-g -O2' on systems that support them. +# this causes a problem if we then declare a different optimization level. So +# default them to empty, regardless of what the system supports. +: ${CFLAGS=""} +: ${CXXFLAGS=""} + dnl------------------------------ dnl Checks for compilers From 06b2340f56722a8bc829c9923132cf4f06d1b4c8 Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Wed, 19 Feb 2020 15:51:41 -0600 Subject: [PATCH 2/4] Fix maybe-unused variable warning with GCC 7 And change the test slightly to reduce the likelihood of false negatives. --- test/parallel_unit.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel_unit.C b/test/parallel_unit.C index 6ea2aca..1104048 100644 --- a/test/parallel_unit.C +++ b/test/parallel_unit.C @@ -177,18 +177,18 @@ std::vector pt_number; // Test Scalar scatter { std::vector src; - processor_id_type dest; + processor_id_type dest = 0; if (TestCommWorld->rank() == 0) { src.resize(TestCommWorld->size()); for (processor_id_type i=0; iscatter(src, dest); - TIMPI_UNIT_ASSERT( TestCommWorld->rank() == dest ); + TIMPI_UNIT_ASSERT( TestCommWorld->rank() + 1 == dest ); } // Test Vector Scatter (equal-sized chunks) From e958567c6caa9db3ca39c47bb964438383c4fc08 Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Wed, 19 Feb 2020 15:38:20 -0600 Subject: [PATCH 3/4] Bug fix in unit test Thanks to @lindsayad for catching this --- test/parallel_sync_unit.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel_sync_unit.C b/test/parallel_sync_unit.C index b85b2d5..bb52a7f 100644 --- a/test/parallel_sync_unit.C +++ b/test/parallel_sync_unit.C @@ -132,7 +132,7 @@ Communicator *TestCommWorld; // Test the received results, for each processor id p we're in // charge of. std::vector checked_sizes(size, 0); - for (int p=rank; p != M; p += size) + for (int p=rank; p < M; p += size) for (int srcp=0; srcp != size; ++srcp) { int diffsize = std::abs(srcp-p); @@ -564,4 +564,4 @@ int main(int argc, const char * const * argv) testPushMultimapVecVecOversized(); return 0; -}; +} From 1ca8e999287c892ed90dbdef7e8b702f27b97b95 Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Wed, 19 Feb 2020 15:37:57 -0600 Subject: [PATCH 4/4] Use dbg/devel/opt flags when building tests --- test/Makefile.am | 66 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index d256753..988e57e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -12,15 +12,29 @@ TESTS = if BUILD_DBG_MODE message_tag_unit_dbg_SOURCES = message_tag_unit.C - packed_range_unit_dbg_SOURCES = packed_range_unit.C - parallel_sync_unit_dbg_SOURCES = parallel_sync_unit.C - parallel_unit_dbg_SOURCES = parallel_unit.C - dispatch_to_packed_unit_dbg_SOURCES = dispatch_to_packed_unit.C message_tag_unit_dbg_LDFLAGS = $(top_builddir)/src/libtimpi_dbg.la + message_tag_unit_dbg_CPPFLAGS = $(CPPFLAGS_DBG) $(AM_CPPFLAGS) + message_tag_unit_dbg_CXXFLAGS = $(CXXFLAGS_DBG) + + packed_range_unit_dbg_SOURCES = packed_range_unit.C packed_range_unit_dbg_LDFLAGS = $(top_builddir)/src/libtimpi_dbg.la + packed_range_unit_dbg_CPPFLAGS = $(CPPFLAGS_DBG) $(AM_CPPFLAGS) + packed_range_unit_dbg_CXXFLAGS = $(CXXFLAGS_DBG) + + parallel_sync_unit_dbg_SOURCES = parallel_sync_unit.C parallel_sync_unit_dbg_LDFLAGS = $(top_builddir)/src/libtimpi_dbg.la + parallel_sync_unit_dbg_CPPFLAGS = $(CPPFLAGS_DBG) $(AM_CPPFLAGS) + parallel_sync_unit_dbg_CXXFLAGS = $(CXXFLAGS_DBG) + + parallel_unit_dbg_SOURCES = parallel_unit.C parallel_unit_dbg_LDFLAGS = $(top_builddir)/src/libtimpi_dbg.la + parallel_unit_dbg_CPPFLAGS = $(CPPFLAGS_DBG) $(AM_CPPFLAGS) + parallel_unit_dbg_CXXFLAGS = $(CXXFLAGS_DBG) + + dispatch_to_packed_unit_dbg_SOURCES = dispatch_to_packed_unit.C dispatch_to_packed_unit_dbg_LDFLAGS = $(top_builddir)/src/libtimpi_dbg.la + dispatch_to_packed_unit_dbg_CPPFLAGS = $(CPPFLAGS_DBG) $(AM_CPPFLAGS) + dispatch_to_packed_unit_dbg_CXXFLAGS = $(CXXFLAGS_DBG) TESTS += message_tag_unit-dbg TESTS += packed_range_unit-dbg @@ -31,15 +45,29 @@ endif if BUILD_DEVEL_MODE message_tag_unit_devel_SOURCES = message_tag_unit.C - packed_range_unit_devel_SOURCES = packed_range_unit.C - parallel_sync_unit_devel_SOURCES = parallel_sync_unit.C - parallel_unit_devel_SOURCES = parallel_unit.C - dispatch_to_packed_unit_devel_SOURCES = dispatch_to_packed_unit.C message_tag_unit_devel_LDFLAGS = $(top_builddir)/src/libtimpi_devel.la + message_tag_unit_devel_CPPFLAGS = $(CPPFLAGS_DEVEL) $(AM_CPPFLAGS) + message_tag_unit_devel_CXXFLAGS = $(CXXFLAGS_DEVEL) + + packed_range_unit_devel_SOURCES = packed_range_unit.C packed_range_unit_devel_LDFLAGS = $(top_builddir)/src/libtimpi_devel.la + packed_range_unit_devel_CPPFLAGS = $(CPPFLAGS_DEVEL) $(AM_CPPFLAGS) + packed_range_unit_devel_CXXFLAGS = $(CXXFLAGS_DEVEL) + + parallel_sync_unit_devel_SOURCES = parallel_sync_unit.C parallel_sync_unit_devel_LDFLAGS = $(top_builddir)/src/libtimpi_devel.la + parallel_sync_unit_devel_CPPFLAGS = $(CPPFLAGS_DEVEL) $(AM_CPPFLAGS) + parallel_sync_unit_devel_CXXFLAGS = $(CXXFLAGS_DEVEL) + + parallel_unit_devel_SOURCES = parallel_unit.C parallel_unit_devel_LDFLAGS = $(top_builddir)/src/libtimpi_devel.la + parallel_unit_devel_CPPFLAGS = $(CPPFLAGS_DEVEL) $(AM_CPPFLAGS) + parallel_unit_devel_CXXFLAGS = $(CXXFLAGS_DEVEL) + + dispatch_to_packed_unit_devel_SOURCES = dispatch_to_packed_unit.C dispatch_to_packed_unit_devel_LDFLAGS = $(top_builddir)/src/libtimpi_devel.la + dispatch_to_packed_unit_devel_CPPFLAGS = $(CPPFLAGS_DEVEL) $(AM_CPPFLAGS) + dispatch_to_packed_unit_devel_CXXFLAGS = $(CXXFLAGS_DEVEL) TESTS += message_tag_unit-devel TESTS += packed_range_unit-devel @@ -50,15 +78,29 @@ endif if BUILD_OPT_MODE message_tag_unit_opt_SOURCES = message_tag_unit.C - packed_range_unit_opt_SOURCES = packed_range_unit.C - parallel_sync_unit_opt_SOURCES = parallel_sync_unit.C - parallel_unit_opt_SOURCES = parallel_unit.C - dispatch_to_packed_unit_opt_SOURCES = dispatch_to_packed_unit.C message_tag_unit_opt_LDFLAGS = $(top_builddir)/src/libtimpi_opt.la + message_tag_unit_opt_CPPFLAGS = $(CPPFLAGS_OPT) $(AM_CPPFLAGS) + message_tag_unit_opt_CXXFLAGS = $(CXXFLAGS_OPT) + + packed_range_unit_opt_SOURCES = packed_range_unit.C packed_range_unit_opt_LDFLAGS = $(top_builddir)/src/libtimpi_opt.la + packed_range_unit_opt_CPPFLAGS = $(CPPFLAGS_OPT) $(AM_CPPFLAGS) + packed_range_unit_opt_CXXFLAGS = $(CXXFLAGS_OPT) + + parallel_sync_unit_opt_SOURCES = parallel_sync_unit.C parallel_sync_unit_opt_LDFLAGS = $(top_builddir)/src/libtimpi_opt.la + parallel_sync_unit_opt_CPPFLAGS = $(CPPFLAGS_OPT) $(AM_CPPFLAGS) + parallel_sync_unit_opt_CXXFLAGS = $(CXXFLAGS_OPT) + + parallel_unit_opt_SOURCES = parallel_unit.C parallel_unit_opt_LDFLAGS = $(top_builddir)/src/libtimpi_opt.la + parallel_unit_opt_CPPFLAGS = $(CPPFLAGS_OPT) $(AM_CPPFLAGS) + parallel_unit_opt_CXXFLAGS = $(CXXFLAGS_OPT) + + dispatch_to_packed_unit_opt_SOURCES = dispatch_to_packed_unit.C dispatch_to_packed_unit_opt_LDFLAGS = $(top_builddir)/src/libtimpi_opt.la + dispatch_to_packed_unit_opt_CPPFLAGS = $(CPPFLAGS_OPT) $(AM_CPPFLAGS) + dispatch_to_packed_unit_opt_CXXFLAGS = $(CXXFLAGS_OPT) TESTS += message_tag_unit-opt TESTS += packed_range_unit-opt