-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7096 from zasdfgbnm-nvidia/cmake
BUILD: Help cmake find UCX on system
- Loading branch information
Showing
12 changed files
with
192 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED. | ||
# | ||
# See file LICENSE for terms. | ||
# | ||
|
||
cmakedir = $(libdir)/cmake/ucx | ||
cmake_DATA = \ | ||
ucx-targets.cmake \ | ||
ucx-config.cmake \ | ||
ucx-config-version.cmake | ||
|
||
EXTRA_DIST = $(cmake_DATA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# | ||
# Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED. | ||
# | ||
# See file LICENSE for terms. | ||
# | ||
|
||
# This is a basic version file for the Config-mode of find_package(). | ||
# | ||
# This file sets PACKAGE_VERSION_EXACT if the current version string and | ||
# the requested version string are exactly the same and it sets | ||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version. | ||
|
||
set(PACKAGE_VERSION @VERSION@) | ||
|
||
if (PACKAGE_FIND_VERSION_RANGE) | ||
# Package version must be in the requested version range | ||
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) | ||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) | ||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)) | ||
set(PACKAGE_VERSION_COMPATIBLE FALSE) | ||
else() | ||
set(PACKAGE_VERSION_COMPATIBLE TRUE) | ||
endif() | ||
else() | ||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) | ||
set(PACKAGE_VERSION_COMPATIBLE FALSE) | ||
else() | ||
set(PACKAGE_VERSION_COMPATIBLE TRUE) | ||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) | ||
set(PACKAGE_VERSION_EXACT TRUE) | ||
endif() | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED. | ||
# | ||
# See file LICENSE for terms. | ||
# | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/ucx-targets.cmake") | ||
|
||
set(UCX_LIBRARIES "@libdir@") | ||
set(UCX_INCLUDE_DIRS "@includedir@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED. | ||
# | ||
# See file LICENSE for terms. | ||
# | ||
|
||
set(prefix "@prefix@") | ||
set(exec_prefix "@exec_prefix@") | ||
|
||
add_library(ucx::ucs SHARED IMPORTED) | ||
|
||
set_target_properties(ucx::ucs PROPERTIES | ||
IMPORTED_LOCATION "@libdir@/libucs.so" | ||
INTERFACE_INCLUDE_DIRECTORIES "@includedir@" | ||
) | ||
|
||
add_library(ucx::ucp SHARED IMPORTED) | ||
|
||
set_target_properties(ucx::ucp PROPERTIES | ||
IMPORTED_LOCATION "@libdir@/libucp.so" | ||
INTERFACE_INCLUDE_DIRECTORIES "@includedir@" | ||
) | ||
|
||
add_library(ucx::uct SHARED IMPORTED) | ||
|
||
set_target_properties(ucx::uct PROPERTIES | ||
IMPORTED_LOCATION "@libdir@/libuct.so" | ||
INTERFACE_INCLUDE_DIRECTORIES "@includedir@" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED. | ||
# | ||
# See file LICENSE for terms. | ||
# | ||
|
||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(test_ucx) | ||
|
||
find_package(UCX REQUIRED COMPONENTS ucp uct ucs) | ||
|
||
add_executable(test_ucp test_ucp.c) | ||
target_link_libraries(test_ucp ucx::ucp) | ||
|
||
add_executable(test_uct test_uct.c) | ||
target_link_libraries(test_uct ucx::uct ucx::ucs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED. | ||
* | ||
* See file LICENSE for terms. | ||
*/ | ||
|
||
#include <ucp/api/ucp.h> | ||
#include <assert.h> | ||
#include <string.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
ucp_params_t ucp_params = {}; | ||
ucp_context_h ucp_context; | ||
ucs_status_t status; | ||
|
||
ucp_params.field_mask = UCP_PARAM_FIELD_FEATURES; | ||
ucp_params.features = UCP_FEATURE_AM; | ||
status = ucp_init(&ucp_params, NULL, &ucp_context); | ||
assert(status == UCS_OK); | ||
|
||
ucp_cleanup(ucp_context); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED. | ||
* | ||
* See file LICENSE for terms. | ||
*/ | ||
|
||
#include <uct/api/uct.h> | ||
#include <assert.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
ucs_async_context_t *async; | ||
uct_worker_h worker; | ||
|
||
/* Initialize context */ | ||
ucs_status_t status = ucs_async_context_create(UCS_ASYNC_MODE_THREAD_SPINLOCK, &async); | ||
assert(UCS_OK == status); | ||
|
||
/* Create a worker object */ | ||
status = uct_worker_create(async, UCS_THREAD_MODE_SINGLE, &worker); | ||
assert(UCS_OK == status); | ||
|
||
/* Cleanup */ | ||
uct_worker_destroy(worker); | ||
ucs_async_context_destroy(async); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters