Skip to content

Commit

Permalink
Merge pull request #1 from jdinan/pr/update-tests
Browse files Browse the repository at this point in the history
Update SOS Tests
  • Loading branch information
jdinan committed Mar 28, 2018
2 parents d102ed6 + e9360d4 commit 2705f1a
Show file tree
Hide file tree
Showing 12 changed files with 167 additions and 34 deletions.
11 changes: 7 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -195,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
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/apps/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 8 additions & 0 deletions test/performance/shmem_perf_suite/shmem_latency_nb_get_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
8 changes: 8 additions & 0 deletions test/performance/shmem_perf_suite/shmem_latency_nb_put_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
59 changes: 59 additions & 0 deletions test/shmemx/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
File renamed without changes.
File renamed without changes.
40 changes: 14 additions & 26 deletions test/unit/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ check_PROGRAMS = \
bcast_flood \
lfinc \
shmem_info \
query_thread \
global_exit \
asym_alloc \
set_fetch \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
67 changes: 67 additions & 0 deletions test/unit/query_thread.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <shmem.h>

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;
}
2 changes: 1 addition & 1 deletion test/unit/web.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit 2705f1a

Please sign in to comment.