diff --git a/README.md b/README.md index 85fbcb63..5b5e9b51 100755 --- a/README.md +++ b/README.md @@ -178,6 +178,29 @@ $ python3 ./astra-sim-alibabacloud/inputs/topo/gen_Topo_Template.py -topo Spectr $ AS_SEND_LAT=3 AS_NVLS_ENABLE=1 ./bin/SimAI_simulator -t 16 -w ./example/microAllReduce.txt -n ./Spectrum-X_128g_8gps_100Gbps_A100 -c astra-sim-alibabacloud/inputs/config/SimAI.conf ``` +### Run ns-3 module tests + +The `ns-3-alibabacloud` module tests are managed by ns-3's `test.py` / `test-runner`, not by `ctest`. +For the point-to-point module, use the suite name `devices-point-to-point`. + +```bash +# Make sure submodules are initialized +$ git submodule update --init --recursive + +# Run the point-to-point ns-3 module test +$ ./scripts/build.sh -t ns3 devices-point-to-point +``` + +If you run the test from the ns-3 workspace directly, use: + +```bash +$ cd ./ns-3-alibabacloud/simulation +$ ./ns3 configure --enable-tests --disable-examples +$ ./ns3 build +$ ./ns3 run "test-runner --print-test-name-list" +$ python3 ./test.py --no-build -s devices-point-to-point +``` + ## Use Multi-requests Inference Simulation For detailed information, please refer to the [README](./vidur-alibabacloud/README.md) file in the `vidur-alibabacloud` directory. This module leverages AICB to profile the computation time of **inference** workloads. Due to its reliance on specific hardware-accelerated libraries like DeepGEMM and FlashMLA, it is exclusively compatible with NVIDIA GPUs based on the **Hopper (SM90)** and **Blackwell (SM100)** architectures. diff --git a/docs/Tutorial.md b/docs/Tutorial.md index 04d637e3..b7bdab47 100755 --- a/docs/Tutorial.md +++ b/docs/Tutorial.md @@ -247,6 +247,15 @@ python3 ./astra-sim-alibabacloud/inputs/topo/gen_Topo_Template.py -g 32 -bw 200G $ AS_SEND_LAT=3 AS_NVLS_ENABLE=1 ./bin/SimAI_simulator -t 16 -w ./example/microAllReduce.txt -n ./Spectrum-X_8g_8gps_400Gbps_H100 -c astra-sim-alibabacloud/inputs/config/SimAI.conf ``` +### Run ns-3 module tests + +`ns-3-alibabacloud` module tests use ns-3's `test.py` / `test-runner`. +For the point-to-point test, the suite name is `devices-point-to-point`. + +```bash +$ ./scripts/build.sh -t ns3 devices-point-to-point +``` + | Environment Variable Name | Description | Default Value | |---------------------------|----------------------------------|-------------------------------------------| | `AS_LOG_LEVEL` | Log level | `DEBUG`, `INFO`, `WARNING`, `ERROR`, `UNKNOWN`; default is `INFO` | diff --git a/scripts/build.sh b/scripts/build.sh index 702f246a..bf0e3310 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -46,6 +46,41 @@ function compile { esac } +function run_test { + local option="$1" + local suite="$2" + local available_suites + case "$option" in + "ns3") + if [ ! -d "${NS3_DIR:?}/simulation" ]; then + printf -- "ns-3-alibabacloud submodule is not initialized. Run: git submodule update --init --recursive\n" + return 1 + fi + if [ -z "${suite}" ]; then + printf -- "missing ns-3 test suite name\n" + printf -- "example: ./scripts/build.sh -t ns3 devices-point-to-point\n" + return 1 + fi + if [ "${suite}" = "point-to-point" ]; then + printf -- "point-to-point module tests use the ns-3 suite name 'devices-point-to-point'.\n" + fi + cd "${NS3_DIR:?}"/simulation || return 1 + ./ns3 configure --enable-tests --disable-examples || return 1 + ./ns3 build || return 1 + available_suites=$(./ns3 run "test-runner --print-test-name-list") || return 1 + if ! printf -- "%s\n" "${available_suites}" | grep -Fx -- "${suite}" >/dev/null; then + printf -- "Unknown ns-3 test suite: %s\n" "${suite}" + if [ "${suite}" = "point-to-point" ]; then + printf -- "Use 'devices-point-to-point' for point-to-point module tests.\n" + fi + printf -- "Use './ns3 run \"test-runner --print-test-name-list\"' to list available suites.\n" + return 1 + fi + python3 ./test.py --no-build -s "${suite}" || return 1 + ;; + esac +} + function cleanup_build { local option="$1" case "$option" in @@ -77,9 +112,12 @@ case "$1" in cleanup_build "$2";; -c|--compile) compile "$2";; +-t|--test) + run_test "$2" "$3";; -h|--help|*) printf -- "help message\n" printf -- "-c|--compile mode supported ns3/phy/analytical (example:./build.sh -c ns3)\n" printf -- "-l|--clean (example:./build.sh -l ns3)\n" + printf -- "-t|--test mode supported ns3 with suite name (example:./build.sh -t ns3 devices-point-to-point)\n" printf -- "-lr|--clean-result mode (example:./build.sh -lr ns3)\n" -esac \ No newline at end of file +esac