Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions verifier/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ noinst_HEADERS = \
strided/osh_strided_tests.h \
analysis/osh_analysis.h \
nbi/osh_nbi_tests.h \
misc/osh_misc_tests.h
misc/osh_misc_tests.h \
signal/osh_signal_tests.h

oshmem_test_SOURCES = \
osh_main.c \
Expand Down Expand Up @@ -251,7 +252,8 @@ oshmem_test_SOURCES = \
analysis/osh_analysis_tc5.c \
nbi/osh_nbi.c \
misc/osh_misc.c \
misc/osh_misc_tc1.c
misc/osh_misc_tc1.c \
signal/osh_signal.c

if HAVE_NBI
oshmem_test_SOURCES += \
Expand All @@ -265,6 +267,17 @@ oshmem_test_SOURCES += \
coll/osh_coll_tc12.c
endif

if HAVE_SIGNAL_PUT
oshmem_test_SOURCES += \
signal/osh_signal_tc1.c \
signal/osh_signal_tc2.c
endif

if HAVE_SIGNAL_FETCH
oshmem_test_SOURCES += \
signal/osh_signal_tc3.c
endif

if ENABLE_MPI
noinst_HEADERS += \
mix/osh_mix.h
Expand Down
13 changes: 13 additions & 0 deletions verifier/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ AC_CHECK_DECLS([shmem_uint_atomic_and, shmem_ulong_atomic_and, shmem_ulonglong_a
shmem_uint_atomic_xor, shmem_ulong_atomic_xor, shmem_ulonglong_atomic_xor],
[], [], [#include "shmem.h"])

dnl Check for signal operations
AC_CHECK_DECLS([shmem_putmem_signal, SHMEM_SIGNAL_SET, SHMEM_SIGNAL_ADD],
[AM_CONDITIONAL([HAVE_SIGNAL_PUT],[true])
CFLAGS="$CFLAGS -DHAVE_SIGNAL_PUT"
],
[AM_CONDITIONAL([HAVE_SIGNAL_PUT],[false])], [#include "shmem.h"])

AC_CHECK_DECLS([shmem_signal_fetch],
[AM_CONDITIONAL([HAVE_SIGNAL_FETCH],[true])
CFLAGS="$CFLAGS -DHAVE_SIGNAL_FETCH"
],
[AM_CONDITIONAL([HAVE_SIGNAL_FETCH],[false])], [#include "shmem.h"])

AC_CHECK_HEADERS([unistd.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
2 changes: 2 additions & 0 deletions verifier/osh_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern const TE_NODE mix_tcs[];
extern const TE_NODE analysis_tcs[];
extern const TE_NODE nbi_tcs[];
extern const TE_NODE misc_tcs[];
extern const TE_NODE signal_tcs[];



Expand All @@ -48,6 +49,7 @@ const TE_NODE exec_tst[] =
{ analysis_tcs, proc_tst_analysis, "analysis", aopt_set_string( "an" ), "Run " MODULE_NAME " ANALYSIS test suite.", TEST_IGNORE},
{ nbi_tcs, proc_tst_nbi, "nbi", aopt_set_string( "nb" ), "Run " MODULE_NAME " NB DATA Transfer test suite.", TEST_RUN},
{ misc_tcs, proc_tst_misc, "misc", aopt_set_string( "ms" ), "Run " MODULE_NAME " AUX test suite.", TEST_RUN},
{ signal_tcs, proc_tst_signal, "signal", aopt_set_string( "sg" ), "Run " MODULE_NAME " SIGNAL test suite.", TEST_RUN},
{ NULL, NULL, NULL, aopt_set_string( NULL ), NULL }
};

Expand Down
13 changes: 13 additions & 0 deletions verifier/osh_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ int proc_tst_mix( const TE_NODE *node, int argc, const char **argv );
int proc_tst_analysis( const TE_NODE *node, int argc, const char **argv );
int proc_tst_nbi( const TE_NODE *node, int argc, const char **argv );
int proc_tst_misc( const TE_NODE *node, int argc, const char **argv );
int proc_tst_signal( const TE_NODE *node, int argc, const char **argv );

#ifdef HAVE_SIGNAL_PUT
# define TEST_SIGNAL_PUT_SIGNAL TEST_RUN
#else
# define TEST_SIGNAL_PUT_SIGNAL TEST_SKIP
#endif

#ifdef HAVE_SIGNAL_FETCH
# define TEST_SIGNAL_FETCH TEST_RUN
#else
# define TEST_SIGNAL_FETCH TEST_SKIP
#endif

#if HAVE_DECL_SHMEM_UINT_ATOMIC_FETCH_AND
# define TEST_INT_FETCH_AND TEST_RUN
Expand Down
77 changes: 77 additions & 0 deletions verifier/signal/osh_signal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright (c) 2024 NVIDIA Corporation.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "osh_def.h"
#include "osh_cmn.h"
#include "osh_log.h"

#include "osh_tests.h"
#include "osh_signal_tests.h"


const TE_NODE signal_tcs[] =
{
#ifdef HAVE_SIGNAL_PUT
{ NULL, osh_signal_tc1, "put_signal_set", aopt_set_string( "tc1" ), "shmem_putmem_signal(): Copy data with SHMEM_SIGNAL_SET.", TEST_SIGNAL_PUT_SIGNAL},
{ NULL, osh_signal_tc2, "put_signal_add", aopt_set_string( "tc2" ), "shmem_putmem_signal(): Copy data with SHMEM_SIGNAL_ADD.", TEST_SIGNAL_PUT_SIGNAL},
#endif
#ifdef HAVE_SIGNAL_FETCH
{ NULL, osh_signal_tc3, "signal_fetch", aopt_set_string( "tc3" ), "shmem_signal_fetch(): Fetch signal value.", TEST_SIGNAL_FETCH},
#endif
{ NULL, NULL, NULL, aopt_set_string( NULL ), NULL, TEST_IGNORE}
};


/*
* List of supported test case options.
*/
static const AOPT_DESC self_opt_desc[] =
{
{ 0, AOPT_NOARG, aopt_set_literal( 0 ), aopt_set_string( NULL ), NULL }
};


int proc_tst_signal( const TE_NODE *node, int argc, const char **argv )
{
OSH_ERROR status = OSH_ERR_NONE;
const AOPT_OBJECT* self_opt_obj = NULL;

UNREFERENCED_PARAMETER(argc);

if (!node)
{
return OSH_ERR_FATAL;
}

/* Load supported option and create option objects */
{
int temp_argc = 0;

temp_argc = argc;
self_opt_obj = aopt_init(&temp_argc, (const char **)argv, self_opt_desc);
if (!self_opt_obj)
{
status = OSH_ERR_FATAL;
}
}

if (!status && self_opt_obj)
{
/* Parse specific options */
}

if (status)
{
/* Destroy option objects */
aopt_exit((AOPT_OBJECT*)self_opt_obj);
}

return status;
}

186 changes: 186 additions & 0 deletions verifier/signal/osh_signal_tc1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
/*
* Copyright (c) 2024 NVIDIA Corporation.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "osh_def.h"
#include "osh_cmn.h"
#include "osh_log.h"

#include "shmem.h"

#include "osh_signal_tests.h"

/****************************************************************************
* Test Case can consist of different number of separate items
* it is recommended to form every item as function
***************************************************************************/
static int test_item1(void);
static int test_item2(void);


/****************************************************************************
* Test Case processing procedure
***************************************************************************/
int osh_signal_tc1(const TE_NODE *node, int argc, const char *argv[])
{
int rc = TC_PASS;

UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(argv);

rc = test_item1();
log_item(node, 1, rc);
shmem_barrier_all();

if (rc == TC_PASS)
{
rc = test_item2();
log_item(node, 2, rc);
shmem_barrier_all();
}

return rc;
}


/****************************************************************************
* Place for Test Item functions
***************************************************************************/
static int test_item1(void)
{
int rc = TC_PASS;
uint64_t* data_addr = NULL;
uint64_t* signal_addr = NULL;
uint64_t expected_data = 0;
uint64_t expected_signal = 0;
int my_proc = 0;
int peer_proc = 0;
int num_proc = 0;

num_proc = _num_pes();
my_proc = _my_pe();

data_addr = (uint64_t*)shmalloc(sizeof(*data_addr));
signal_addr = (uint64_t*)shmalloc(sizeof(*signal_addr));

if (!data_addr || !signal_addr)
{
rc = TC_SETUP_FAIL;
goto cleanup;
}

*data_addr = 0;
*signal_addr = 0;
expected_data = 0x1234567890ABCDEFULL + my_proc;
expected_signal = 0xDEADBEEFULL;

shmem_barrier_all();

peer_proc = (my_proc + 1) % num_proc;

shmem_putmem_signal(data_addr, &expected_data, sizeof(uint64_t),
signal_addr, expected_signal, SHMEM_SIGNAL_SET,
peer_proc);

shmem_wait_until(signal_addr, SHMEM_CMP_EQ, expected_signal);

if (*data_addr != (0x1234567890ABCDEFULL + ((my_proc - 1 + num_proc) % num_proc)))
{
rc = TC_FAIL;
log_debug(OSH_TC, "PE #%d: Expected data = 0x%llx, got = 0x%llx\n",
my_proc, (unsigned long long)(0x1234567890ABCDEFULL + ((my_proc - 1 + num_proc) % num_proc)),
(unsigned long long)*data_addr);
goto cleanup;
}

if (*signal_addr != expected_signal)
{
rc = TC_FAIL;
log_debug(OSH_TC, "PE #%d: Expected signal = 0x%llx, got = 0x%llx\n",
my_proc, (unsigned long long)expected_signal, (unsigned long long)*signal_addr);
}

cleanup:
if (data_addr)
shfree(data_addr);
if (signal_addr)
shfree(signal_addr);

return rc;
}


static int test_item2(void)
{
int rc = TC_PASS;
uint64_t* data_addr = NULL;
uint64_t* signal_addr = NULL;
int my_proc = 0;
int num_proc = 0;

num_proc = _num_pes();
my_proc = _my_pe();

data_addr = (uint64_t*)shmalloc(sizeof(*data_addr) * 4);
signal_addr = (uint64_t*)shmalloc(sizeof(*signal_addr));

if (!data_addr || !signal_addr)
{
rc = TC_SETUP_FAIL;
goto cleanup;
}

uint64_t test_data[4] = {0x1111, 0x2222, 0x3333, 0x4444};
uint64_t signal_val = 0x5555AAAA;

for (int i = 0; i < 4; i++)
data_addr[i] = 0;
*signal_addr = 0;

shmem_barrier_all();

if (my_proc == 0 && num_proc > 1)
{
shmem_putmem_signal(data_addr, test_data, sizeof(test_data),
signal_addr, signal_val, SHMEM_SIGNAL_SET, 1);
}

shmem_barrier_all();

if (my_proc == 1)
{
shmem_wait_until(signal_addr, SHMEM_CMP_EQ, signal_val);

for (int i = 0; i < 4; i++)
{
if (data_addr[i] != test_data[i])
{
rc = TC_FAIL;
log_debug(OSH_TC, "PE #%d: data[%d] expected = 0x%llx, got = 0x%llx\n",
my_proc, i, (unsigned long long)test_data[i], (unsigned long long)data_addr[i]);
goto cleanup;
}
}

if (*signal_addr != signal_val)
{
rc = TC_FAIL;
log_debug(OSH_TC, "PE #%d: Expected signal = 0x%llx, got = 0x%llx\n",
my_proc, (unsigned long long)signal_val, (unsigned long long)*signal_addr);
}
}

cleanup:
if (data_addr)
shfree(data_addr);
if (signal_addr)
shfree(signal_addr);

return rc;
}

Loading