Skip to content

Commit 22a458e

Browse files
马函廷马函廷
authored andcommitted
test: allow skipping device API put value
1 parent 9b73562 commit 22a458e

3 files changed

Lines changed: 27 additions & 10 deletions

File tree

.github/scripts/ci/run_unit_test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ build_suite() {
6262

6363
run_device_api() {
6464
local suite_dir="$PROJECT_ROOT/test/unittest/device_api"
65+
declare -p FLAGCX_CI_MPI_ENV_ARGS >/dev/null 2>&1 || FLAGCX_CI_MPI_ENV_ARGS=()
6566
local -a common_env=(
6667
-x FLAGCX_USE_HETERO_COMM=1
6768
-x FLAGCX_MEM_ENABLE=1
6869
-x FLAGCX_VMM_ENABLE=0
6970
-x FLAGCX_P2P_DISABLE=1
7071
-x LD_LIBRARY_PATH
72+
"${FLAGCX_CI_MPI_ENV_ARGS[@]}"
7173
)
7274
local -a flags=(-b 1M -e 4M -f 2 -R 2)
7375

.github/scripts/set_env/cuda.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ FLAGCX_CI_TEST_MAKE_ARGS=(USE_NVIDIA=1)
2525
FLAGCX_CI_INTRA_NP=8
2626
FLAGCX_CI_NODE_NP=4
2727
FLAGCX_CI_RUNNER_NP=8
28+
FLAGCX_CI_MPI_ENV_ARGS=()
2829
export NP=8
2930

3031
# Two logical four-GPU nodes on the eight-GPU CUDA runner.
@@ -48,6 +49,8 @@ flagcx_ci_configure_suite() {
4849
device_api)
4950
FLAGCX_CI_PROJECT_MAKE_ARGS+=(COMPILE_KERNEL=1 FORCE_DEFAULT_PATH=1)
5051
FLAGCX_CI_TEST_MAKE_ARGS+=(FORCE_DEFAULT_PATH=1)
52+
export FLAGCX_SKIP_PUT_VALUE=1
53+
FLAGCX_CI_MPI_ENV_ARGS+=(-x FLAGCX_SKIP_PUT_VALUE)
5154
;;
5255
esac
5356
}

test/unittest/device_api/test_device_api.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "tools.h"
3030

3131
#include <algorithm>
32+
#include <cstdlib>
3233
#include <cstdio>
3334
#include <cstring>
3435
#include <unistd.h>
@@ -117,6 +118,10 @@ int main(int argc, char *argv[]) {
117118
int numWarmupIters = args.getWarmupIters();
118119
int localRegister = args.getLocalRegister();
119120
uint64_t splitMask = args.getSplitMask();
121+
const bool skipPutValue = [] {
122+
const char *value = std::getenv("FLAGCX_SKIP_PUT_VALUE");
123+
return value != nullptr && value[0] != '\0' && value[0] != '0';
124+
}();
120125

121126
if (stepFactor <= 1) {
122127
printf("Error: stepFactor must be > 1, got %d\n", stepFactor);
@@ -276,16 +281,23 @@ int main(int argc, char *argv[]) {
276281
MPI_Barrier(MPI_COMM_WORLD);
277282

278283
// --- K3: PutValue ---
279-
FLAGCXCHECK(devHandle->deviceMemset((char *)recvBuff + putValBase, 0,
280-
(size_t)totalProcs * sizeof(uint64_t),
281-
flagcxMemDevice, NULL));
282-
FLAGCXCHECK(flagcxInterTestPutValue(recvMem, devComm, stream, putValBase));
283-
FLAGCXCHECK(devHandle->streamSynchronize(stream));
284-
FLAGCXCHECK(devHandle->deviceMemcpy(
285-
(char *)hostBuff + putValBase, (char *)recvBuff + putValBase,
286-
(size_t)totalProcs * sizeof(uint64_t), flagcxMemcpyDeviceToHost, NULL));
287-
bool k3Ok = verifyPutValue(hostBuff, putValBase, totalProcs, proc);
288-
printResult("K3 PutValue", k3Ok, proc);
284+
if (skipPutValue) {
285+
if (proc == 0 && color == 0)
286+
printf(" %-30s SKIPPED\n", "K3 PutValue");
287+
} else {
288+
FLAGCXCHECK(devHandle->deviceMemset(
289+
(char *)recvBuff + putValBase, 0,
290+
(size_t)totalProcs * sizeof(uint64_t), flagcxMemDevice, NULL));
291+
FLAGCXCHECK(
292+
flagcxInterTestPutValue(recvMem, devComm, stream, putValBase));
293+
FLAGCXCHECK(devHandle->streamSynchronize(stream));
294+
FLAGCXCHECK(devHandle->deviceMemcpy(
295+
(char *)hostBuff + putValBase, (char *)recvBuff + putValBase,
296+
(size_t)totalProcs * sizeof(uint64_t), flagcxMemcpyDeviceToHost,
297+
NULL));
298+
bool k3Ok = verifyPutValue(hostBuff, putValBase, totalProcs, proc);
299+
printResult("K3 PutValue", k3Ok, proc);
300+
}
289301
MPI_Barrier(MPI_COMM_WORLD);
290302

291303
// --- K4: Get ---

0 commit comments

Comments
 (0)