diff options
author | Ciro Nishiguchi <ciro.nishiguchi@ni.com> | 2019-11-26 08:32:34 -0600 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-12-06 08:55:19 -0800 |
commit | c8dab1e440ff1a7704594009cc3571108866cb2b (patch) | |
tree | 7ad6cab94322032269884cb0aa1e9e57a4305408 | |
parent | 2bf1f0acaa3595a121d4140d78d50c52b817ce09 (diff) | |
download | uhd-c8dab1e440ff1a7704594009cc3571108866cb2b.tar.gz uhd-c8dab1e440ff1a7704594009cc3571108866cb2b.tar.bz2 uhd-c8dab1e440ff1a7704594009cc3571108866cb2b.zip |
tests: Add tests to exercise max streaming rates and report results
3 files changed, 1008 insertions, 0 deletions
diff --git a/host/tests/streaming_performance/run_E3xx_max_rate_tests.py b/host/tests/streaming_performance/run_E3xx_max_rate_tests.py new file mode 100755 index 000000000..d53f03a46 --- /dev/null +++ b/host/tests/streaming_performance/run_E3xx_max_rate_tests.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 +""" +Copyright 2019 Ettus Research, A National Instrument Brand + +SPDX-License-Identifier: GPL-3.0-or-later + +Runs streaming tests for N3xx at rates in the neighborhoood of the maximum +rate that UHD can sustain. Each test consists of a batch of runs of the +benchmark rate C++ example with different streaming parameters. + +To run all the tests, execute it with all supported options for the test_type +parameter: + E320_XG Runs E320 tests with single and dual 10 GbE links + E120_Liberio Runs E310 tests with Liberio + +Example usage: +run_E3xx_max_rate_tests.py --path <benchmark_rate_dir>/benchmark_rate --addr 192.168.10.2 --second_addr 192.168.20.2 --test_type E320_XG +""" +import argparse +import sys +import time +import datetime +import batch_run_benchmark_rate + +Test_Type_E320_XG = "E320_XG" +Test_Type_E310_Liberio = "E310_Liberio" + +test_type_list = [Test_Type_E320_XG, Test_Type_E310_Liberio] + +def parse_args(): + """ + Parse command line arguments + """ + parser = argparse.ArgumentParser() + parser.add_argument( + "--path", + type=str, + required=True, + help="path to benchmark rate example") + parser.add_argument( + "--test_type", + type=str, + required=True, + choices=test_type_list, + help="path to benchmark rate example") + parser.add_argument( + "--addr", + type=str, + default = "", + help="address of the 10 GbE interface") + args = parser.parse_args() + + return args.path, args.test_type, args.addr + +def run_test(path, params, iterations, label): + """ + Runs benchmark rate for the number of iterations in the command line arguments + """ + print("-----------------------------------------------------------") + print(label + "\n") + results = batch_run_benchmark_rate.run(path, iterations, params, False) + stats = batch_run_benchmark_rate.calculate_stats(results) + print(batch_run_benchmark_rate.get_summary_string(stats)) + +def run_E320_tests_for_single_10G(path, addr, iterations, duration): + """ + Runs tests that are in the neighborhood of max rate for 10 GbE + """ + def base_params(rate): + return { + "args" : "addr={},master_clock_rate={}".format(addr, rate), + "duration" : duration + } + + # Run RX at 61.44 Msps with one channel + rate = "61.44e6" + rx_params = base_params(rate) + rx_params["rx_rate"] = rate + rx_params["rx_channels"] = "0" + run_test(path, rx_params, iterations, "1xRX @{}".format(rate)) + + # Run RX at 61.44 Msps with two channels + rate = "61.44e6" + rx_params = base_params(rate) + rx_params["rx_rate"] = rate + rx_params["rx_channels"] = "0,1" + run_test(path, rx_params, iterations, "2xRX @{}".format(rate)) + + # Run TX at 61.44 Msps with one channel + rate = "61.44e6" + tx_params = base_params(rate) + tx_params["tx_rate"] = rate + tx_params["tx_channels"] = "0" + run_test(path, tx_params, iterations, "1xTX @{}".format(rate)) + + # Run TX at 61.44 Msps with two channels + rate = "61.44e6" + tx_params = base_params(rate) + tx_params["tx_rate"] = rate + tx_params["tx_channels"] = "0,1" + run_test(path, tx_params, iterations, "2xTX @{}".format(rate)) + + # Run TRX at 61.44 Msps with one channels + rate = "61.44e6" + trx_params = base_params(rate) + trx_params["tx_rate"] = rate + trx_params["rx_rate"] = rate + trx_params["tx_channels"] = "0" + trx_params["rx_channels"] = "0" + run_test(path, trx_params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 61.44 Msps with two channels + rate = "61.44e6" + trx_params = base_params(rate) + trx_params["tx_rate"] = rate + trx_params["rx_rate"] = rate + trx_params["tx_channels"] = "0,1" + trx_params["rx_channels"] = "0,1" + run_test(path, trx_params, iterations, "2xTRX @{}".format(rate)) + +def run_E320_tests_for_single_10G_long_duration(path, addr, iterations, duration): + """ + Runs tests that are in the neighborhood of max rate for 10 GbE. Only include + a small subset of tests to run for a longer period. + """ + def base_params(rate): + return { + "args" : "addr={},master_clock_rate={}".format(addr, rate), + "duration" : duration + } + + # Run TRX at 61.44 Msps with two channels + rate = "61.44e6" + trx_params = base_params(rate) + trx_params["tx_rate"] = rate + trx_params["rx_rate"] = rate + trx_params["tx_channels"] = "0,1" + trx_params["rx_channels"] = "0,1" + run_test(path, trx_params, iterations, "2xTRX @{}".format(rate)) + +def main(): + path, test_type, addr = parse_args() + start_time = time.time() + + if test_type == Test_Type_E320_XG: + run_E320_tests_for_single_10G(path, addr, 10, 30) + run_E320_tests_for_single_10G_long_duration(path, addr, 2, 600) + + end_time = time.time() + elapsed = end_time - start_time + print("Elapsed time: {}".format(datetime.timedelta(seconds=elapsed))) + return True + +if __name__ == "__main__": + sys.exit(not main()) diff --git a/host/tests/streaming_performance/run_N3xx_max_rate_tests.py b/host/tests/streaming_performance/run_N3xx_max_rate_tests.py new file mode 100755 index 000000000..62010e3b8 --- /dev/null +++ b/host/tests/streaming_performance/run_N3xx_max_rate_tests.py @@ -0,0 +1,648 @@ +#!/usr/bin/env python3 +""" +Copyright 2019 Ettus Research, A National Instrument Brand + +SPDX-License-Identifier: GPL-3.0-or-later + +Runs streaming tests for N3xx at rates in the neighborhoood of the maximum +rate that UHD can sustain. Each test consists of a batch of runs of the +benchmark rate C++ example with different streaming parameters. + +To run all the tests, execute it with all supported options for the test_type +parameter: + N310_XG Runs N310 tests with single and dual 10 GbE links + N310_Liberio Runs N310 tests with Liberio + +Example usage: +run_N3xx_max_rate_tests.py --path <benchmark_rate_dir>/benchmark_rate --addr 192.168.10.2 --second_addr 192.168.20.2 --test_type N310_XG +""" +import argparse +import sys +import time +import datetime +import batch_run_benchmark_rate + +Test_Type_N310_XG = "N310_XG" +Test_Type_N310_Liberio = "N310_Liberio" + +test_type_list = [Test_Type_N310_XG, Test_Type_N310_Liberio] + +def parse_args(): + """ + Parse command line arguments + """ + parser = argparse.ArgumentParser() + parser.add_argument( + "--path", + type=str, + required=True, + help="path to benchmark rate example") + parser.add_argument( + "--test_type", + type=str, + required=True, + choices=test_type_list, + help="path to benchmark rate example") + parser.add_argument( + "--addr", + type=str, + default = "", + help="address of first 10 GbE interface") + parser.add_argument( + "--second_addr", + type=str, + default = "", + help="address of second 10 GbE interface") + args = parser.parse_args() + + return args.path, args.test_type, args.addr, args.second_addr + +def run_test(path, params, iterations, label): + """ + Runs benchmark rate for the number of iterations in the command line arguments + """ + print("-----------------------------------------------------------") + print(label + "\n") + results = batch_run_benchmark_rate.run(path, iterations, params) + stats = batch_run_benchmark_rate.calculate_stats(results) + print(batch_run_benchmark_rate.get_summary_string(stats, params)) + +def run_N310_tests_for_single_10G(path, addr, iterations, duration): + """ + Runs tests that are in the neighborhood of max rate for 10 GbE + """ + def base_params(rate): + return { + "args" : "addr={},master_clock_rate={}".format(addr, rate), + "duration" : duration + } + + # Run RX at 153.6 Msps with one channel + rate = "153.6e6" + params = base_params(rate) + params["rx_rate"] = rate + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xRX @{}".format(rate)) + + # Run RX at 153.6 Msps with two channels + rate = "153.6e6" + params = base_params(rate) + params["rx_rate"] = rate + params["rx_channels"] = "0,1" + run_test(path, params, iterations, "2xRX @{}".format(rate)) + + # Run TX at 153.6 Msps with one channel + rate = "153.6e6" + params = base_params(rate) + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTX @{}".format(rate)) + + # Run TX at 153.6 Msps with two channels + rate = "153.6e6" + params = base_params(rate) + params["tx_rate"] = rate + params["tx_channels"] = "0,1" + run_test(path, params, iterations, "2xTX @{}".format(rate)) + + # Run TRX at 153.6 Msps with one channel + rate = "153.6e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0" + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 153.6 Msps with two channels + rate = "153.6e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1" + params["rx_channels"] = "0,1" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run TRX at 125 Msps with two channels + rate = "125e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1" + params["rx_channels"] = "0,1" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run RX at 62.5 Msps with four channels + rate = "62.5e6" + params = base_params("125e6") + params["rx_rate"] = rate + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xRX @{}".format(rate)) + + # Run TX at 62.5 Msps with four channels + rate = "62.5e6" + params = base_params("125e6") + params["tx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTX @{}".format(rate)) + + # Run TRX at 62.5 Msps with four channels + rate = "62.5e6" + params = base_params("125e6") + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + +def run_N310_tests_for_single_10G_long_duration(path, addr, iterations, duration): + """ + Runs tests that are in the neighborhood of max rate for 10 GbE. Only include + a small subset of tests to run for a longer period. + """ + def base_params(rate): + return { + "args" : "addr={},master_clock_rate={}".format(addr, rate), + "duration" : duration + } + + rate = "153.6e6" + + # Run TRX at 125 Msps with two channels + rate = "125e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1" + params["rx_channels"] = "0,1" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run TRX at 62.5 Msps with four channels + rate = "62.5e6" + params = base_params("125e6") + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + +def run_N310_tests_for_dual_10G(path, addr, second_addr, iterations, duration): + """ + Runs tests that are in the neighborhood of max rate for dual 10 GbE + """ + def base_params(rate): + return { + "args" : "addr={},second_addr={},master_clock_rate={}".format(addr, second_addr, rate), + "duration" : duration + } + + # Run RX at 153.6 Msps with two channels + rate = "153.6e6" + params = base_params(rate) + params["rx_rate"] = rate + params["rx_channels"] = "0,1" + run_test(path, params, iterations, "2xRX @{}".format(rate)) + + # Run TX at 153.6 Msps with two channels + rate = "153.6e6" + params = base_params(rate) + params["tx_rate"] = rate + params["tx_channels"] = "0,1" + run_test(path, params, iterations, "2xTX @{}".format(rate)) + + # Run TRX at 153.6 Msps with two channels + rate = "153.6e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1" + params["rx_channels"] = "0,1" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run RX at 153.6 Msps with four channels + rate = "153.6e6" + params = base_params(rate) + params["rx_rate"] = rate + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xRX @{}".format(rate)) + + # Run TX at 153.6 Msps with four channels + rate = "153.6e6" + params = base_params(rate) + params["tx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTX @{}".format(rate)) + + # Run TRX at 153.6 Msps with four channels + rate = "153.6e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + + # Run RX at 125 Msps with four channels + rate = "125e6" + params = base_params(rate) + params["rx_rate"] = rate + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xRX @{}".format(rate)) + + # Run TX at 125 Msps with four channels + rate = "125e6" + params = base_params(rate) + params["tx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTX @{}".format(rate)) + + # Run TRX at 125 Msps with four channels + rate = "125e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + +def run_N310_tests_for_dual_10G_long_duration(path, addr, second_addr, iterations, duration): + """ + Runs tests that are in the neighborhood of max rate for dual 10 GbE. Only include + a small subset of tests to run for a longer period. + """ + def base_params(rate): + return { + "args" : "addr={},second_addr={},master_clock_rate={}".format(addr, second_addr, rate), + "duration" : duration + } + + # Run TRX at 122.88 Msps with four channels + rate = "122.88e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + + # Run TRX at 125 Msps with four channels + rate = "125e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + + # Run TRX at 153.6 Msps with four channels + rate = "153.6e6" + params = base_params(rate) + params["tx_rate"] = rate + params["rx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + params["rx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + +def run_N310_tests_for_Liberio_master_next(path, iterations, duration): + """ + Runs tests that are in the neighborhood of max rate for Liberio + """ + def base_params(): + return { + "args" : "master_clock_rate=125e6", + "duration" : duration + } + + # Run RX at 4.032258 Msps with one channel + rate = "4.032258e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xRX @{}".format(rate)) + + # Run RX at 4.464286 Msps with one channel + rate = "4.464286e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xRX @{}".format(rate)) + + # Run RX at 4.807692 Msps with one channel + rate = "4.807692e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xRX @{}".format(rate)) + + # Run RX at 5.208333 Msps with one channel + rate = "5.208333e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xRX @{}".format(rate)) + + # Run TX at 11.363636 Msps with one channel + rate = "11.363636e6" + params = base_params() + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTX @{}".format(rate)) + + # Run TX at 12.5Msps with one channel + rate = "12.5e6" + params = base_params() + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTX @{}".format(rate)) + + # Run TX at 13.888889 Msps with one channel + rate = "13.888889e6" + params = base_params() + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTX @{}".format(rate)) + + # Run TX at 15.625000 Msps with one channel + rate = "15.625000e6" + params = base_params() + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTX @{}".format(rate)) + + # Run TX at 17.857143 Msps with one channel + rate = "17.857143e6" + params = base_params() + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTX @{}".format(rate)) + + # Run TRX at 2.976190 Msps with one channel + rate = "2.976190e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 3.472222 Msps with one channel + rate = "3.472222e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 4.032258 Msps with one channel + rate = "4.032258e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 1.404494 Msps with two channels + rate = "1.404494e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,2" + params["tx_rate"] = rate + params["tx_channels"] = "0,2" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run TRX at 1.760563 Msps with two channels + rate = "1.760563e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,2" + params["tx_rate"] = rate + params["tx_channels"] = "0,2" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run TRX at 2.016129 Msps with two channels + rate = "2.016129e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,2" + params["tx_rate"] = rate + params["tx_channels"] = "0,2" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run 4xTRX at 0.899281 Msps with one channel + rate = "0.899281e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,1,2,3" + params["tx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + + # Run 4xTRX at 1.0 Msps with one channel + rate = "1.0e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,1,2,3" + params["tx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + + # Run 4xTRX at 1.25 Msps with one channel + rate = "1.25e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,1,2,3" + params["tx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + +def run_N310_tests_for_Liberio_315(path, iterations, duration): + """ + Runs tests that are in the neighborhood of max rate for Liberio + """ + def base_params(): + return { + "args" : "master_clock_rate=125e6", + "duration" : duration + } + + # Run RX at 8.928571 Msps with one channel + rate = "8.928571e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xRX @{}".format(rate)) + + # Run RX at 9.615385 Msps with one channel + rate = "9.615385e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xRX @{}".format(rate)) + + # Run RX at 10.416667 Msps with one channel + rate = "10.416667e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xRX @{}".format(rate)) + + # Run RX at 11.363636 Msps with one channel + rate = "11.363636e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + run_test(path, params, iterations, "1xRX @{}".format(rate)) + + # Run TX at 11.363636 Msps with one channel + rate = "11.363636e6" + params = base_params() + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTX @{}".format(rate)) + + # Run TX at 13.888889 Msps with one channel + rate = "13.888889e6" + params = base_params() + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTX @{}".format(rate)) + + # Run TX at 15.625000 Msps with one channel + rate = "15.625000e6" + params = base_params() + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTX @{}".format(rate)) + + # Run TRX at 5.952381 Msps with one channel + rate = "5.952381e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 6.578947 Msps with one channel + rate = "6.578947e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 6.944444 Msps with one channel + rate = "6.944444e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 6.944444 Msps with one channel + rate = "6.944444e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 7.812500 Msps with one channel + rate = "7.812500e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 8.333333 Msps with one channel + rate = "8.333333e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run TRX at 8.928571 Msps with one channel + rate = "8.928571e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0" + params["tx_rate"] = rate + params["tx_channels"] = "0" + run_test(path, params, iterations, "1xTRX @{}".format(rate)) + + # Run 2xTRX at 0.5 Msps with one channel + rate = "0.5e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,2" + params["tx_rate"] = rate + params["tx_channels"] = "0,2" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run 2xTRX at 0.600962 Msps with one channel + rate = "0.600962e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,2" + params["tx_rate"] = rate + params["tx_channels"] = "0,2" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run 2xTRX at 0.702247 Msps with one channel + rate = "0.702247e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,2" + params["tx_rate"] = rate + params["tx_channels"] = "0,2" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run 2xTRX at 0.801282 Msps with one channel + rate = "0.801282e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,2" + params["tx_rate"] = rate + params["tx_channels"] = "0,2" + run_test(path, params, iterations, "2xTRX @{}".format(rate)) + + # Run 4xTRX at 0.244141 Msps with one channel + rate = "0.244141e6" + params = base_params() + params["rx_rate"] = rate + params["rx_channels"] = "0,1,2,3" + params["tx_rate"] = rate + params["tx_channels"] = "0,1,2,3" + run_test(path, params, iterations, "4xTRX @{}".format(rate)) + +def main(): + path, test_type, addr, second_addr = parse_args() + start_time = time.time() + + if test_type == Test_Type_N310_XG: + run_N310_tests_for_single_10G(path, addr, 10, 30) + run_N310_tests_for_dual_10G(path, addr, second_addr, 10, 30) + + run_N310_tests_for_single_10G_long_duration(path, addr, 2, 600) + run_N310_tests_for_dual_10G_long_duration(path, addr, second_addr, 2, 600) + + if test_type == Test_Type_N310_Liberio: + #run_N310_tests_for_Liberio_315(path, 10, 30) + run_N310_tests_for_Liberio_master_next(path, 10, 30) + + end_time = time.time() + elapsed = end_time - start_time + print("Elapsed time: {}".format(datetime.timedelta(seconds=elapsed))) + return True + +if __name__ == "__main__": + sys.exit(not main()) diff --git a/host/tests/streaming_performance/run_X3xx_max_rate_tests.py b/host/tests/streaming_performance/run_X3xx_max_rate_tests.py new file mode 100755 index 000000000..c317ef689 --- /dev/null +++ b/host/tests/streaming_performance/run_X3xx_max_rate_tests.py @@ -0,0 +1,205 @@ +#!/usr/bin/env python3 +""" +Copyright 2019 Ettus Research, A National Instrument Brand + +SPDX-License-Identifier: GPL-3.0-or-later + +Runs streaming tests for X3xx at rates in the neighborhoood of the maximum +rate that UHD can sustain. Each test consists of a batch of runs of the +benchmark rate C++ example with different streaming parameters. + +To run all the tests, execute it with all supported options for the test_type +parameter: + X3xx_XG Runs tests with single and dual 10 GbE links + TwinRX_XG Runs TwinRX tests with single and dual 10 GbE links + +Example usage: +run_X3xx_max_rate_tests.py --path <benchmark_rate_dir>/benchmark_rate --addr 192.168.30.2 --second_addr 192.168.40.2 --test_type X3xx_XG +""" +import argparse +import sys +import time +import datetime +import batch_run_benchmark_rate + +Test_Type_X3xx_XG = "X3xx_XG" +Test_Type_TwinRX_XG = "TwinRX_XG" + +test_type_list = [Test_Type_X3xx_XG, Test_Type_TwinRX_XG] + +def parse_args(): + """ + Parse command line arguments + """ + parser = argparse.ArgumentParser() + parser.add_argument( + "--path", + type=str, + required=True, + help="path to benchmark rate example") + parser.add_argument( + "--test_type", + type=str, + required=True, + choices=test_type_list, + help="path to benchmark rate example") + parser.add_argument( + "--addr", + type=str, + default = "", + help="address of first 10 GbE interface") + parser.add_argument( + "--second_addr", + type=str, + default = "", + help="address of second 10 GbE interface") + args = parser.parse_args() + + return args.path, args.test_type, args.addr, args.second_addr + +def run_test(path, params, iterations, label): + """ + Runs benchmark rate for the number of iterations in the command line arguments. + """ + print("-----------------------------------------------------------") + print(label + "\n") + results = batch_run_benchmark_rate.run(path, iterations, params) + stats = batch_run_benchmark_rate.calculate_stats(results) + print(batch_run_benchmark_rate.get_summary_string(stats)) + +def run_tests_for_single_10G(path, addr, iterations, duration): + base_params = { + "args" : "addr={}".format(addr), + "duration" : duration + } + + rx_params = base_params.copy() + + # Run 200 Msps RX with one channel + rx_params["rx_rate"] = "200e6" + rx_params["rx_channels"] = "0" + run_test(path, rx_params, iterations, "1xRX @200 Msps") + + # Run 100 Msps with two channels + rx_params["rx_rate"] = "100e6" + rx_params["rx_channels"] = "0,1" + run_test(path, rx_params, iterations, "2xRX @100 Msps") + + tx_params = base_params.copy() + + # Run 200 Msps TX with one channel + tx_params["tx_rate"] = "200e6" + tx_params["tx_channels"] = "0" + run_test(path, tx_params, iterations, "1xTX @200 Msps") + + # Run 100 Msps TX with two channels + tx_params["tx_rate"] = "100e6" + tx_params["tx_channels"] = "0,1" + run_test(path, tx_params, iterations, "2xTX @100 Msps") + + trx_params = base_params.copy() + + # Run 200 Msps TRX with one channel + trx_params["tx_rate"] = "200e6" + trx_params["rx_rate"] = "200e6" + trx_params["tx_channels"] = "0" + trx_params["rx_channels"] = "0" + run_test(path, trx_params, iterations, "1xTRX @200Msps") + + # Run 100 Msps TRX with two channels + trx_params["tx_rate"] = "100e6" + trx_params["rx_rate"] = "100e6" + trx_params["tx_channels"] = "0,1" + trx_params["rx_channels"] = "0,1" + run_test(path, trx_params, iterations, "2xTRX @100Msps") + +def run_tests_for_dual_10G(path, addr, second_addr, iterations, duration): + base_params = { + "args" : "addr={},second_addr={},skip_dram=1,enable_tx_dual_eth=1".format(addr, second_addr), + "duration" : duration + } + + rx_params = base_params.copy() + + # Run 200 Msps with two channels + rx_params["rx_rate"] = "200e6" + rx_params["rx_channels"] = "0,1" + run_test(path, rx_params, iterations, "2xRX @200 Msps") + + tx_params = base_params.copy() + + # Run 200 Msps TX with two channels + tx_params["tx_rate"] = "200e6" + tx_params["tx_channels"] = "0,1" + run_test(path, tx_params, iterations, "2xTX @200 Msps") + + trx_params = base_params.copy() + + # Run 100 Msps TRX with two channels + trx_params["tx_rate"] = "200e6" + trx_params["rx_rate"] = "200e6" + trx_params["tx_channels"] = "0,1" + trx_params["rx_channels"] = "0,1" + run_test(path, trx_params, iterations, "2xTRX @200Msps") + +def run_tests_for_single_10G_Twin_RX(path, addr, iterations, duration): + base_params = { + "args" : "addr={}".format(addr), + "duration" : duration + } + + rx_params = base_params.copy() + + # Run 100 Msps with three channels + rx_params["rx_rate"] = "100e6" + rx_params["rx_channels"] = "0,1,2" + run_test(path, rx_params, iterations, "3xRX @100 Msps") + + # Run 50 Msps with four channels + rx_params["rx_rate"] = "50e6" + rx_params["rx_channels"] = "0,1,2,3" + run_test(path, rx_params, iterations, "4xRX @50 Msps") + +def run_tests_for_dual_10G_Twin_RX(path, addr, second_addr, iterations, duration): + base_params = { + "args" : "addr={},second_addr={}".format(addr, second_addr), + "duration" : duration + } + + rx_params = base_params.copy() + + # Run 100 Msps with four channels + rx_params["rx_rate"] = "100e6" + rx_params["rx_channels"] = "0,1,2,3" + run_test(path, rx_params, iterations, "4xRX @100 Msps") + + +def main(): + path, test_type, addr, second_addr = parse_args() + start_time = time.time() + + if test_type == Test_Type_X3xx_XG: + # Run 10 test iterations for 60 seconds each + run_tests_for_single_10G(path, addr, 10, 60) + run_tests_for_dual_10G(path, addr, second_addr, 10, 60) + + # Run 2 test iterations for 600 seconds each + run_tests_for_single_10G(path, addr, 2, 600) + run_tests_for_dual_10G(path, addr, second_addr, 2, 600) + + if test_type == Test_Type_TwinRX_XG: + # Run 10 test iterations for 60 seconds each + run_tests_for_single_10G_Twin_RX(path, addr, 10, 60) + run_tests_for_dual_10G_Twin_RX(path, addr, second_addr, 10, 60) + + # Run 2 test iterations for 600 seconds each + run_tests_for_single_10G_Twin_RX(path, addr, 2, 600) + run_tests_for_dual_10G_Twin_RX(path, addr, second_addr, 2, 600) + + end_time = time.time() + elapsed = end_time - start_time + print("Elapsed time: {}".format(datetime.timedelta(seconds=elapsed))) + return True + +if __name__ == "__main__": + sys.exit(not main()) |