Skip to content

Commit

Permalink
UCT/IB: resolved conflicts #3
Browse files Browse the repository at this point in the history
  • Loading branch information
roiedanino committed Aug 28, 2023
2 parents dcdaa6d + 5f00157 commit 2f30dcc
Show file tree
Hide file tree
Showing 66 changed files with 1,270 additions and 292 deletions.
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ ForEachMacros: ['_UCS_BITMAP_FOR_EACH_WORD',
'UCT_RC_VERBS_IFACE_FOREACH_TXWQE',
'UCS_INIT_ONCE',
'UCS_TEST_F',
'UCX_PERF_TEST_FOREACH']
'UCX_PERF_TEST_FOREACH',
'ucs_lru_for_each']
StatementMacros : []
TypenameMacros: ['khash_t', 'ucs_array_t']
WhitespaceSensitiveMacros: []
Expand Down
8 changes: 8 additions & 0 deletions buildlib/pr/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,14 @@ stages:
demands: ucx_bf -equals yes
test_perf: 0

- stage: Namespace_Tests
dependsOn: [Static_check]
jobs:
- template: namespace_tests.yml
parameters:
name: new_namespace
demands: ucx_new -equals yes

- stage: io_demo
dependsOn: [Static_check]
jobs:
Expand Down
27 changes: 27 additions & 0 deletions buildlib/pr/namespace_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
jobs:
- job: tests_${{ parameters.name }}
pool:
name: MLNX
demands: ${{ parameters.demands }}
displayName: ${{ parameters.name }} on worker
timeoutInMinutes: 30
workspace:
clean: all
steps:
- checkout: self
clean: true
fetchDepth: 100

- bash: |
source buildlib/az-helpers.sh
if ! unshare --user whoami; then
msg="Missing user namespace support on $(hostname)"
azure_log_error "$msg"
azure_complete_with_issues "$msg"
else
./contrib/test_namespace.sh
fi
displayName: Run namespace test
env:
BUILD_NUMBER: "$(Build.BuildId)-$(Build.BuildNumber)"
JOB_URL: "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)"
48 changes: 47 additions & 1 deletion buildlib/tools/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,52 @@ MAKE="make V=1"
MAKEP="make V=1 -j${parallel_jobs}"
export AUTOMAKE_JOBS=$parallel_jobs

#
# Prepare build environment
#
prepare() {
echo " ==== Prepare ===="
env
cd ${WORKSPACE}
if [ -d build-test ]
then
chmod u+rwx build-test -R
rm -rf build-test
fi
./autogen.sh
mkdir -p build-test
cd build-test
}

#
# Configure and build
# $1 - mode (devel|release)
#
build() {
mode=$1
shift

config_args="--prefix=$ucx_inst --without-java"
if [ "X$have_cuda" == "Xyes" ]
then
config_args+=" --with-iodemo-cuda"
fi

../contrib/configure-${mode} ${config_args} "$@"
make_clean
$MAKEP
$MAKEP install
}

#
# Update global server port
#
step_server_port() {
# Cycle server_port between (server_port_min)..(server_port_max-1)
server_port=$((server_port + 1))
server_port=$((server_port >= server_port_max ? server_port_min : server_port))
}

#
# cleanup ucx
#
Expand All @@ -42,7 +88,7 @@ make_clean() {
# Prepare build environment
#
prepare_build() {
echo " ==== Prepare ===="
echo " ==== Prepare Build ===="
env
cd ${WORKSPACE}
if [ -d ${ucx_build_dir} ]
Expand Down
53 changes: 2 additions & 51 deletions contrib/test_jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
# - COV_OPT : command line options for Coverity static checker
#

source $(dirname $0)/../buildlib/tools/common.sh

WORKSPACE=${WORKSPACE:=$PWD}
ucx_inst=${WORKSPACE}/install
CUDA_MODULE="dev/cuda11.4"
Expand Down Expand Up @@ -110,34 +112,6 @@ log_error() {
test "x$RUNNING_IN_AZURE" = "xyes" && { azure_log_error "${msg}" ; set -x; } || echo "${msg}"
}

#
# cleanup ucx
#
make_clean() {
rm -rf ${ucx_inst}
$MAKEP ${1:-clean}
}

#
# Configure and build
# $1 - mode (devel|release)
#
build() {
mode=$1
shift

config_args="--prefix=$ucx_inst --without-java"
if [ "X$have_cuda" == "Xyes" ]
then
config_args+=" --with-iodemo-cuda"
fi

../contrib/configure-${mode} ${config_args} "$@"
make_clean
$MAKEP
$MAKEP install
}

#
# Test if an environment module exists and load it if yes.
# Otherwise, return error code.
Expand Down Expand Up @@ -358,23 +332,6 @@ get_non_rdma_ip_addr() {
get_ifaddr ${eth_iface}
}

#
# Prepare build environment
#
prepare() {
echo " ==== Prepare ===="
env
cd ${WORKSPACE}
if [ -d build-test ]
then
chmod u+rwx build-test -R
rm -rf build-test
fi
./autogen.sh
mkdir -p build-test
cd build-test
}

#
# Expands a CPU list such as "0-3,17" to "0 1 2 3 17" (each cpu in a new line)
#
Expand Down Expand Up @@ -421,12 +378,6 @@ run_loopback_app() {
wait ${pid} || true
}

step_server_port() {
# Cycle server_port between (server_port_min)..(server_port_max-1)
server_port=$((server_port + 1))
server_port=$((server_port >= server_port_max ? server_port_min : server_port))
}

run_client_server_app() {
test_exe=$1
test_args=$2
Expand Down
69 changes: 69 additions & 0 deletions contrib/test_namespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash -eEx
#
# Testing script for UCX namespace related functionality
#
# Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2023. ALL RIGHTS RESERVED.
#
# See file LICENSE for terms.
#
#
# Environment variables set by Azure CI:
# - WORKSPACE : path to work dir
#

source $(dirname $0)/../buildlib/tools/common.sh

ucx_inst=${WORKSPACE}/install

echo "==== Running namespace tests on $(hostname) ===="

server_port_range=1000
server_port_min=10500
server_port_max=$((server_port_min + server_port_range))
server_port=${server_port_min}

test_namespace() {
# Make sure to try to use CMA when possible
# Expect fallback on SYSV
perftest="$ucx_inst/bin/ucx_perftest -t ucp_get -s 9999999 -n 5"

echo "==== Running perftest namespace positive tests ===="

for tls in posix cma,sysv
do
echo "==== Running perftest same non-default USER namespace test for $tls ===="

cmd="UCX_TLS=$tls $perftest -p $server_port"
step_server_port
unshare --user bash -c "{ $cmd & sleep 3; $cmd localhost; }"
done

for tl in posix cma
do
echo "==== Running perftest different PID namespace test for $tl ===="

cmd="$perftest -p $server_port"
step_server_port
sudo unshare --pid --fork sudo -u $USER UCX_TLS=$tl,sysv $cmd &
sleep 3
sudo unshare --pid --fork sudo -u $USER UCX_TLS=$tl,sysv $cmd localhost

echo "==== Running perftest different USER namespace test for $tl ===="
cmd="$perftest -p $server_port"
step_server_port
UCX_TLS=$tl,sysv unshare --user $cmd &
sleep 3
UCX_TLS=$tl,sysv unshare --user $cmd localhost
done

echo "==== Running perftest different USER namespace test for posix non proc link ===="
cmd="$perftest -p $server_port"
step_server_port
UCX_TLS="posix" UCX_POSIX_USE_PROC_LINK=n unshare --user $cmd &
sleep 3
UCX_TLS="posix" UCX_POSIX_USE_PROC_LINK=n unshare --user $cmd localhost
}

prepare
build release
test_namespace
7 changes: 6 additions & 1 deletion src/tools/info/sys_info.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2001-2015. ALL RIGHTS RESERVED.
* Copyright (C) Shanghai Zhaoxin Semiconductor Co., Ltd. 2020. ALL RIGHTS RESERVED.
* Copyright (C) Tactical Computing Labs, LLC. 2022. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
Expand Down Expand Up @@ -37,15 +38,19 @@ static const char *cpu_model_names[] = {
[UCS_CPU_MODEL_AMD_GENOA] = "Genoa",
[UCS_CPU_MODEL_ZHAOXIN_ZHANGJIANG] = "Zhangjiang",
[UCS_CPU_MODEL_ZHAOXIN_WUDAOKOU] = "Wudaokou",
[UCS_CPU_MODEL_ZHAOXIN_LUJIAZUI] = "Lujiazui"
[UCS_CPU_MODEL_ZHAOXIN_LUJIAZUI] = "Lujiazui",
[UCS_CPU_MODEL_RV64G] = "RV64G",
};



static const char* cpu_vendor_names[] = {
[UCS_CPU_VENDOR_UNKNOWN] = "unknown",
[UCS_CPU_VENDOR_INTEL] = "Intel",
[UCS_CPU_VENDOR_AMD] = "AMD",
[UCS_CPU_VENDOR_GENERIC_ARM] = "Generic ARM",
[UCS_CPU_VENDOR_GENERIC_PPC] = "Generic PPC",
[UCS_CPU_VENDOR_GENERIC_RV64G] = "Generic RV64G",
[UCS_CPU_VENDOR_FUJITSU_ARM] = "Fujitsu ARM",
[UCS_CPU_VENDOR_ZHAOXIN] = "Zhaoxin"
};
Expand Down
6 changes: 4 additions & 2 deletions src/ucm/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ noinst_HEADERS = \
bistro/bistro.h \
bistro/bistro_x86_64.h \
bistro/bistro_aarch64.h \
bistro/bistro_ppc64.h
bistro/bistro_ppc64.h \
bistro/bistro_rv64.h

libucm_la_SOURCES = \
event/event.c \
Expand All @@ -44,7 +45,8 @@ libucm_la_SOURCES = \
bistro/bistro.c \
bistro/bistro_x86_64.c \
bistro/bistro_aarch64.c \
bistro/bistro_ppc64.c
bistro/bistro_ppc64.c \
bistro/bistro_rv64.c

if HAVE_UCM_PTMALLOC286
libucm_la_CPPFLAGS += \
Expand Down
3 changes: 2 additions & 1 deletion src/ucm/bistro/bistro.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2018. ALL RIGHTS RESERVED.
* Copyright (C) Tactical Computing Labs, LLC. 2022. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
Expand Down Expand Up @@ -119,7 +120,7 @@ ucs_status_t ucm_bistro_apply_patch(void *dst, void *patch, size_t len)
return status;
}

#if defined(__x86_64__) || defined (__aarch64__)
#if defined(__x86_64__) || defined (__aarch64__) || defined (__riscv)
struct ucm_bistro_restore_point {
void *addr; /* address of function to restore */
size_t patch_len; /* patch length */
Expand Down
3 changes: 3 additions & 0 deletions src/ucm/bistro/bistro.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright (c) NVIDIA CORPORATION & AFFILIATES, 2018. ALL RIGHTS RESERVED.
* Copyright (C) Tactical Computing Labs, LLC. 2022. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
Expand All @@ -20,6 +21,8 @@ typedef struct ucm_bistro_restore_point ucm_bistro_restore_point_t;
# include "bistro_aarch64.h"
#elif defined(__x86_64__)
# include "bistro_x86_64.h"
#elif defined(__riscv)
# include "bistro_rv64.h"
#else
# error "Unsupported architecture"
#endif
Expand Down
Loading

0 comments on commit 2f30dcc

Please sign in to comment.