From e50b666011b375da31c99baeb2ac37524b5447e7 Mon Sep 17 00:00:00 2001 From: Alina Sklarevich Date: Tue, 23 Dec 2014 16:43:21 +0200 Subject: [PATCH 1/4] UCP/GTEST: initialization of the ucp layer. and a test in gtest for testing it. --- Makefile.am | 2 +- configure.ac | 1 + src/ucp/Makefile.am | 24 ++++++ src/ucp/api/ucp.h | 53 +++++++++++++ src/ucp/api/ucp_def.h | 15 ++++ src/ucp/ucp.c | 137 ++++++++++++++++++++++++++++++++++ test/gtest/Makefile.am | 6 +- test/gtest/ucp/test_ucp_ep.cc | 41 ++++++++++ test/gtest/ucp/ucp_test.cc | 43 +++++++++++ test/gtest/ucp/ucp_test.h | 43 +++++++++++ 10 files changed, 363 insertions(+), 2 deletions(-) create mode 100644 src/ucp/Makefile.am create mode 100644 src/ucp/api/ucp.h create mode 100644 src/ucp/api/ucp_def.h create mode 100644 src/ucp/ucp.c create mode 100644 test/gtest/ucp/test_ucp_ep.cc create mode 100644 test/gtest/ucp/ucp_test.cc create mode 100644 test/gtest/ucp/ucp_test.h diff --git a/Makefile.am b/Makefile.am index 229ecd9e19f..dac17376a6f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ ACLOCAL_AMFLAGS = -I config/m4 -SUBDIRS = src/ucs src/uct src/tools/info test/perf +SUBDIRS = src/ucs src/uct src/ucp src/tools/info test/perf if HAVE_GTEST SUBDIRS += test/gtest diff --git a/configure.ac b/configure.ac index 74800657eec..b18d0fb0ebf 100644 --- a/configure.ac +++ b/configure.ac @@ -184,6 +184,7 @@ AC_CONFIG_FILES([ src/ucs/Makefile src/uct/Makefile src/uct/api/version.h + src/ucp/Makefile src/tools/info/Makefile test/gtest/Makefile test/perf/Makefile diff --git a/src/ucp/Makefile.am b/src/ucp/Makefile.am new file mode 100644 index 00000000000..d36d99e8ac9 --- /dev/null +++ b/src/ucp/Makefile.am @@ -0,0 +1,24 @@ +# +# Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. +# Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED. +# $COPYRIGHT$ +# $HEADER$ +# + +lib_LTLIBRARIES = libucp.la + +libucp_la_CFLAGS = +libucp_la_LIBS = +libucp_la_CPPFLAGS = -I$(abs_top_srcdir)/src -I$(abs_top_builddir)/src +libucp_la_LDFLAGS = -ldl -version-info $(SOVERSION) +libucp_la_LIBADD = $(LIBM) ../ucs/libucs.la +libucp_ladir = $(includedir) + +nobase_dist_libucp_la_HEADERS = \ + api/ucp_def.h \ + api/ucp.h + +noinst_HEADERS = + +libucp_la_SOURCES = \ + ucp.c diff --git a/src/ucp/api/ucp.h b/src/ucp/api/ucp.h new file mode 100644 index 00000000000..a46b03b72f8 --- /dev/null +++ b/src/ucp/api/ucp.h @@ -0,0 +1,53 @@ +/** +* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. +* +* $COPYRIGHT$ +* $HEADER$ +*/ + +#ifndef UCP_H_ +#define UCP_H_ + +#include "ucp_def.h" +#include +#include +#include +#include + + +typedef struct ucp_context { + uct_context_h uct_context; + uct_resource_desc_t *resources; //should be list/array of resources? +} ucp_context_t; + +/** + * Remote protocol layer endpoint + */ +typedef struct ucp_ep { + ucp_iface_h ucp_iface; // local interface? + uct_ep_h uct_ep; // remote eps - one per transport +} ucp_ep_t; + +/** + * Local protocol layer interface + */ +typedef struct ucp_iface { + ucp_context_h context; + uct_iface_h uct_iface; +} ucp_iface_t; + + +ucs_status_t ucp_init(ucp_context_h *context_p); + +void ucp_cleanup(ucp_context_h context_p); + +ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface); + +void ucp_iface_close(ucp_iface_h ucp_iface); + +ucs_status_t ucp_ep_create(ucp_iface_h ucp_iface, ucp_ep_h *ucp_ep); + +void ucp_ep_destroy(ucp_ep_h ucp_ep); + + +#endif /* UCP_H_ */ diff --git a/src/ucp/api/ucp_def.h b/src/ucp/api/ucp_def.h new file mode 100644 index 00000000000..d49bf3e280d --- /dev/null +++ b/src/ucp/api/ucp_def.h @@ -0,0 +1,15 @@ +/** +* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. +* +* $COPYRIGHT$ +* $HEADER$ +*/ + +#ifndef UCP_DEF_H_ +#define UCP_DEF_H_ + +typedef struct ucp_context *ucp_context_h; +typedef struct ucp_ep *ucp_ep_h; +typedef struct ucp_iface *ucp_iface_h; + +#endif /* UCP_DEF_H_ */ diff --git a/src/ucp/ucp.c b/src/ucp/ucp.c new file mode 100644 index 00000000000..057536cd628 --- /dev/null +++ b/src/ucp/ucp.c @@ -0,0 +1,137 @@ +/** +* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. +* Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED. +* $COPYRIGHT$ +* $HEADER$ +*/ + +#include +#include + +UCS_COMPONENT_LIST_DEFINE(ucp_context_t); +UCS_COMPONENT_LIST_DEFINE(ucp_iface_t); +UCS_COMPONENT_LIST_DEFINE(ucp_ep_t); + +ucs_status_t ucp_init(ucp_context_h *context_p) +{ + ucs_status_t status; + ucp_context_t *context; + uct_resource_desc_t *resources; + unsigned num_resources; + + /* allocate a ucp context */ + context = ucs_malloc(ucs_components_total_size(ucp_context_t),"ucp context"); + if (context == NULL) { + status = UCS_ERR_NO_MEMORY; + goto err; + } + + /* initialize uct */ + status = uct_init(&context->uct_context); + if (status != UCS_OK) { + ucs_error("Failed to initialize UCT: %s", ucs_status_string(status)); + goto err_free_ctx; + } + + status = uct_query_resources(context->uct_context, &resources, &num_resources); + if (status != UCS_OK) { + ucs_error("Failed to query resources: %s\n",ucs_status_string(status)); + goto err_free_uct; + } + + context->resources = resources; + *context_p = context; + + return UCS_OK; + +err_free_uct: + uct_cleanup(context->uct_context); +err_free_ctx: + ucs_free(context); +err: + return status; +} + +void ucp_cleanup(ucp_context_h context_p) +{ + uct_release_resource_list(context_p->resources); + uct_cleanup(context_p->uct_context); + ucs_free(context_p); +} + +ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_p) +{ + ucp_iface_t *ucp_iface; + uct_iface_config_t *iface_config; + ucs_status_t status; + + ucp_iface = ucs_malloc(ucs_components_total_size(ucp_iface_t), "ucp iface"); + + status = uct_iface_config_read(ucp_context->uct_context, + ucp_context->resources->tl_name, NULL, NULL, + &iface_config); + if (status != UCS_OK) { + ucs_error("Failed to read UCT config: %s", ucs_status_string(status)); + goto err; + } + + // need to open all the resources, one iface per resource? + status = uct_iface_open(ucp_context->uct_context, + ucp_context->resources->tl_name, + ucp_context->resources->dev_name, 0, iface_config, + &ucp_iface->uct_iface); + if (status != UCS_OK) { + goto err_release_cfg; + } + + uct_iface_config_release(iface_config); + + ucp_iface->context = ucp_context; + *ucp_iface_p = ucp_iface; + + + return UCS_OK; + +err_release_cfg: + uct_iface_config_release(iface_config); +err: + return status; + +} + +void ucp_iface_close(ucp_iface_h ucp_iface) +{ + uct_iface_close(ucp_iface->uct_iface); + ucs_free(ucp_iface); +} + +ucs_status_t ucp_ep_create(ucp_iface_h ucp_iface, ucp_ep_h *ucp_ep_p) +{ + ucp_ep_t *ucp_ep; + ucs_status_t status; + + ucp_ep = ucs_malloc(ucs_components_total_size(ucp_ep_t), "ucp ep"); + if (ucp_ep == NULL) { + status = UCS_ERR_NO_MEMORY; + goto err; + } + + status = uct_ep_create(ucp_iface->uct_iface, &ucp_ep->uct_ep); + if (UCS_OK != status) { + goto err_free_ep; + } + + *ucp_ep_p = ucp_ep; + return UCS_OK; + +err_free_ep: + ucs_free(ucp_ep); +err: + return status; +} + +void ucp_ep_destroy(ucp_ep_h ucp_ep) +{ + uct_ep_destroy(ucp_ep->uct_ep); + ucs_free(ucp_ep); +} diff --git a/test/gtest/Makefile.am b/test/gtest/Makefile.am index 819ed1d452c..021c1efb4a5 100644 --- a/test/gtest/Makefile.am +++ b/test/gtest/Makefile.am @@ -25,6 +25,7 @@ gtestdir = $(includedir) gtest_LDADD = \ $(top_builddir)/src/ucs/libucs.la \ $(top_builddir)/src/uct/libuct.la \ + $(top_builddir)/src/ucp/libucp.la \ $(top_builddir)/src/ucs/libucstest.la \ $(top_builddir)/test/perf/libucxperf.la \ $(GTEST_LIBS) \ @@ -47,6 +48,8 @@ gtest_SOURCES = \ uct/test_uct_perf.cc \ uct/uct_p2p_test.cc \ uct/uct_test.cc \ + ucp/ucp_test.cc \ + ucp/test_ucp_ep.cc \ ucs/test_class.cc \ ucs/test_component.cc \ ucs/test_config.cc \ @@ -64,7 +67,8 @@ gtest_SOURCES = \ noinst_HEADERS = \ uct/uct_p2p_test.h \ - uct/uct_test.h + uct/uct_test.h \ + ucp/ucp_test.h .PHONY: test test gdb valgrind fix_rpath ucx diff --git a/test/gtest/ucp/test_ucp_ep.cc b/test/gtest/ucp/test_ucp_ep.cc new file mode 100644 index 00000000000..849913a1607 --- /dev/null +++ b/test/gtest/ucp/test_ucp_ep.cc @@ -0,0 +1,41 @@ +/** +* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. +* Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED. +* $COPYRIGHT$ +* $HEADER$ +*/ + +#include +extern "C" { +#include +} + +class test_ucp : public ucs::test { +}; + +UCS_TEST_F(test_ucp, open_ep) { + ucs_status_t status; + ucp_context_h ucph; + ucp_iface_h iface; + ucp_ep_h ep; + + ucph = NULL; + iface = NULL; + ep = NULL; + + /* initialize ucp context, interface and ep */ + status = ucp_init(&ucph); + ASSERT_UCS_OK(status); + ASSERT_TRUE(ucph != NULL); + + status = ucp_iface_create(ucph, &iface); + ASSERT_UCS_OK(status); + + status = ucp_ep_create(iface, &ep); + ASSERT_UCS_OK(status); + + /* release everything */ + ucp_ep_destroy(ep); + ucp_iface_close(iface); + ucp_cleanup (ucph); +} diff --git a/test/gtest/ucp/ucp_test.cc b/test/gtest/ucp/ucp_test.cc new file mode 100644 index 00000000000..78085228d1a --- /dev/null +++ b/test/gtest/ucp/ucp_test.cc @@ -0,0 +1,43 @@ +/** +* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. +* +* $COPYRIGHT$ +* $HEADER$ +*/ + +#include "ucp_test.h" + +#include + + +ucp_test::entity::entity() { + ucs_status_t status; + + status = ucp_init(&m_ucph); + ASSERT_UCS_OK(status); + + status = ucp_iface_create(m_ucph, &m_iface); + ASSERT_UCS_OK(status); + + status = ucp_ep_create(m_iface, &m_ep); + ASSERT_UCS_OK(status); + +} + +ucp_test::entity::~entity() { + ucp_ep_destroy(m_ep); + ucp_iface_close(m_iface); + ucp_cleanup(m_ucph); +} + +void ucp_test::entity::connect(const ucp_test::entity& other) { + +} + +ucp_ep_h ucp_test::entity::ep() const { + return m_ep; +} + +void ucp_test::entity::flush() const { + +} diff --git a/test/gtest/ucp/ucp_test.h b/test/gtest/ucp/ucp_test.h new file mode 100644 index 00000000000..84821b78508 --- /dev/null +++ b/test/gtest/ucp/ucp_test.h @@ -0,0 +1,43 @@ +/** +* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. +* +* $COPYRIGHT$ +* $HEADER$ +*/ + +#ifndef UCP_TEST_H_ +#define UCP_TEST_H_ + +extern "C" { +#include +} +#include + + +/** + * UCP test + */ +class ucp_test : public ucs::test_base { +public: + UCS_TEST_BASE_IMPL; + +protected: + class entity { + public: + entity(); + ~entity(); + + void connect(const entity& other); + + ucp_ep_h ep() const; + + void flush() const; + + protected: + ucp_context_h m_ucph; + ucp_iface_h m_iface; + ucp_ep_h m_ep; + }; +}; + +#endif /* UCP_TEST_H_ */ From 26c7990fe7ed919461ad77a8b48fd0356baf9be3 Mon Sep 17 00:00:00 2001 From: Alina Sklarevich Date: Tue, 23 Dec 2014 18:48:35 +0200 Subject: [PATCH 2/4] UCP: fix compilation --- src/ucp/ucp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ucp/ucp.c b/src/ucp/ucp.c index 057536cd628..c8c229f7372 100644 --- a/src/ucp/ucp.c +++ b/src/ucp/ucp.c @@ -5,7 +5,7 @@ * $HEADER$ */ -#include +#include #include UCS_COMPONENT_LIST_DEFINE(ucp_context_t); @@ -66,13 +66,17 @@ ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_ ucs_status_t status; ucp_iface = ucs_malloc(ucs_components_total_size(ucp_iface_t), "ucp iface"); + if (ucp_iface == NULL) { + status = UCS_ERR_NO_MEMORY; + goto err; + } status = uct_iface_config_read(ucp_context->uct_context, ucp_context->resources->tl_name, NULL, NULL, &iface_config); if (status != UCS_OK) { ucs_error("Failed to read UCT config: %s", ucs_status_string(status)); - goto err; + goto err_free_iface; } // need to open all the resources, one iface per resource? @@ -94,6 +98,8 @@ ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_ err_release_cfg: uct_iface_config_release(iface_config); +err_free_iface: + ucs_free(ucp_iface); err: return status; From a23ea40c3f18bacf3222e821ecdc7b76099b79fd Mon Sep 17 00:00:00 2001 From: Alina Sklarevich Date: Wed, 24 Dec 2014 11:57:42 +0200 Subject: [PATCH 3/4] UCP/GTEST: apply code review changes. --- src/ucp/Makefile.am | 3 +-- src/ucp/api/ucp.h | 51 +++++++++++++++++++++++++++++++++++--- src/ucp/ucp.c | 23 ++++++----------- test/gtest/ucp/ucp_test.cc | 2 -- test/gtest/ucp/ucp_test.h | 4 +-- 5 files changed, 57 insertions(+), 26 deletions(-) diff --git a/src/ucp/Makefile.am b/src/ucp/Makefile.am index d36d99e8ac9..1bb7bd9974b 100644 --- a/src/ucp/Makefile.am +++ b/src/ucp/Makefile.am @@ -1,6 +1,5 @@ # # Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. -# Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED. # $COPYRIGHT$ # $HEADER$ # @@ -11,7 +10,7 @@ libucp_la_CFLAGS = libucp_la_LIBS = libucp_la_CPPFLAGS = -I$(abs_top_srcdir)/src -I$(abs_top_builddir)/src libucp_la_LDFLAGS = -ldl -version-info $(SOVERSION) -libucp_la_LIBADD = $(LIBM) ../ucs/libucs.la +libucp_la_LIBADD = ../ucs/libucs.la libucp_ladir = $(includedir) nobase_dist_libucp_la_HEADERS = \ diff --git a/src/ucp/api/ucp.h b/src/ucp/api/ucp.h index a46b03b72f8..d3f578e145b 100644 --- a/src/ucp/api/ucp.h +++ b/src/ucp/api/ucp.h @@ -17,15 +17,15 @@ typedef struct ucp_context { uct_context_h uct_context; - uct_resource_desc_t *resources; //should be list/array of resources? + uct_resource_desc_t *resources; /* TODO should be list/array of resources? */ } ucp_context_t; /** * Remote protocol layer endpoint */ typedef struct ucp_ep { - ucp_iface_h ucp_iface; // local interface? - uct_ep_h uct_ep; // remote eps - one per transport + ucp_iface_h ucp_iface; + uct_ep_h uct_ep; /* TODO remote eps - one per transport */ } ucp_ep_t; /** @@ -36,17 +36,60 @@ typedef struct ucp_iface { uct_iface_h uct_iface; } ucp_iface_t; - +/** + * @ingroup CONTEXT + * @brief Initialize global ucp context. + * + * @param [out] context_p Filled with a ucp context handle. + * + * @return Error code. + */ ucs_status_t ucp_init(ucp_context_h *context_p); +/** + * @ingroup CONTEXT + * @brief Destroy global ucp context. + * + * @param [in] context_p Handle to the ucp context. + */ void ucp_cleanup(ucp_context_h context_p); +/** + * @ingroup CONTEXT + * @brief Create and open a communication interface. + * + * @param [in] ucp_context Handle to the ucp context. + * @param [out] ucp_iface Filled with a handle to the opened communication interface. + * + * @return Error code. + */ ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface); +/** + * @ingroup CONTEXT + * @brief Close the communication interface. + * + * @param [in] ucp_iface Handle to the communication interface. + */ void ucp_iface_close(ucp_iface_h ucp_iface); +/** + * @ingroup CONTEXT + * @brief Create and open a remote endpoint. + * + * @param [in] ucp_iface Handle to the communication interface. + * @param [out] ucp_ep Filled with a handle to the opened remote endpoint. + * + * @return Error code. + */ ucs_status_t ucp_ep_create(ucp_iface_h ucp_iface, ucp_ep_h *ucp_ep); +/** + * @ingroup CONTEXT + * @brief Close the remote endpoint. + * + * @param [in] ucp_ep Handle to the remote endpoint. + */ void ucp_ep_destroy(ucp_ep_h ucp_ep); diff --git a/src/ucp/ucp.c b/src/ucp/ucp.c index c8c229f7372..5aca9023b98 100644 --- a/src/ucp/ucp.c +++ b/src/ucp/ucp.c @@ -1,6 +1,5 @@ /** * Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. -* Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED. * $COPYRIGHT$ * $HEADER$ */ @@ -8,10 +7,6 @@ #include #include -UCS_COMPONENT_LIST_DEFINE(ucp_context_t); -UCS_COMPONENT_LIST_DEFINE(ucp_iface_t); -UCS_COMPONENT_LIST_DEFINE(ucp_ep_t); - ucs_status_t ucp_init(ucp_context_h *context_p) { ucs_status_t status; @@ -20,7 +15,7 @@ ucs_status_t ucp_init(ucp_context_h *context_p) unsigned num_resources; /* allocate a ucp context */ - context = ucs_malloc(ucs_components_total_size(ucp_context_t),"ucp context"); + context = ucs_malloc(sizeof(*context),"ucp context"); if (context == NULL) { status = UCS_ERR_NO_MEMORY; goto err; @@ -52,11 +47,11 @@ ucs_status_t ucp_init(ucp_context_h *context_p) return status; } -void ucp_cleanup(ucp_context_h context_p) +void ucp_cleanup(ucp_context_h context) { - uct_release_resource_list(context_p->resources); - uct_cleanup(context_p->uct_context); - ucs_free(context_p); + uct_release_resource_list(context->resources); + uct_cleanup(context->uct_context); + ucs_free(context); } ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_p) @@ -65,7 +60,7 @@ ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_ uct_iface_config_t *iface_config; ucs_status_t status; - ucp_iface = ucs_malloc(ucs_components_total_size(ucp_iface_t), "ucp iface"); + ucp_iface = ucs_malloc(sizeof(*ucp_iface), "ucp iface"); if (ucp_iface == NULL) { status = UCS_ERR_NO_MEMORY; goto err; @@ -79,7 +74,7 @@ ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_ goto err_free_iface; } - // need to open all the resources, one iface per resource? + /* TODO open all resources. for now we open just the 1st */ status = uct_iface_open(ucp_context->uct_context, ucp_context->resources->tl_name, ucp_context->resources->dev_name, 0, iface_config, @@ -93,7 +88,6 @@ ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_ ucp_iface->context = ucp_context; *ucp_iface_p = ucp_iface; - return UCS_OK; err_release_cfg: @@ -102,7 +96,6 @@ ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_ ucs_free(ucp_iface); err: return status; - } void ucp_iface_close(ucp_iface_h ucp_iface) @@ -116,7 +109,7 @@ ucs_status_t ucp_ep_create(ucp_iface_h ucp_iface, ucp_ep_h *ucp_ep_p) ucp_ep_t *ucp_ep; ucs_status_t status; - ucp_ep = ucs_malloc(ucs_components_total_size(ucp_ep_t), "ucp ep"); + ucp_ep = ucs_malloc(sizeof(*ucp_ep), "ucp ep"); if (ucp_ep == NULL) { status = UCS_ERR_NO_MEMORY; goto err; diff --git a/test/gtest/ucp/ucp_test.cc b/test/gtest/ucp/ucp_test.cc index 78085228d1a..d386914e4b5 100644 --- a/test/gtest/ucp/ucp_test.cc +++ b/test/gtest/ucp/ucp_test.cc @@ -9,7 +9,6 @@ #include - ucp_test::entity::entity() { ucs_status_t status; @@ -21,7 +20,6 @@ ucp_test::entity::entity() { status = ucp_ep_create(m_iface, &m_ep); ASSERT_UCS_OK(status); - } ucp_test::entity::~entity() { diff --git a/test/gtest/ucp/ucp_test.h b/test/gtest/ucp/ucp_test.h index 84821b78508..3a1458e579c 100644 --- a/test/gtest/ucp/ucp_test.h +++ b/test/gtest/ucp/ucp_test.h @@ -17,9 +17,7 @@ extern "C" { /** * UCP test */ -class ucp_test : public ucs::test_base { -public: - UCS_TEST_BASE_IMPL; +class ucp_test : public ucs::test { protected: class entity { From 0ea51cc7113bed9cd6b20730735bc66ed994b3a9 Mon Sep 17 00:00:00 2001 From: Alina Sklarevich Date: Thu, 25 Dec 2014 15:24:26 +0200 Subject: [PATCH 4/4] UCP/GTEST: apply more CR changes. --- src/ucp/api/ucp.h | 6 ++++-- src/ucp/api/ucp_def.h | 1 - src/ucp/ucp.c | 7 ++++--- test/gtest/ucp/test_ucp_ep.cc | 3 +-- test/gtest/ucp/ucp_test.cc | 3 +-- test/gtest/ucp/ucp_test.h | 1 - 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/ucp/api/ucp.h b/src/ucp/api/ucp.h index d3f578e145b..71a29b67d35 100644 --- a/src/ucp/api/ucp.h +++ b/src/ucp/api/ucp.h @@ -1,6 +1,5 @@ /** * Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. -* * $COPYRIGHT$ * $HEADER$ */ @@ -59,11 +58,14 @@ void ucp_cleanup(ucp_context_h context_p); * @brief Create and open a communication interface. * * @param [in] ucp_context Handle to the ucp context. + * @param [in] env_prefix If non-NULL, search for environment variables + * starting with this UCP__. Otherwise, search + * for environment variables starting with just UCP_. * @param [out] ucp_iface Filled with a handle to the opened communication interface. * * @return Error code. */ -ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface); +ucs_status_t ucp_iface_create(ucp_context_h ucp_context, const char *env_prefix, ucp_iface_h *ucp_iface); /** * @ingroup CONTEXT diff --git a/src/ucp/api/ucp_def.h b/src/ucp/api/ucp_def.h index d49bf3e280d..a0ffa824aaa 100644 --- a/src/ucp/api/ucp_def.h +++ b/src/ucp/api/ucp_def.h @@ -1,6 +1,5 @@ /** * Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. -* * $COPYRIGHT$ * $HEADER$ */ diff --git a/src/ucp/ucp.c b/src/ucp/ucp.c index 5aca9023b98..742045b0f82 100644 --- a/src/ucp/ucp.c +++ b/src/ucp/ucp.c @@ -30,7 +30,7 @@ ucs_status_t ucp_init(ucp_context_h *context_p) status = uct_query_resources(context->uct_context, &resources, &num_resources); if (status != UCS_OK) { - ucs_error("Failed to query resources: %s\n",ucs_status_string(status)); + ucs_error("Failed to query resources: %s",ucs_status_string(status)); goto err_free_uct; } @@ -54,7 +54,8 @@ void ucp_cleanup(ucp_context_h context) ucs_free(context); } -ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_p) +ucs_status_t ucp_iface_create(ucp_context_h ucp_context, const char *env_prefix, + ucp_iface_h *ucp_iface_p) { ucp_iface_t *ucp_iface; uct_iface_config_t *iface_config; @@ -67,7 +68,7 @@ ucs_status_t ucp_iface_create(ucp_context_h ucp_context, ucp_iface_h *ucp_iface_ } status = uct_iface_config_read(ucp_context->uct_context, - ucp_context->resources->tl_name, NULL, NULL, + ucp_context->resources->tl_name, env_prefix, NULL, &iface_config); if (status != UCS_OK) { ucs_error("Failed to read UCT config: %s", ucs_status_string(status)); diff --git a/test/gtest/ucp/test_ucp_ep.cc b/test/gtest/ucp/test_ucp_ep.cc index 849913a1607..ec078cc15da 100644 --- a/test/gtest/ucp/test_ucp_ep.cc +++ b/test/gtest/ucp/test_ucp_ep.cc @@ -1,6 +1,5 @@ /** * Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. -* Copyright (C) UT-Battelle, LLC. 2014. ALL RIGHTS RESERVED. * $COPYRIGHT$ * $HEADER$ */ @@ -28,7 +27,7 @@ UCS_TEST_F(test_ucp, open_ep) { ASSERT_UCS_OK(status); ASSERT_TRUE(ucph != NULL); - status = ucp_iface_create(ucph, &iface); + status = ucp_iface_create(ucph, NULL, &iface); ASSERT_UCS_OK(status); status = ucp_ep_create(iface, &ep); diff --git a/test/gtest/ucp/ucp_test.cc b/test/gtest/ucp/ucp_test.cc index d386914e4b5..65e5c2e910e 100644 --- a/test/gtest/ucp/ucp_test.cc +++ b/test/gtest/ucp/ucp_test.cc @@ -1,6 +1,5 @@ /** * Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. -* * $COPYRIGHT$ * $HEADER$ */ @@ -15,7 +14,7 @@ ucp_test::entity::entity() { status = ucp_init(&m_ucph); ASSERT_UCS_OK(status); - status = ucp_iface_create(m_ucph, &m_iface); + status = ucp_iface_create(m_ucph, NULL, &m_iface); ASSERT_UCS_OK(status); status = ucp_ep_create(m_iface, &m_ep); diff --git a/test/gtest/ucp/ucp_test.h b/test/gtest/ucp/ucp_test.h index 3a1458e579c..e07346ac8eb 100644 --- a/test/gtest/ucp/ucp_test.h +++ b/test/gtest/ucp/ucp_test.h @@ -1,6 +1,5 @@ /** * Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. -* * $COPYRIGHT$ * $HEADER$ */