Skip to content

Commit

Permalink
Merge pull request #16 from davidozog/pr/tests-sos-v1.5.0
Browse files Browse the repository at this point in the history
Sync with SOS v1.5.0
  • Loading branch information
davidozog committed Dec 17, 2020
2 parents ba14516 + ef5e45d commit 62f7e65
Show file tree
Hide file tree
Showing 83 changed files with 904 additions and 1,207 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ script:
- mkdir build
- cd build
# Note: With gcc 4.8 in Ubuntu Trusty, pthreads configury doesn't seem to
# detect the need for -lpthread.
- ../configure CC=oshcc CXX=oshc++ FC=oshfort CFLAGS="-std=gnu99" FCFLAGS="-fcray-pointer" LDFLAGS="-lpthread"
# detect the need for -lpthread or -lm.
- ../configure CC=oshcc CXX=oshc++ FC=oshfort CFLAGS="-std=gnu99" FCFLAGS="-fcray-pointer" LDFLAGS="-lpthread -lm" --disable-c11-checks
- make $TRAVIS_PAR_MAKE
- make check
- make distclean
- ../configure CC=oshcc CXX=oshc++ FC=oshfort FCFLAGS="-fcray-pointer" LDFLAGS="-lpthread -lm"
- make $TRAVIS_PAR_MAKE
- make check
31 changes: 31 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ AC_ARG_ENABLE([cxx],
[AC_HELP_STRING([--disable-cxx],
[Disable C++ tests (default: enabled)])])

AC_ARG_ENABLE([c11-checks],
[AC_HELP_STRING([--disable-c11-checks],
[Disable build-time type checks for C11 bindings (default: enabled)])])

AC_ARG_ENABLE([profiling],
[AC_HELP_STRING([--enable-profiling],
[Enable profiling (pshmem) interface tests (default:disabled)])])
Expand Down Expand Up @@ -128,6 +132,33 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
AC_MSG_ERROR([C compiler cannot compile SHMEM code])])
AC_LANG_POP([C])

if test "$enable_c11_checks" != "no" ; then
ORIG_CFLAGS=$CFLAGS
AC_MSG_CHECKING([if -std=gnu11 works])

AC_LANG_PUSH([C])
CFLAGS="-pedantic-errors -std=gnu11"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
void g(int i){}
#define f(X) _Generic((X), default: g)(X)
]], [[
f(1);
]]
)],
[shmem_cv_c11_works="yes"], [shmem_cv_c11_works="no"])
AS_IF([test "$shmem_cv_c11_works" = "no"],
[AC_MSG_RESULT([no])
CFLAGS="$ORIG_CFLAGS"
AC_PROG_CC_C99
],
[AC_MSG_RESULT([yes])
CFLAGS="-std=gnu11 $ORIG_CFLAGS"]
)
AC_LANG_POP([C])
fi
AM_CONDITIONAL([HAVE_C11], [test "$shmem_cv_c11_works" = "yes" -a "$enable_c11_checks" != "no"])


if test "$enable_cxx" != "no" ; then
AC_MSG_CHECKING([C++ compiler can compile SHMEM code])
AC_LANG_PUSH([C++])
Expand Down
10 changes: 3 additions & 7 deletions test/performance/shmem_perf_suite/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ check_PROGRAMS = \
shmem_bibw_get_perf \
shmem_bibw_get_perf_nb \
shmem_bw_atomics_perf \
shmem_bibw_atomics_perf
shmem_bibw_atomics_perf \
shmem_bw_nb_atomics_perf \
shmem_bibw_nb_atomics_perf

if HAVE_OPENMP
check_PROGRAMS += \
Expand All @@ -35,12 +37,6 @@ check_PROGRAMS += \
shmem_latency_get_ctx_perf_nb
endif

if SHMEMX_TESTS
check_PROGRAMS += \
shmem_bw_nb_atomics_perf \
shmem_bibw_nb_atomics_perf
endif

noinst_HEADERS = \
common.h \
latency_common.h \
Expand Down
5 changes: 5 additions & 0 deletions test/performance/shmem_perf_suite/README
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ Notes for Users:
-e : end length (power of two) DEFAULT: 8MB
-s : start length (power of two) DEFAULT: 1B
-n : number of trials (must be greater than 20 (warmup size)) DEFAULT: 100
-m : scale the number of trials by a floating point multiplier DEFAULT: 1.0
-v : validate input stream used for performance data (off by default)
BW only:
-k : output in KB
-b : output in B
-T : number of threads, DEFAULT: 1
-C : thread level (SINGLE, FUNNELED, SERIALIZED, MULTIPLE), DEFAULT: SINGLE

Environment Variables:
SHMEM_PERF_SUITE_TRIALS_MULTIPLIER : Scale the number of trials by a floating
point multiplier.

Notes for performance tests developers:
overall model:
development assumed that the initialization of data, calculating and printing of
Expand Down
83 changes: 41 additions & 42 deletions test/performance/shmem_perf_suite/bw_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
* SOFTWARE.
*/

#include <shmemx.h>
#include <common.h>
#ifdef ENABLE_OPENMP
#include <omp.h>
Expand All @@ -34,7 +33,7 @@
static const char * dt_names [] = { "uint", "ulong", "ulonglong" };

/*default settings if no input is provided */
static
static
void init_metrics(perf_metrics_t *metric_info) {
metric_info->t_type = BW;
set_metric_defaults(metric_info);
Expand All @@ -45,7 +44,7 @@ void init_metrics(perf_metrics_t *metric_info) {
metric_info->opstyle = STYLE_RMA;
}

static
static
void update_bw_type(perf_metrics_t *data, int b_type) {
if (b_type == BI_DIR) {
data->bw_type_str = "Bi-dir";
Expand All @@ -60,7 +59,7 @@ void update_bw_type(perf_metrics_t *data, int b_type) {
/* Result Printing and Calc */
/**************************************************************/

static
static
void print_atomic_header(perf_metrics_t * const metric_info) {
print_header(metric_info);
printf("\n\nBandwidth test type: %10s\n", metric_info->bw_type_str);
Expand All @@ -72,7 +71,7 @@ void print_atomic_header(perf_metrics_t * const metric_info) {
printf("Communication style: PAIRWISE\n");
}

printf("\nOperation%15sBandwidth%15sMessage Rate%15sLatency\n",
printf("\nOperation%15sBandwidth%15sMessage Rate%15sLatency\n",
" ", " ", " ");

if (metric_info->unit == MB) {
Expand All @@ -86,7 +85,7 @@ void print_atomic_header(perf_metrics_t * const metric_info) {
printf("%15s in Mops/sec%15s in us\n", " ", " ");
}

static
static
void print_bw_header(perf_metrics_t * const metric_info) {
print_header(metric_info);
printf("\n\nBandwidth test type: %10s\n", metric_info->bw_type_str);
Expand All @@ -105,7 +104,7 @@ void print_bw_header(perf_metrics_t * const metric_info) {
printf("%16sin msgs/sec\n", " ");
}

static
static
void print_data_results(double bw, double mr, const perf_metrics_t * const data,
int len, double total_t) {
static int atomic_type_index = 0;
Expand All @@ -123,7 +122,7 @@ void print_data_results(double bw, double mr, const perf_metrics_t * const data,
}

if (data->opstyle == STYLE_ATOMIC) {
printf("%13s%10.2f%15s%12.2f%12s%10.2f", " ", bw, " ",
printf("%13s%10.2f%15s%12.2f%12s%10.2f", " ", bw, " ",
mr/1.0e6, " ", total_t/(data->trials * data->window_size));
} else
printf("%14s%10.2f%15s%12.2f", " ", bw, " ", mr);
Expand All @@ -139,15 +138,15 @@ void print_data_results(double bw, double mr, const perf_metrics_t * const data,
printf("\n");
}

static inline
void calc_and_print_results(double end_t, double start_t, int len,
static inline
void calc_and_print_results(double end_t, double start_t, int len,
perf_metrics_t * const metric_info) {
int stride = 0, start_pe = 0, nPEs = 0;
static double pe_bw_sum, bw = 0.0; /*must be symmetric for reduction*/
double pe_bw_avg = 0.0, pe_mr_avg = 0.0;
int nred_elements = 1;
static double pwrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE];
static double pe_time_start, pe_time_end,
static double pe_time_start, pe_time_end,
end_time_max = 0.0, start_time_min = 0.0;
double total_t = 0.0, total_t_max = 0.0;
int multiplier = 1;
Expand All @@ -161,11 +160,11 @@ void calc_and_print_results(double end_t, double start_t, int len,
if (end_t > 0 && start_t > 0 && (end_t - start_t) > 0) {
total_t = end_t - start_t;
#ifdef ENABLE_OPENMP
bw = ((double) len * (double) metric_info->num_partners * (double) multiplier / 1.0e6 *
bw = ((double) len * (double) metric_info->num_partners * (double) multiplier / 1.0e6 *
metric_info->window_size * metric_info->trials *
(double) metric_info->nthreads) / (total_t / 1.0e6);
#else
bw = ((double) len * (double) metric_info->num_partners * (double) multiplier / 1.0e6 *
bw = ((double) len * (double) metric_info->num_partners * (double) multiplier / 1.0e6 *
metric_info->window_size * metric_info->trials) /
(total_t / 1.0e6);
#endif
Expand All @@ -179,24 +178,24 @@ void calc_and_print_results(double end_t, double start_t, int len,

if (metric_info->individual_report == 1) {
if (metric_info->my_node < metric_info->midpt) {
printf("Individual bandwith for PE %6d (initer) is %10.2f\n",
printf("Individual bandwith for PE %6d (initer) is %10.2f\n",
metric_info->my_node, pe_bw_sum);
} else {
printf("Individual bandwith for PE %6d (target) is %10.2f\n",
printf("Individual bandwith for PE %6d (target) is %10.2f\n",
metric_info->my_node, pe_bw_sum);
}
}

pe_time_start = start_t;
pe_time_end = end_t;
shmem_barrier(start_pe, stride, nPEs, bar_psync);
if (metric_info->cstyle != COMM_INCAST) {
if (metric_info->cstyle != COMM_INCAST) {
if (nPEs >= 2) {
shmem_double_min_to_all(&start_time_min, &pe_time_start, nred_elements,
start_pe, stride, nPEs, pwrk,
red_psync);
shmem_barrier(start_pe, stride, nPEs, bar_psync);
shmem_double_max_to_all(&end_time_max, &pe_time_end, nred_elements,
shmem_double_max_to_all(&end_time_max, &pe_time_end, nred_elements,
start_pe, stride, nPEs, pwrk,
red_psync);
} else if (nPEs == 1) {
Expand All @@ -205,25 +204,25 @@ void calc_and_print_results(double end_t, double start_t, int len,
}

/* calculating bandwidth based on the highest time duration across all PEs */
if (end_time_max > 0 && start_time_min > 0 &&
if (end_time_max > 0 && start_time_min > 0 &&
(end_time_max - start_time_min) > 0) {

total_t_max = (end_time_max - start_time_min);
int total_transfers = MAX(metric_info->szinitiator, metric_info->sztarget);
#ifdef ENABLE_OPENMP
bw = ((double) len * (double) multiplier * (double) total_transfers /
1.0e6 * metric_info->window_size * metric_info->trials *
bw = ((double) len * (double) multiplier * (double) total_transfers /
1.0e6 * metric_info->window_size * metric_info->trials *
(double) metric_info->nthreads) / (total_t_max / 1.0e6);
#else
bw = ((double) len * (double) multiplier * (double) total_transfers /
1.0e6 * metric_info->window_size * metric_info->trials) /
bw = ((double) len * (double) multiplier * (double) total_transfers /
1.0e6 * metric_info->window_size * metric_info->trials) /
(total_t_max / 1.0e6);
#endif
} else {
fprintf(stderr, "Incorrect time measured from bandwidth test: "
"start_min = %lf, end_max = %lf\n",
"start_min = %lf, end_max = %lf\n",
start_time_min, end_time_max);
}
}
pe_bw_sum = bw;
} else {
if (nPEs >= 2) {
Expand Down Expand Up @@ -252,7 +251,7 @@ static int validate_atomics(perf_metrics_t * const m_info) {
* ATOMICS_N_DTs * ATOMICS_N_OPs) + m_info->my_node;

if (m_info->cstyle == COMM_INCAST) {
if (tbw == BI_DIR)
if (tbw == BI_DIR)
printf("WARNING: This use-case is not currently well defined\n");

if (m_info->my_node == 0) {
Expand Down Expand Up @@ -284,7 +283,7 @@ static int validate_atomics(perf_metrics_t * const m_info) {
* NOTE: post function validation assumptions, data isn't flushed pre/post */
extern void bi_dir_bw(int len, perf_metrics_t *metric_info);

static inline
static inline
void bi_dir_bw_test_and_output(perf_metrics_t * const metric_info) {
int partner_pe = partner_node(metric_info);

Expand Down Expand Up @@ -319,7 +318,7 @@ void bi_dir_bw_test_and_output(perf_metrics_t * const metric_info) {
} else {
errors = validate_atomics(metric_info);
}
if (errors >= 0)
if (errors >= 0)
printf("Validation complete (%d errors)\n", errors);
}
}
Expand All @@ -333,7 +332,7 @@ void bi_dir_bw_test_and_output(perf_metrics_t * const metric_info) {
* NOTE: post function validation assumptions, data isn't flushed pre/post */
extern void uni_dir_bw(int len, perf_metrics_t *metric_info);

static inline
static inline
void uni_dir_bw_test_and_output(perf_metrics_t * const metric_info) {
int partner_pe = partner_node(metric_info);

Expand Down Expand Up @@ -369,7 +368,7 @@ void uni_dir_bw_test_and_output(perf_metrics_t * const metric_info) {
} else if (metric_info->opstyle == STYLE_ATOMIC) {
errors = validate_atomics(metric_info);
}
if (errors >= 0)
if (errors >= 0)
printf("Validation complete (%d errors)\n", errors);
}
}
Expand All @@ -379,7 +378,7 @@ void uni_dir_bw_test_and_output(perf_metrics_t * const metric_info) {
/**************************************************************/

/* create and init (with my_PE_num) two symmetric arrays on the heap */
static inline
static inline
int bw_init_data_stream(perf_metrics_t * const metric_info,
int argc, char *argv[]) {

Expand Down Expand Up @@ -438,19 +437,19 @@ int bw_init_data_stream(perf_metrics_t * const metric_info,
}


static inline
static inline
int bi_dir_init(perf_metrics_t * const metric_info, int argc,
char *argv[], op_style opstyle) {
int ret = bw_init_data_stream(metric_info, argc, argv);
if (ret == 0) {
metric_info->opstyle = opstyle;
update_bw_type(metric_info, BI_DIR);
return 0;
} else
} else
return ret;
}

static inline
static inline
int uni_dir_init(perf_metrics_t * const metric_info, int argc,
char *argv[], op_style opstyle) {
int ret = bw_init_data_stream(metric_info, argc, argv);
Expand All @@ -459,26 +458,26 @@ int uni_dir_init(perf_metrics_t * const metric_info, int argc,
metric_info->opstyle = opstyle;
update_bw_type(metric_info, UNI_DIR);
return 0;
} else
} else
return ret;
}

static inline
static inline
void bw_data_free(const perf_metrics_t * const metric_info) {
shmem_barrier_all();

aligned_buffer_free(metric_info->src);
aligned_buffer_free(metric_info->dest);
}

static inline
static inline
void bw_finalize(void) {
#ifndef VERSION_1_0
shmem_finalize();
#endif
}

static inline
static inline
void bi_dir_bw_main(int argc, char *argv[], op_style opstyle) {

perf_metrics_t metric_info;
Expand All @@ -490,10 +489,10 @@ void bi_dir_bw_main(int argc, char *argv[], op_style opstyle) {
bw_data_free(&metric_info);
}

bw_finalize();
}
bw_finalize();
}

static inline
static inline
void uni_dir_bw_main(int argc, char *argv[], op_style opstyle) {

perf_metrics_t metric_info;
Expand All @@ -506,4 +505,4 @@ void uni_dir_bw_main(int argc, char *argv[], op_style opstyle) {
}

bw_finalize();
}
}
Loading

0 comments on commit 62f7e65

Please sign in to comment.