Skip to content

Commit 60314d3

Browse files
authored
Merge pull request #253 from hoopoepg/topic/static-build-backport-int3
BUILD/STATIC: backport of static build
2 parents 1510f76 + 55c576f commit 60314d3

File tree

110 files changed

+1316
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1316
-403
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ test/apps/test_link_map
5252
test/apps/test_ucp_dlopen
5353
test/apps/test_ucs_dlopen
5454
test/apps/sockaddr/sa
55+
test/apps/test_init_mt
56+
test/apps/test_memtrack_limit
5557
test/examples/ucp_client_server
5658
test/examples/ucp_hello_world
5759
test/examples/uct_hello_world
@@ -63,7 +65,7 @@ debian/control
6365
debian/rules
6466
debian/ucx.postinst
6567
ucx.spec
66-
ucx.pc
68+
ucx*.pc
6769
doc/doxygen-doc
6870
doc/uml/uct.pdf
6971
doc/doxygen/header.tex

buildlib/check_tls.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+
#
5+
# See file LICENSE for terms.
6+
#
7+
8+
# check_tls.sh [extra-tls-to-check]
9+
10+
res=true;
11+
for run in ./uct_info_static ./uct_info; do
12+
echo Check for $run;
13+
output=`$run`;
14+
for i in tcp self sysv posix $@; do
15+
if `echo $output | grep -q "Transport: $i"`; then
16+
echo $i... ok;
17+
else
18+
res=false;
19+
echo $i... fail;
20+
fi;
21+
done;
22+
if test $res = false; then
23+
echo failed to check tl in $run;
24+
break;
25+
fi;
26+
done;
27+
$res
28+
29+
# done

buildlib/pr/io_demo/io-demo.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ jobs:
7474
./contrib/configure-devel --prefix=$(Build.Repository.LocalPath)/install --without-java
7575
make -j`nproc`
7676
make install
77+
# build static modules
78+
source ./buildlib/az-helpers.sh
79+
az_init_modules
80+
module load dev/libnl
81+
module load dev/numactl
82+
PKG_CONFIG_PATH=$(Build.Repository.LocalPath)/install/lib/pkgconfig:$PKG_CONFIG_PATH make -C test/apps/uct_info EXTRA_MODULES="ucx-ib ucx-cma ucx-rdmacm"
83+
module unload dev/numactl
84+
module unload dev/libnl
7785
displayName: Build
7886
name: build
7987
- task: CopyFiles@2
@@ -82,8 +90,10 @@ jobs:
8290
contents: |
8391
buildlib/az-helpers.sh
8492
buildlib/az-network-corrupter.sh
93+
buildlib/check_tls.sh
8594
install/**
8695
test/apps/iodemo/run_io_demo.sh
96+
test/apps/uct_info/*
8797
targetFolder: '$(Build.ArtifactStagingDirectory)'
8898
- task: PublishBuildArtifacts@1
8999
inputs:
@@ -140,3 +150,48 @@ jobs:
140150
extra_run_args: $(test_extra_run_args)
141151
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
142152
analyzer_allow_list_args: '--allow_list $(System.PullRequest.TargetBranch)'
153+
154+
- job: test_static
155+
dependsOn: io_build
156+
workspace:
157+
clean: all
158+
159+
pool:
160+
name: MLNX
161+
demands: ${{ parameters.demands }}
162+
163+
variables:
164+
workspace: drop_$(Build.BuildId)
165+
EXECUTOR_NUMBER: $(Build.BuildId)
166+
167+
displayName: "Test static"
168+
steps:
169+
- checkout: none
170+
clean: true
171+
- task: DownloadBuildArtifacts@0
172+
displayName: 'Download Build Artifacts'
173+
inputs:
174+
artifactName: drop_$(Build.BuildId)
175+
downloadPath: $(System.DefaultWorkingDirectory)
176+
- bash: chmod u+rwx $(workspace) -R
177+
- bash: |
178+
set -eEx
179+
cd $(workspace)/test/apps/uct_info
180+
LD_LIBRARY_PATH=$(System.DefaultWorkingDirectory)/$(workspace)/install/lib:$LD_LIBRARY_PATH \
181+
$(System.DefaultWorkingDirectory)/$(workspace)/buildlib/check_tls.sh \
182+
dc_mlx5 rc_mlx5 ud_mlx5 rc_verbs ud_verbs cma
183+
# Set port number for hello_world applications
184+
server_port=$((10000 + (EXECUTOR_NUMBER % 1000)))
185+
server_port_arg="-p $server_port"
186+
187+
for tls in ib rc rc_x; do
188+
echo UCX_TLS=$tls
189+
UCX_TLS=$tls ./ucp_hello_world_static ${server_port_arg} &
190+
# allow server to start
191+
sleep 3
192+
UCX_TLS=$tls ./ucp_hello_world_static ${server_port_arg} -n localhost
193+
# allow server to complete
194+
sleep 3
195+
done
196+
197+
cd -

buildlib/pr/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
resources:
22
containers:
33
- container: centos7
4-
image: rdmz-harbor.rdmz.labs.mlnx/ucx/centos7:3
4+
image: rdmz-harbor.rdmz.labs.mlnx/ucx/centos7:5
55
options: -v /hpc/local:/hpc/local -v /auto/sw_tools:/auto/sw_tools
66

77
stages:

config/m4/ucs.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ AS_IF([test "x$enable_backtrace_detail" = xyes],
6868
6969
if test "x$BT" = "x1"; then
7070
AC_CHECK_FUNCS([cplus_demangle])
71+
AC_SUBST([BFD_LDFLAGS], ["-lbfd -liberty -lz"])
7172
AC_DEFINE([HAVE_DETAILED_BACKTRACE], 1, [Enable detailed backtrace])
7273
case ${host} in
7374
aarch64*) CFLAGS="$CFLAGS -funwind-tables" ;;

config/module-pkg-config.am

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (C) 2022 Nvidia Corporation. All Rights Reserved.
3+
# See file LICENSE for terms.
4+
#
5+
6+
EXTRA_DIST = ucx-$(PKG_CONFIG_NAME).pc.in
7+
pkgconfigdir = $(libdir)/pkgconfig
8+
pkgconfig_DATA = ucx-$(PKG_CONFIG_NAME).pc
9+

configure.ac

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ AC_FUNC_STRERROR_R
8585
AC_PATH_TOOL([PKG_CONFIG], [pkg-config], [pkg-config])
8686

8787

88+
#
89+
# Define SHARED_LIB preprocessor macro when building a shared library
90+
#
91+
lt_prog_compiler_pic="$lt_prog_compiler_pic -DUCX_SHARED_LIB"
92+
93+
8894
#
8995
# Force link_all_deplibs=yes for libtool, otherwise it will not
9096
# link against dependency libs
@@ -222,9 +228,11 @@ AS_IF([test "x$with_docs_only" = xyes],
222228
m4_include([config/m4/rocm.m4])
223229
m4_include([config/m4/gdrcopy.m4])
224230
m4_include([src/ucm/configure.m4])
231+
m4_include([src/ucs/configure.m4])
225232
m4_include([src/uct/configure.m4])
226233
m4_include([src/tools/perf/configure.m4])
227234
m4_include([test/gtest/configure.m4])
235+
m4_include([test/apps/uct_info/configure.m4])
228236
229237
230238
#
@@ -356,7 +364,6 @@ AC_CONFIG_FILES([
356364
debian/rules
357365
debian/control
358366
debian/changelog
359-
src/ucs/Makefile
360367
src/ucp/Makefile
361368
src/ucp/api/ucp_version.h
362369
src/ucp/core/ucp_version.c

src/ucm/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@ libucm_la_SOURCES += \
5757
noinst_HEADERS += \
5858
ptmalloc286/malloc-2.8.6.h
5959
endif
60+
61+
PKG_CONFIG_NAME=ucm
62+
63+
include $(top_srcdir)/config/module-pkg-config.am

src/ucm/api/ucm.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ typedef struct ucm_global_config {
210210

211211
/*
212212
* Global UCM configuration to be set externally.
213-
* @deprecated replaced by @ref ucm_library_init.
213+
* @deprecated replaced by @ref ucm_set_global_opts.
214214
*/
215215
extern ucm_global_config_t ucm_global_opts;
216216

@@ -254,14 +254,14 @@ typedef void (*ucm_event_callback_t)(ucm_event_type_t event_type,
254254

255255

256256
/**
257-
* Initialize UCM library and set its configuration.
257+
* Set UCM library configuration.
258258
*
259259
* @param [in] ucm_opts UCM library global configuration. If NULL, default
260260
* configuration is applied.
261261
*
262262
* @note Calling this function more than once in the same process has no effect.
263263
*/
264-
void ucm_library_init(const ucm_global_config_t *ucm_opts);
264+
void ucm_set_global_opts(const ucm_global_config_t *ucm_opts);
265265

266266

267267
/**

src/ucm/bistro/bistro_aarch64.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@
5959
*/
6060
#define BR(_reg) ((0xd61f << 16) + ((_reg) << 5))
6161

62-
ucs_status_t ucm_bistro_patch(const char *symbol, void *hook,
62+
ucs_status_t ucm_bistro_patch(void *func_ptr, void *hook,
6363
ucm_bistro_restore_point_t **rp)
6464
{
65-
void *func;
6665
ucs_status_t status;
6766

6867
ucm_bistro_patch_t patch = {
@@ -73,14 +72,12 @@ ucs_status_t ucm_bistro_patch(const char *symbol, void *hook,
7372
.br = BR(R15)
7473
};
7574

76-
UCM_LOOKUP_SYMBOL(func, symbol);
77-
78-
status = ucm_bistro_create_restore_point(func, sizeof(patch), rp);
75+
status = ucm_bistro_create_restore_point(func_ptr, sizeof(patch), rp);
7976
if (UCS_STATUS_IS_ERR(status)) {
8077
return status;
8178
}
8279

83-
return ucm_bistro_apply_patch(func, &patch, sizeof(patch));
80+
return ucm_bistro_apply_patch(func_ptr, &patch, sizeof(patch));
8481
}
8582

8683
#endif

0 commit comments

Comments
 (0)