1
1
openmpi/opal/mca/btl/usnic/btl_usnic_test.h
Ralph Castain 552c9ca5a0 George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT:    Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL

All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies.  This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP.  Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose.  UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs.  A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.

This commit was SVN r32317.
2014-07-26 00:47:28 +00:00

96 строки
4.0 KiB
C

/*
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef BTL_USNIC_TEST_H
#define BTL_USNIC_TEST_H
#include "opal_config.h"
typedef int (*opal_btl_usnic_test_fn_t)(void *ctx);
#if OPAL_BTL_USNIC_UNIT_TESTS
# define test_out(...) fprintf(stderr, __VA_ARGS__)
# define check(a) \
do { \
if (!(a)) { \
test_out("%s:%d: check failed, '%s'\n", __func__, __LINE__, #a); \
return TEST_FAILED; \
} \
} while (0)
# define check_str_eq(a,b) \
do { \
const char *a_ = (a); \
const char *b_ = (b); \
if (0 != strcmp(a_,b_)) { \
test_out("%s:%d: check failed, \"%s\" != \"%s\"\n", \
__func__, __LINE__, a_, b_); \
return TEST_FAILED; \
} \
} while (0)
# define check_int_eq(got, expected) \
do { \
if ((got) != (expected)) { \
test_out("%s:%d: check failed, \"%s\" != \"%s\", got %d\n", \
__func__, __LINE__, #got, #expected, (got)); \
return TEST_FAILED; \
} \
} while (0)
/* just use check_int_eq for now, no public error code to string routine
* exists (opal_err2str is static) */
# define check_err_code(got, expected) \
check_int_eq(got, expected)
# define check_msg(a, msg) \
do { \
if (!(a)) { \
test_out("%s:%d: check failed, \"%s\" (%s)\n", \
__func__, __LINE__, #a, (msg)); \
return TEST_FAILED; \
} \
} while (0)
extern int opal_btl_usnic_num_tests_run;
extern int opal_btl_usnic_num_tests_passed;
extern int opal_btl_usnic_num_tests_failed;
extern int opal_btl_usnic_num_tests_skipped;
enum test_result {
TEST_PASSED = 0,
TEST_FAILED,
TEST_SKIPPED
};
/* let us actually paste __LINE__ with other tokens */
# define USNIC_PASTE(a,b) USNIC_PASTE2(a,b)
# define USNIC_PASTE2(a,b) a ## b
/* A helper macro to de-clutter test registration. */
# define USNIC_REGISTER_TEST(name, test_fn, ctx) \
__attribute__((__constructor__)) \
static void USNIC_PASTE(usnic_reg_ctor_,__LINE__)(void) \
{ \
opal_btl_usnic_register_test(name, test_fn, ctx); \
} \
#else /* !OPAL_BTL_USNIC_UNIT_TESTS */
# define test_out(...) do {} while(0)
# define USNIC_REGISTER_TEST(name, test_fn, ctx)
#endif
/* Run all registered tests. Typically called by an external utility that
* dlopens the usnic BTL shared object. See run_usnic_tests.c. */
void opal_btl_usnic_run_tests(void);
void opal_btl_usnic_register_test(const char *name,
opal_btl_usnic_test_fn_t test_fn,
void *ctx);
/* should be called once, at component close time */
void opal_btl_usnic_cleanup_tests(void);
#endif /* BTL_USNIC_TEST_H */