Skip to content

Commit 54b156e

Browse files
committed
Merge origin/main into main
2 parents a46d0d8 + ea4230e commit 54b156e

4 files changed

Lines changed: 176 additions & 0 deletions

File tree

.github/configs/hygon.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Hygon DCU Hardware Configuration
2+
hardware_name: hygon
3+
display_name: Hygon DCU Tests
4+
5+
ci_image: harbor.baai.ac.cn/flagos-dev/flagcx:b079886-hygon-dev
6+
7+
runner_labels:
8+
- hg-8g-cicd-flagcx
9+
10+
container_volumes:
11+
- /usr/local/hyhal:/opt/hyhal:ro
12+
13+
container_options: >-
14+
--ipc=host
15+
--privileged=true
16+
--shm-size=100gb
17+
--ulimit memlock=-1
18+
--ulimit stack=67108864
19+
--device=/dev/kfd
20+
--device=/dev/dri
21+
--group-add video
22+
-e PLATFORM=hygon
23+
-e FLAGCX_ADAPTOR=du
24+
set_env: .github/scripts/set_env/hygon.sh
25+
26+
unit_test_suites:
27+
- adaptor
28+
- core
29+
- p2p
30+
- rma
31+
- runner
32+
- service
33+
- symmem

.github/configs/platforms.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
platforms:
77
cuda:
88
enabled: true
9+
hygon:
10+
enabled: true
911
metax:
1012
enabled: true

.github/scripts/set_env/hygon.sh

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#!/usr/bin/env bash
2+
3+
# Hygon DCU-specific unit-test environment setup.
4+
5+
export CUDA_PATH="${CUDA_PATH:-/opt/dtk/cuda/cuda-12}"
6+
export CUDA_HOME="${CUDA_HOME:-$CUDA_PATH}"
7+
8+
if [[ -f /opt/dtk/env.sh ]]; then
9+
# shellcheck source=/dev/null
10+
source /opt/dtk/env.sh
11+
fi
12+
13+
FLAGCX_CI_MPI_BASE_HOME=${MPI_HOME:-/opt/mpi}
14+
15+
# Use the real OpenMPI launcher if the image provides a wrapper.
16+
if [[ -x "$FLAGCX_CI_MPI_BASE_HOME/bin/mpirun.real" ]]; then
17+
FLAGCX_CI_MPI_HOME=$(mktemp -d)
18+
mkdir -p "$FLAGCX_CI_MPI_HOME/bin"
19+
ln -s "$FLAGCX_CI_MPI_BASE_HOME/bin/mpirun.real" \
20+
"$FLAGCX_CI_MPI_HOME/bin/mpirun"
21+
ln -s "$FLAGCX_CI_MPI_BASE_HOME/include" "$FLAGCX_CI_MPI_HOME/include"
22+
ln -s "$FLAGCX_CI_MPI_BASE_HOME/lib" "$FLAGCX_CI_MPI_HOME/lib"
23+
export MPI_HOME=$FLAGCX_CI_MPI_HOME
24+
else
25+
export MPI_HOME=$FLAGCX_CI_MPI_BASE_HOME
26+
fi
27+
28+
export FLAGCX_ADAPTOR=du
29+
export USE_DU=1
30+
31+
FLAGCX_CI_COMMON_MAKE_ARGS=(
32+
USE_DU=1
33+
DEVICE_HOME="$CUDA_PATH"
34+
CCL_HOME="$CUDA_PATH"
35+
)
36+
37+
# The DU makefile does not currently pull the default device-api backend into
38+
# libflagcx.so by itself, so CI passes it through as an extra source.
39+
FLAGCX_CI_PROJECT_MAKE_ARGS=(
40+
"${FLAGCX_CI_COMMON_MAKE_ARGS[@]}"
41+
PLATFORM_EXTRA_SRCS=flagcx/adaptor/device_api/default_dev_api_backend.cc
42+
)
43+
FLAGCX_CI_TEST_MAKE_ARGS=("${FLAGCX_CI_COMMON_MAKE_ARGS[@]}")
44+
45+
FLAGCX_CI_INTRA_NP=8
46+
FLAGCX_CI_NODE_NP=4
47+
FLAGCX_CI_RUNNER_NP=8
48+
export NP=8
49+
50+
flagcx_ci_configure_suite() {
51+
local suite=$1
52+
53+
case "$suite" in
54+
device_api)
55+
FLAGCX_CI_PROJECT_MAKE_ARGS+=(COMPILE_KERNEL=1)
56+
FLAGCX_CI_TEST_MAKE_ARGS+=(COMPILE_KERNEL=1)
57+
;;
58+
rma)
59+
FLAGCX_CI_TEST_MAKE_ARGS+=(
60+
"HETERO_ENV=-x FLAGCX_USE_HETERO_COMM=1 -x FLAGCX_MEM_ENABLE=1 -x FLAGCX_VMM_ENABLE=0"
61+
)
62+
;;
63+
esac
64+
}
65+
66+
flagcx_ci_prepare() {
67+
local suite=$1
68+
echo "Preparing Hygon DCU environment for unit-test suite: $suite"
69+
command -v mpirun
70+
command -v nvcc
71+
mpirun --version
72+
nvcc --version
73+
hy-smi --showproductname || true
74+
}
75+
76+
flagcx_ci_build_suite_override() {
77+
local suite=$1
78+
local suite_dir=${2:-}
79+
shift 2 || true
80+
local -a args=("$@")
81+
82+
if [[ "$suite" == "device_api" ]]; then
83+
FLAGCX_CI_BUILD_SUITE_OVERRIDE_HANDLED=1
84+
echo "Skipping Hygon device_api build: DU test kernels do not provide all launchers required by the current device_api tests."
85+
return
86+
fi
87+
88+
if [[ "$suite" == "symmem" ]]; then
89+
FLAGCX_CI_BUILD_SUITE_OVERRIDE_HANDLED=1
90+
cmake -S "$PROJECT_ROOT/third-party/googletest" \
91+
-B "$PROJECT_ROOT/third-party/googletest/build"
92+
cmake --build "$PROJECT_ROOT/third-party/googletest/build" --parallel "$(nproc)"
93+
make -C "$suite_dir" --jobs="$(nproc)" "${args[@]}"
94+
return
95+
fi
96+
97+
FLAGCX_CI_BUILD_SUITE_OVERRIDE_HANDLED=0
98+
}
99+
100+
flagcx_ci_run_suite_override() {
101+
local suite=$1
102+
local suite_dir=$2
103+
shift 2
104+
local -a args=("$@")
105+
106+
if [[ "$suite" == "device_api" ]]; then
107+
FLAGCX_CI_RUN_SUITE_OVERRIDE_HANDLED=1
108+
echo "Skipping Hygon device_api tests: DU launcher coverage is incomplete in the current test kernels."
109+
return
110+
fi
111+
112+
if [[ "$suite" == "runner" ]]; then
113+
FLAGCX_CI_RUN_SUITE_OVERRIDE_HANDLED=1
114+
make -C "$suite_dir" run-unit "${args[@]}"
115+
cd "$suite_dir"
116+
mpirun -np "$FLAGCX_CI_RUNNER_NP" --allow-run-as-root \
117+
./build/bin/runner_mpi_tests
118+
echo "Skipping Hygon runner hetero-mode MPI variants: current DU path stalls in the single-node hetero simulation."
119+
return
120+
fi
121+
122+
FLAGCX_CI_RUN_SUITE_OVERRIDE_HANDLED=0
123+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Hygon DCU Unit Tests
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
concurrency:
10+
group: hygon-unit-tests-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
hygon_unit_tests:
15+
name: Hygon DCU unit tests
16+
uses: ./.github/workflows/unit_tests_platform_common.yml
17+
with:
18+
platform: hygon

0 commit comments

Comments
 (0)