Skip to content

Commit

Permalink
Merge pull request #14 from davidozog/pr/tests_sos_v1.4.5
Browse files Browse the repository at this point in the history
Sync with SOS v1.4.5
  • Loading branch information
davidozog committed Feb 25, 2020
2 parents 284c8e6 + 698c79f commit db1807c
Show file tree
Hide file tree
Showing 40 changed files with 2,772 additions and 38 deletions.
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ AC_CONFIG_FILES([Makefile
test/performance/Makefile
test/performance/shmem_perf_suite/Makefile
test/performance/tests/Makefile
test/apps/Makefile])
test/apps/Makefile
test/spec-example/Makefile])

AC_OUTPUT

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 shmemx performance apps include
SUBDIRS = unit shmemx performance apps spec-example include
8 changes: 3 additions & 5 deletions test/apps/gups.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,6 @@ UpdateTable(uint64_t *Table,
uint64_t remote_val;
#endif

shmem_barrier_all();

/* setup: should not really be part of this timed routine */
ran = starts(4*GlobalStartMyProc);

Expand All @@ -300,9 +298,6 @@ UpdateTable(uint64_t *Table,
#endif
if (use_lock) shmem_clear_lock(&HPCC_PELock[remote_pe]);
}

shmem_barrier_all();

}

int
Expand Down Expand Up @@ -445,6 +440,7 @@ SHMEMRandomAccess(void)

RealTime = -RTSEC();

shmem_barrier_all();
UpdateTable(HPCC_Table,
TableSize,
MinLocalTableSize,
Expand Down Expand Up @@ -481,6 +477,7 @@ SHMEMRandomAccess(void)

RealTime = -RTSEC();

shmem_barrier_all();
UpdateTable(HPCC_Table,
TableSize,
MinLocalTableSize,
Expand All @@ -489,6 +486,7 @@ SHMEMRandomAccess(void)
ProcNumUpdates,
1);

shmem_barrier_all();
NumErrors = 0;
for (i_u=0; i_u<LocalTableSize; i_u++){
if (HPCC_Table[i_u] != i_u + GlobalStartMyProc)
Expand Down
27 changes: 16 additions & 11 deletions test/shmemx/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@
# information, see the LICENSE file in the top level directory of the
# distribution.

check_PROGRAMS = \
shmemx_wait_until_all \
shmemx_wait_until_any \
shmemx_wait_until_some \
shmemx_test_all \
shmemx_test_any \
shmemx_test_some \
c11_test_shmemx_wait_until \
c11_test_shmemx_test
check_PROGRAMS =

if ENABLE_PROFILING
check_PROGRAMS += \
Expand All @@ -32,13 +24,26 @@ check_PROGRAMS += \
endif

if SHMEMX_TESTS

check_PROGRAMS += \
perf_counter \
fadd_nbi \
atomic_nbi \
put_signal \
put_signal_nbi
put_signal_nbi \
shmemx_test_all \
c11_test_shmemx_wait_until \
c11_test_shmemx_test \
c11_test_shmemx_wait_until_vector\
c11_test_shmemx_test_vector\
shmemx_team_split_2d \
shmemx_team_translate_2 \
shmemx_team_reuse_teams \
shmemx_team_collect_active_set \
shmemx_team_shared \
shmemx_team_b2b_collectives \
c11_shmemx_team_collective_types \
c11_shmemx_team_reduce \
shmemx_team_max

if HAVE_PTHREADS
check_PROGRAMS += \
Expand Down
282 changes: 282 additions & 0 deletions test/shmemx/c11_shmemx_team_collective_types.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
/*
* This test program is derived from a unit test created by Nick Park.
* The original unit test is a work of the U.S. Government and is not subject
* to copyright protection in the United States. Foreign copyrights may
* apply.
*
* Copyright (c) 2019 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 <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <shmem.h>
#include <shmemx.h>

#define MAX_NPES 32

#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L

enum op { BCAST = 0, COLLECT, FCOLLECT, ALLTOALL, ALLTOALLS };

#define TEST_SHMEM_COLLECTIVE(OP, TYPE) \
do { \
static TYPE src[MAX_NPES]; \
static TYPE dest[MAX_NPES*MAX_NPES]; \
\
for (int i = 0; i < MAX_NPES; i++) { \
src[i] = (TYPE)mype; \
} \
\
switch (OP) { \
case BCAST: \
shmemx_broadcast(SHMEMX_TEAM_WORLD, dest, src, MAX_NPES, npes-1); \
break; \
case COLLECT: \
shmemx_collect(SHMEMX_TEAM_WORLD, dest, src, MAX_NPES); \
break; \
case FCOLLECT: \
shmemx_fcollect(SHMEMX_TEAM_WORLD, dest, src, MAX_NPES); \
break; \
case ALLTOALL: \
shmemx_alltoall(SHMEMX_TEAM_WORLD, dest, src, 1); \
break; \
case ALLTOALLS: \
shmemx_alltoalls(SHMEMX_TEAM_WORLD, dest, src, 1, 1, 1); \
break; \
default: \
printf("Invalid operation (%d)\n", OP); \
shmem_global_exit(1); \
} \
shmem_barrier_all(); \
\
switch (OP) { \
case BCAST: \
if (mype != npes-1) { \
for (int i = 0; i < MAX_NPES; i++) { \
if (dest[i] != (TYPE)npes-1) { \
printf("PE %i received incorrect value with " \
"TEST_SHMEM_COLLECTIVE(%s, %s)\n", mype, \
#OP, #TYPE); \
rc = EXIT_FAILURE; \
} \
} \
break; \
case COLLECT: \
for (int i = 0; i < MAX_NPES*npes; i++) { \
if (dest[i] != (TYPE)(i / MAX_NPES)) { \
printf("PE %i received incorrect value with " \
"TEST_SHMEM_COLLECTIVE(%s, %s)\n", mype, \
#OP, #TYPE); \
rc = EXIT_FAILURE; \
} \
} \
break; \
case FCOLLECT: \
for (int i = 0; i < MAX_NPES*npes; i++) { \
if (dest[i] != (TYPE)(i / MAX_NPES)) { \
printf("PE %i received incorrect value with " \
"TEST_SHMEM_COLLECTIVE(%s, %s)\n", mype, \
#OP, #TYPE); \
rc = EXIT_FAILURE; \
} \
} \
break; \
case ALLTOALL: \
for (int i = 0; i < npes; i++) { \
if (dest[i] != (TYPE)i) { \
printf("PE %i received incorrect value with " \
"TEST_SHMEM_COLLECTIVE(%s, %s)\n", mype, \
#OP, #TYPE); \
rc = EXIT_FAILURE; \
} \
} \
break; \
case ALLTOALLS: \
for (int i = 0; i < npes; i++) { \
if (dest[i] != (TYPE)i) { \
printf("PE %i received incorrect value with " \
"TEST_SHMEM_COLLECTIVE(%s, %s)\n", mype, \
#OP, #TYPE); \
rc = EXIT_FAILURE; \
} \
} \
break; \
default: \
printf("Invalid operation (%d)\n", OP); \
shmem_global_exit(1); \
} \
} \
} while (0)

#else
#define TEST_SHMEM_COLLECTIVE(OP, TYPE)

#endif

int main(void) {
shmem_init();

int rc = EXIT_SUCCESS;

const int mype = shmem_my_pe();
const int npes = shmem_n_pes();

if (npes > MAX_NPES) {
if (mype == 0)
fprintf(stderr, "ERR - Requires at least %d PEs\n", MAX_NPES);
shmem_finalize();
return 0;
}

TEST_SHMEM_COLLECTIVE(BCAST, float);
TEST_SHMEM_COLLECTIVE(BCAST, double);
TEST_SHMEM_COLLECTIVE(BCAST, long double);
TEST_SHMEM_COLLECTIVE(BCAST, char);
TEST_SHMEM_COLLECTIVE(BCAST, signed char);
TEST_SHMEM_COLLECTIVE(BCAST, short);
TEST_SHMEM_COLLECTIVE(BCAST, int);
TEST_SHMEM_COLLECTIVE(BCAST, long);
TEST_SHMEM_COLLECTIVE(BCAST, long long);
TEST_SHMEM_COLLECTIVE(BCAST, unsigned char);
TEST_SHMEM_COLLECTIVE(BCAST, unsigned short);
TEST_SHMEM_COLLECTIVE(BCAST, unsigned int);
TEST_SHMEM_COLLECTIVE(BCAST, unsigned long);
TEST_SHMEM_COLLECTIVE(BCAST, unsigned long long);
TEST_SHMEM_COLLECTIVE(BCAST, int8_t);
TEST_SHMEM_COLLECTIVE(BCAST, int16_t);
TEST_SHMEM_COLLECTIVE(BCAST, int32_t);
TEST_SHMEM_COLLECTIVE(BCAST, int64_t);
TEST_SHMEM_COLLECTIVE(BCAST, uint8_t);
TEST_SHMEM_COLLECTIVE(BCAST, uint16_t);
TEST_SHMEM_COLLECTIVE(BCAST, uint32_t);
TEST_SHMEM_COLLECTIVE(BCAST, uint64_t);
TEST_SHMEM_COLLECTIVE(BCAST, size_t);
TEST_SHMEM_COLLECTIVE(BCAST, ptrdiff_t);

TEST_SHMEM_COLLECTIVE(COLLECT, float);
TEST_SHMEM_COLLECTIVE(COLLECT, double);
TEST_SHMEM_COLLECTIVE(COLLECT, long double);
TEST_SHMEM_COLLECTIVE(COLLECT, char);
TEST_SHMEM_COLLECTIVE(COLLECT, signed char);
TEST_SHMEM_COLLECTIVE(COLLECT, short);
TEST_SHMEM_COLLECTIVE(COLLECT, int);
TEST_SHMEM_COLLECTIVE(COLLECT, long);
TEST_SHMEM_COLLECTIVE(COLLECT, long long);
TEST_SHMEM_COLLECTIVE(COLLECT, unsigned char);
TEST_SHMEM_COLLECTIVE(COLLECT, unsigned short);
TEST_SHMEM_COLLECTIVE(COLLECT, unsigned int);
TEST_SHMEM_COLLECTIVE(COLLECT, unsigned long);
TEST_SHMEM_COLLECTIVE(COLLECT, unsigned long long);
TEST_SHMEM_COLLECTIVE(COLLECT, int8_t);
TEST_SHMEM_COLLECTIVE(COLLECT, int16_t);
TEST_SHMEM_COLLECTIVE(COLLECT, int32_t);
TEST_SHMEM_COLLECTIVE(COLLECT, int64_t);
TEST_SHMEM_COLLECTIVE(COLLECT, uint8_t);
TEST_SHMEM_COLLECTIVE(COLLECT, uint16_t);
TEST_SHMEM_COLLECTIVE(COLLECT, uint32_t);
TEST_SHMEM_COLLECTIVE(COLLECT, uint64_t);
TEST_SHMEM_COLLECTIVE(COLLECT, size_t);
TEST_SHMEM_COLLECTIVE(COLLECT, ptrdiff_t);

TEST_SHMEM_COLLECTIVE(FCOLLECT, float);
TEST_SHMEM_COLLECTIVE(FCOLLECT, double);
TEST_SHMEM_COLLECTIVE(FCOLLECT, long double);
TEST_SHMEM_COLLECTIVE(FCOLLECT, char);
TEST_SHMEM_COLLECTIVE(FCOLLECT, signed char);
TEST_SHMEM_COLLECTIVE(FCOLLECT, short);
TEST_SHMEM_COLLECTIVE(FCOLLECT, int);
TEST_SHMEM_COLLECTIVE(FCOLLECT, long);
TEST_SHMEM_COLLECTIVE(FCOLLECT, long long);
TEST_SHMEM_COLLECTIVE(FCOLLECT, unsigned char);
TEST_SHMEM_COLLECTIVE(FCOLLECT, unsigned short);
TEST_SHMEM_COLLECTIVE(FCOLLECT, unsigned int);
TEST_SHMEM_COLLECTIVE(FCOLLECT, unsigned long);
TEST_SHMEM_COLLECTIVE(FCOLLECT, unsigned long long);
TEST_SHMEM_COLLECTIVE(FCOLLECT, int8_t);
TEST_SHMEM_COLLECTIVE(FCOLLECT, int16_t);
TEST_SHMEM_COLLECTIVE(FCOLLECT, int32_t);
TEST_SHMEM_COLLECTIVE(FCOLLECT, int64_t);
TEST_SHMEM_COLLECTIVE(FCOLLECT, uint8_t);
TEST_SHMEM_COLLECTIVE(FCOLLECT, uint16_t);
TEST_SHMEM_COLLECTIVE(FCOLLECT, uint32_t);
TEST_SHMEM_COLLECTIVE(FCOLLECT, uint64_t);
TEST_SHMEM_COLLECTIVE(FCOLLECT, size_t);
TEST_SHMEM_COLLECTIVE(FCOLLECT, ptrdiff_t);

TEST_SHMEM_COLLECTIVE(ALLTOALL, float);
TEST_SHMEM_COLLECTIVE(ALLTOALL, double);
TEST_SHMEM_COLLECTIVE(ALLTOALL, long double);
TEST_SHMEM_COLLECTIVE(ALLTOALL, char);
TEST_SHMEM_COLLECTIVE(ALLTOALL, signed char);
TEST_SHMEM_COLLECTIVE(ALLTOALL, short);
TEST_SHMEM_COLLECTIVE(ALLTOALL, int);
TEST_SHMEM_COLLECTIVE(ALLTOALL, long);
TEST_SHMEM_COLLECTIVE(ALLTOALL, long long);
TEST_SHMEM_COLLECTIVE(ALLTOALL, unsigned char);
TEST_SHMEM_COLLECTIVE(ALLTOALL, unsigned short);
TEST_SHMEM_COLLECTIVE(ALLTOALL, unsigned int);
TEST_SHMEM_COLLECTIVE(ALLTOALL, unsigned long);
TEST_SHMEM_COLLECTIVE(ALLTOALL, unsigned long long);
TEST_SHMEM_COLLECTIVE(ALLTOALL, int8_t);
TEST_SHMEM_COLLECTIVE(ALLTOALL, int16_t);
TEST_SHMEM_COLLECTIVE(ALLTOALL, int32_t);
TEST_SHMEM_COLLECTIVE(ALLTOALL, int64_t);
TEST_SHMEM_COLLECTIVE(ALLTOALL, uint8_t);
TEST_SHMEM_COLLECTIVE(ALLTOALL, uint16_t);
TEST_SHMEM_COLLECTIVE(ALLTOALL, uint32_t);
TEST_SHMEM_COLLECTIVE(ALLTOALL, uint64_t);
TEST_SHMEM_COLLECTIVE(ALLTOALL, size_t);
TEST_SHMEM_COLLECTIVE(ALLTOALL, ptrdiff_t);

TEST_SHMEM_COLLECTIVE(ALLTOALLS, float);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, double);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, long double);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, char);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, signed char);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, short);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, int);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, long);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, long long);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, unsigned char);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, unsigned short);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, unsigned int);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, unsigned long);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, unsigned long long);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, int8_t);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, int16_t);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, int32_t);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, int64_t);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, uint8_t);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, uint16_t);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, uint32_t);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, uint64_t);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, size_t);
TEST_SHMEM_COLLECTIVE(ALLTOALLS, ptrdiff_t);

shmem_finalize();
return rc;
}
Loading

0 comments on commit db1807c

Please sign in to comment.