From 42e1a32d67a4449d1c723834a4345974accd6cbf Mon Sep 17 00:00:00 2001 From: James Dinan Date: Tue, 13 Mar 2018 20:41:27 -0400 Subject: [PATCH 1/2] Configury: Add -Wall only with --enable-picky Signed-off-by: James Dinan --- configure.ac | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 39101b2..e176fea 100755 --- a/configure.ac +++ b/configure.ac @@ -168,10 +168,12 @@ if test "$FC" != "" ; then AC_LANG_POP([Fortran]) fi -if test "$enable_picky" = "yes" -a "$GCC" = "yes" ; then - CFLAGS="$CFLAGS -Wall -Wno-long-long -Wmissing-prototypes -Wstrict-prototypes -Wcomment -pedantic" -else - CFLAGS="$CFLAGS -Wall" +if test "$enable_picky" = "yes" ; then + if test "$GCC" = "yes" ; then + CFLAGS="$CFLAGS -Wall -Wno-long-long -Wmissing-prototypes -Wstrict-prototypes -Wcomment -pedantic" + else + CFLAGS="$CFLAGS -Wall" + fi fi if test "$enable_debug" = "yes" ; then From e9360d41ca56ec881b41796e31c2fe7361ac677e Mon Sep 17 00:00:00 2001 From: James Dinan Date: Wed, 28 Mar 2018 09:21:38 -0400 Subject: [PATCH 2/2] Update tests to SOS 15211bdb Signed-off-by: James Dinan --- configure.ac | 1 + test/Makefile.am | 2 +- test/apps/Makefile.am | 2 +- .../shmem_latency_nb_get_perf.c | 8 +++ .../shmem_latency_nb_put_perf.c | 8 +++ test/shmemx/Makefile.am | 59 ++++++++++++++++ test/{unit => shmemx}/gettid_register.c | 2 +- test/{unit => shmemx}/pcontrol.c | 0 test/{unit => shmemx}/shmem_ct.c | 0 test/unit/Makefile.am | 40 ++++------- test/unit/query_thread.c | 67 +++++++++++++++++++ test/unit/web.c | 2 +- 12 files changed, 161 insertions(+), 30 deletions(-) create mode 100644 test/shmemx/Makefile.am rename test/{unit => shmemx}/gettid_register.c (99%) rename test/{unit => shmemx}/pcontrol.c (100%) rename test/{unit => shmemx}/shmem_ct.c (100%) create mode 100644 test/unit/query_thread.c diff --git a/configure.ac b/configure.ac index e176fea..072c610 100755 --- a/configure.ac +++ b/configure.ac @@ -197,6 +197,7 @@ LT_OUTPUT AC_CONFIG_FILES([Makefile test/Makefile test/unit/Makefile + test/shmemx/Makefile test/performance/Makefile test/performance/shmem_perf_suite/Makefile test/performance/tests/Makefile diff --git a/test/Makefile.am b/test/Makefile.am index ad7acf7..454d797 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -11,4 +11,4 @@ # information, see the LICENSE file in the top level directory of the # distribution. -SUBDIRS = unit performance apps +SUBDIRS = unit shmemx performance apps diff --git a/test/apps/Makefile.am b/test/apps/Makefile.am index 00a5f53..7c8e91b 100644 --- a/test/apps/Makefile.am +++ b/test/apps/Makefile.am @@ -53,6 +53,6 @@ if USE_PMI_SIMPLE LDADD += $(top_builddir)/pmi-simple/libpmi_simple.la endif -mandelbrot_LDFLAGS = $(PTHREAD_LIBS) +mandelbrot_LDFLAGS = $(AM_LDFLAGS) $(PTHREAD_LIBS) mandelbrot_CFLAGS = -I$(top_srcdir)/test/unit $(PTHREAD_CFLAGS) mandelbrot_LDADD = $(LDADD) $(PTHREAD_CFLAGS) diff --git a/test/performance/shmem_perf_suite/shmem_latency_nb_get_perf.c b/test/performance/shmem_perf_suite/shmem_latency_nb_get_perf.c index e88cbf2..f636e55 100644 --- a/test/performance/shmem_perf_suite/shmem_latency_nb_get_perf.c +++ b/test/performance/shmem_perf_suite/shmem_latency_nb_get_perf.c @@ -57,6 +57,14 @@ streaming_latency(int len, perf_metrics_t *data) double start = 0.0; double end = 0.0; int i = 0; + static int print_once = 0; + if(!print_once && data->my_node == GET_IO_NODE) { + printf("\nStreaming results for %d trials each of length %d through %d in"\ + " powers of %d\n", data->trials, data->start_len, + data->max_len, data->inc); + print_results_header(); + print_once++; + } if (data->my_node == 0) { diff --git a/test/performance/shmem_perf_suite/shmem_latency_nb_put_perf.c b/test/performance/shmem_perf_suite/shmem_latency_nb_put_perf.c index 080534b..7138b85 100644 --- a/test/performance/shmem_perf_suite/shmem_latency_nb_put_perf.c +++ b/test/performance/shmem_perf_suite/shmem_latency_nb_put_perf.c @@ -59,6 +59,14 @@ streaming_latency(int len, perf_metrics_t *data) double start = 0.0; double end = 0.0; int i = 0; + static int print_once = 0; + if(!print_once && data->my_node == PUT_IO_NODE) { + printf("\nStreaming results for %d trials each of length %d through %d in"\ + " powers of %d\n", data->trials, data->start_len, + data->max_len, data->inc); + print_results_header(); + print_once++; + } /*puts to zero to match gets validation scheme*/ if (data->my_node == 1) { diff --git a/test/shmemx/Makefile.am b/test/shmemx/Makefile.am new file mode 100644 index 0000000..091a7b9 --- /dev/null +++ b/test/shmemx/Makefile.am @@ -0,0 +1,59 @@ +# -*- Makefile -*- +# +# Copyright 2011 Sandia Corporation. Under the terms of Contract +# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government +# retains certain rights in this software. +# +# Copyright (c) 2017 Intel Corporation. All rights reserved. +# This software is available to you under the BSD license. +# +# This file is part of the Sandia OpenSHMEM software package. For license +# information, see the LICENSE file in the top level directory of the +# distribution. + +check_PROGRAMS = + +if ENABLE_PROFILING +check_PROGRAMS += \ + pcontrol +endif + +if USE_PORTALS4 +check_PROGRAMS += \ + shmem_ct +endif + +if HAVE_PTHREADS +if SHMEMX_TESTS +check_PROGRAMS += \ + gettid_register +endif +endif + +TESTS = $(check_PROGRAMS) + +NPROCS ?= 2 +LOG_COMPILER = $(TEST_RUNNER) + +AM_LDFLAGS = $(LIBTOOL_WRAPPER_LDFLAGS) + +if EXTERNAL_TESTS +bin_PROGRAMS = $(check_PROGRAMS) +AM_CPPFLAGS = +AM_FCFLAGS = +LDADD = +else +AM_CPPFLAGS = -I$(top_builddir)/mpp +AM_FCFLAGS = -I$(top_builddir)/mpp +LDADD = $(top_builddir)/src/libsma.la +endif + +if USE_PMI_SIMPLE +LDADD += $(top_builddir)/pmi-simple/libpmi_simple.la +endif + +if SHMEMX_TESTS +gettid_register_LDFLAGS = $(AM_LDFLAGS) $(PTHREAD_LIBS) +gettid_register_CFLAGS = $(PTHREAD_CFLAGS) +gettid_register_LDADD = $(LDADD) $(PTHREAD_CFLAGS) +endif diff --git a/test/unit/gettid_register.c b/test/shmemx/gettid_register.c similarity index 99% rename from test/unit/gettid_register.c rename to test/shmemx/gettid_register.c index 2350f83..2e7c82d 100644 --- a/test/unit/gettid_register.c +++ b/test/shmemx/gettid_register.c @@ -43,7 +43,7 @@ int errors = 0; pthread_key_t key; -uint64_t my_gettid(void) { +static uint64_t my_gettid(void) { uint64_t tid_val = 0; tid_val = * (uint64_t*) pthread_getspecific(key); diff --git a/test/unit/pcontrol.c b/test/shmemx/pcontrol.c similarity index 100% rename from test/unit/pcontrol.c rename to test/shmemx/pcontrol.c diff --git a/test/unit/shmem_ct.c b/test/shmemx/shmem_ct.c similarity index 100% rename from test/unit/shmem_ct.c rename to test/shmemx/shmem_ct.c diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am index ff52cb9..6825da9 100644 --- a/test/unit/Makefile.am +++ b/test/unit/Makefile.am @@ -60,6 +60,7 @@ check_PROGRAMS = \ bcast_flood \ lfinc \ shmem_info \ + query_thread \ global_exit \ asym_alloc \ set_fetch \ @@ -100,15 +101,9 @@ check_PROGRAMS = \ if ENABLE_PROFILING check_PROGRAMS += \ - pcontrol \ rma_coverage_pshmem endif -if USE_PORTALS4 -check_PROGRAMS += \ - shmem_ct -endif - if HAVE_CXX check_PROGRAMS += \ cxx_test_shmem_complex \ @@ -148,12 +143,8 @@ check_PROGRAMS += \ mt_membar \ threading \ web \ - thread_wait - -if SHMEMX_TESTS -check_PROGRAMS += \ - gettid_register -endif + thread_wait \ + query_thread_funneled endif if HAVE_OPENMP @@ -187,35 +178,32 @@ endif rma_coverage_pshmem_SOURCES = rma_coverage.c rma_coverage_pshmem_CFLAGS = -DTEST_PSHMEM +query_thread_funneled_SOURCES = query_thread.c +query_thread_funneled_CFLAGS = -DENABLE_THREADS + mt_a2a_SOURCES = mt_a2a.c pthread_barrier.h -mt_a2a_LDFLAGS = $(PTHREAD_LIBS) +mt_a2a_LDFLAGS = $(AM_LDFLAGS) $(PTHREAD_LIBS) mt_a2a_CFLAGS = -I$(top_srcdir)/test/unit $(PTHREAD_CFLAGS) mt_a2a_LDADD = $(LDADD) $(PTHREAD_CFLAGS) -mt_contention_LDFLAGS = $(PTHREAD_LIBS) -mt_contention_CFLAGS = -I$(top_srcdir)/test/unit $(PTHREAD_CFLAGS) +mt_contention_LDFLAGS = $(AM_LDFLAGS) $(PTHREAD_LIBS) +mt_contention_CFLAGS = $(PTHREAD_CFLAGS) mt_contention_LDADD = $(LDADD) $(PTHREAD_CFLAGS) -if SHMEMX_TESTS -gettid_register_LDFLAGS = $(AM_LDFLAGS) $(PTHREAD_LIBS) -gettid_register_CFLAGS = $(PTHREAD_CFLAGS) -gettid_register_LDADD = $(LDADD) $(PTHREAD_CFLAGS) -endif - mt_membar_LDFLAGS = $(AM_LDFLAGS) $(PTHREAD_LIBS) mt_membar_CFLAGS = -I$(top_srcdir)/test/unit $(PTHREAD_CFLAGS) mt_membar_LDADD = $(LDADD) $(PTHREAD_CFLAGS) -threading_LDFLAGS = $(PTHREAD_LIBS) +threading_LDFLAGS = $(AM_LDFLAGS) $(PTHREAD_LIBS) threading_CFLAGS = -I$(top_srcdir)/test/unit $(PTHREAD_CFLAGS) threading_LDADD = $(LDADD) $(PTHREAD_CFLAGS) -web_LDFLAGS = $(PTHREAD_LIBS) -web_CFLAGS = -I$(top_srcdir)/test/unit $(PTHREAD_CFLAGS) +web_LDFLAGS = $(AM_LDFLAGS) $(PTHREAD_LIBS) +web_CFLAGS = $(PTHREAD_CFLAGS) web_LDADD = $(LDADD) $(PTHREAD_CFLAGS) -thread_wait_LDFLAGS = $(PTHREAD_LIBS) -thread_wait_CFLAGS = -I$(top_srcdir)/test/unit $(PTHREAD_CFLAGS) +thread_wait_LDFLAGS = $(AM_LDFLAGS) $(PTHREAD_LIBS) +thread_wait_CFLAGS = $(PTHREAD_CFLAGS) thread_wait_LDADD = $(LDADD) $(PTHREAD_CFLAGS) shmem_ctx_CFLAGS = $(AM_OPENMP_CFLAGS) diff --git a/test/unit/query_thread.c b/test/unit/query_thread.c new file mode 100644 index 0000000..35372ad --- /dev/null +++ b/test/unit/query_thread.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2018 Intel Corporation. All rights reserved. + * This software is available to you under the BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include +#include + +int +main(int argc, char* argv[]) +{ + int provided; + +#if defined(ENABLE_THREADS) + int tl, ret; + ret = shmem_init_thread(SHMEM_THREAD_FUNNELED, &tl); + + if (tl != SHMEM_THREAD_FUNNELED || ret != 0) { + printf("Init failed (requested thread level %d, got %d, ret %d)\n", + SHMEM_THREAD_FUNNELED, tl, ret); + if (ret == 0) { + shmem_global_exit(1); + } else { + return ret; + } + } +#else + shmem_init(); +#endif + + shmem_query_thread(&provided); + printf("%d: Query result for thread level %d\n", shmem_my_pe(), provided); + +#if defined(ENABLE_THREADS) + if (provided != SHMEM_THREAD_FUNNELED) + shmem_global_exit(1); +#else + if (provided != SHMEM_THREAD_SINGLE && provided != SHMEM_THREAD_FUNNELED && + provided != SHMEM_THREAD_SERIALIZED && provided != SHMEM_THREAD_MULTIPLE) + shmem_global_exit(1); +#endif + + shmem_finalize(); + return 0; +} diff --git a/test/unit/web.c b/test/unit/web.c index e5e8642..09cd71c 100644 --- a/test/unit/web.c +++ b/test/unit/web.c @@ -170,7 +170,7 @@ int main(int argc, char* argv[]) { srand(1+me); - n_threads = 4 * n_pes; + n_threads = 4; channels = shmem_malloc(n_threads*sizeof(channel)); memset(channels,0,n_threads*sizeof(channel));