Thx, Marcus On Mon, Apr 28, 2025 at 3:50 AM Marcus D. Leech <patchvonbr...@gmail.com> wrote:
> On 27/04/2025 20:40, Nikos Balkanas wrote: > > Ubuntu packages... > No -dev, => no includes:( > The ICMP test is fine for testing physical wear (line, connectors OSI > layer 2) > Ofc a dedicated usrp benchmark is better for application (layer 4) > benchmark:) > > PS. If this conversation is getting long, we can switch to private mail... > > Try libuhd-dev > Yup that did it. Iwas trying libuhd4.6.0-dev and failed:( > > Also: > > dpkg -S /usr/lib/uhd/examples/benchmark_rate > uhd-host: /usr/lib/uhd/examples/benchmark_rate > No need. Actually with libuhd-dev all were installed under /usr/libexec/uhd/examples: -> ls /usr/libexec/uhd/examples benchmark_rate rx_multi_samples test_pps_input gpio rx_samples_c test_timed_commands latency_test rx_samples_to_file twinrx_freq_hopping network_relay rx_samples_to_udp tx_bursts python rx_timed_samples txrx_loopback_to_file rfnoc_nullsource_ce_rx spi tx_samples_c rfnoc_radio_loopback sync_to_gps tx_samples_from_file rfnoc_replay_samples_from_file test_clock_synch tx_timed_samples rfnoc_rx_to_file test_dboard_coercion tx_waveforms rx_ascii_art_dft test_messages usrp_list_sensors Now for the receive benchmark: -> benchmark_rate --args="type=x300,address=192.168.40.2"--rx_rate=2e6 [INFO] [UHD] linux; GNU C++ version 13.2.0; Boost_108300; UHD_4.6.0.0+ds1-5.1ubuntu0.24.04.1 [00:00:00.000487] Creating the usrp device with: type=x300,address=192.168.40.2... [INFO] [X300] X300 initialization sequence... [INFO] [X300] Maximum frame size: 8000 bytes. [INFO] [X300] Radio 1x clock: 200 MHz Using Device: Single USRP: Device: X-Series Device Mboard 0: X300 RX Channel: 0 RX DSP: 0 RX Dboard: A RX Subdev: SBX-120 RX RX Channel: 1 RX DSP: 1 RX Dboard: B RX Subdev: SBX-120 RX TX Channel: 0 TX DSP: 0 TX Dboard: A TX Subdev: SBX-120 TX TX Channel: 1 TX DSP: 1 TX Dboard: B TX Subdev: SBX-120 TX [00:00:02.20406867] Setting device timestamp to 0... [00:00:02.24011764] Testing receive rate 2.000000 Msps on 1 channels [00:00:12.25522915] Benchmark complete. Benchmark rate summary: Num received samples: 20,000,095 Num dropped samples: 0 Num overruns detected: 0 Num transmitted samples: 0 Num sequence errors (Tx): 0 Num sequence errors (Rx): 0 Num underruns detected: 0 Num late commands: 0 Num timeouts (Tx): 0 Num timeouts (Rx): 0 That's 2e6 sps. that's a far cry from the 1996 maxsps I'm getting from uhd_rx_streamer_max_num_samps(rx_streamer[0], &maxsamps) Are these samples same? Seems the problem to be in uhd_init() after all:( What do you think? TIA Nikos > > On Mon, Apr 28, 2025 at 2:45 AM Marcus D. Leech <patchvonbr...@gmail.com> > wrote: > >> On 27/04/2025 19:34, Nikos Balkanas wrote: >> >> For that i will need the sources. >> Do you know where can I download the UHD 4.6.0 sources? >> >> TIA >> Nikos >> >> If you have an installed version of UHD on your system, then the examples >> should also have been installed. How did you install >> UHD? >> >> You might need to install "uhd-host" if you installed from packaged >> binaries, but all the examples and utilities should be >> there along with the libraries. >> >> But the GIT repo for the UHD source is here: >> >> https://github.com/EttusResearch/uhd >> >> These days, most distros package UHD, so in many cases you don't need to >> build from source. >> >> >> >> >> On Mon, Apr 28, 2025 at 12:39 AM Marcus D. Leech <patchvonbr...@gmail.com> >> wrote: >> >>> On 27/04/2025 17:37, Nikos Balkanas wrote: >>> >>> Hi Marcus, >>> >>> You were right. No need to change NIC:) >>> This is not a software issue. uhd_rx_streamer_max_num_samps runs right >>> after uhd initialization before >>> any other code had the chance to run. >>> Link capacity doesn't seem to be the issue either... >>> Running pchar on the link, descendant of pathchar, reports a throughput >>> of 5.619 Kb/s requesting ICMP replies, >>> to varying packet sizes (32->9000 (MTU), incr by 32). >>> sudo pchar -m 9000 -p ipv4icmp usrp >>> https://www.kitchenlab.org/www/bmah/Software/pchar/ >>> >>> It corresponds to 351.218.019 16-bit samples or 175,609.044 32-bit >>> samples, if each sample is 32-bit(real + imag) >>> Seems that uhd is not running at link capacity but is doing smt else. >>> I will have to download and check with the sources... >>> The package version for Ubuntu 24.04 is uhd 4.6.0. >>> Where can I download the sources for uhd 4.6.0? >>> >>> BR >>> Nikos >>> >>> YOu CANNOT use ICMP tests to determine link capacity with a USRP -- ICMP >>> is processed via completely different >>> "stack" in the radio. >>> >>> Use "benchmark_rate" instead. >>> >>> >>> >>> On Sat, Apr 26, 2025 at 7:02 AM Nikos Balkanas <nbalka...@gmail.com> >>> wrote: >>> >>>> Thanks for your time. >>>> I will check out the example. >>>> This is not a buffer problem. I just need 1024 Samples (real+imaginary) >>>> for FFT... >>>> I should be able to get them in a single pass. >>>> You saw my code, not a smoking gun there. >>>> >>>> This is probably is a physical problem. >>>> Cable is an SFP fiber dedicated line. Cannot go bad. >>>> Maybe the connections are not sitting right :(... >>>> >>>> BR >>>> Nikos >>>> >>>> On Sat, Apr 26, 2025 at 6:45 AM Marcus D. Leech < >>>> patchvonbr...@gmail.com> wrote: >>>> >>>>> On 25/04/2025 23:33, Nikos Balkanas wrote: >>>>> >>>>> Actually MTU is 9000. This is one of the recommendations... >>>>> I tried it with MTU 1500. It was worse:( >>>>> maxsamples dropped to 364... >>>>> >>>>> Right, 9000, rather than 8000. >>>>> >>>>> Upgrading to 10Gbit wont' give you larger MTU. >>>>> >>>>> What you're trying to do, I think, is to solve a buffer-management >>>>> problem in your *application* at entirely the wrong >>>>> level in the stack. >>>>> >>>>> It is EXCEEDINGLY COMMON for hardware drivers to only be able to >>>>> deliver in chunks that may not be perfectly adapted to >>>>> the requirements of your application. So, a common programming >>>>> pattern is to deal with this in your application. >>>>> >>>>> You should probably look at example code like rx_samples_to_file >>>>> >>>>> >>>>> >>>>> [INFO] [UHD] linux; GNU C++ version 13.2.0; Boost_108300; >>>>> UHD_4.6.0.0+ds1-5.1ubuntu0.24.04.1 >>>>> [INFO] [X300] X300 initialization sequence... >>>>> [INFO] [X300] Maximum frame size: 1472 bytes. >>>>> [WARNING] [X300] For the 192.168.40.2 connection, UHD recommends a >>>>> send frame size of at least 8000 for best >>>>> performance, but your configuration will only allow 1472.This may >>>>> negatively impact your maximum achievable sample rate. >>>>> Check the MTU on the interface and/or the send_frame_size argument. >>>>> [WARNING] [X300] For the 192.168.40.2 connection, UHD recommends a >>>>> receive frame size of at least 8000 for best >>>>> performance, but your configuration will only allow 1472.This may >>>>> negatively impact your maximum achievable sample rate. >>>>> Check the MTU on the interface and/or the recv_frame_size argument. >>>>> [INFO] [GPS] No GPSDO found >>>>> [INFO] [X300] Radio 1x clock: 200 MHz >>>>> [WARNING] [UDP] The send buffer could not be resized sufficiently. >>>>> Target sock buff size: 24912805 bytes. >>>>> Actual sock buff size: 1048576 bytes. >>>>> See the transport application notes on buffer resizing. >>>>> Please run: sudo sysctl -w net.core.wmem_max=24912805 >>>>> Sat Apr 26 06:30:34 2025 [00] [+] Created USRP with args >>>>> Sat Apr 26 06:30:34 2025 [00] [+] Master clock is at 200 Mhz >>>>> Sat Apr 26 06:30:34 2025 [00] [+] Tuner[0] gain set to 30 (30) dB >>>>> [WARNING] [UDP] The send buffer could not be resized sufficiently. >>>>> Target sock buff size: 24912805 bytes. >>>>> Actual sock buff size: 1048576 bytes. >>>>> See the transport application notes on buffer resizing. >>>>> Please run: sudo sysctl -w net.core.wmem_max=24912805 >>>>> Sat Apr 26 06:30:34 2025 [00] [*] scanner.l:1446:main Incorrect >>>>> maxsamples (364). Expected 19960. >>>>> Sat Apr 26 06:30:34 2025 [00] [+] Max samples/buffer[0]: 364 >>>>> [WARNING] [0/Radio#0] Ignoring stream command for finite acquisition >>>>> of zero sam >>>>> >>>>> Nikos >>>>> >>>>> On Sat, Apr 26, 2025 at 5:46 AM Marcus D. Leech < >>>>> patchvonbr...@gmail.com> wrote: >>>>> >>>>>> On 25/04/2025 22:26, Nikos Balkanas wrote: >>>>>> >>>>>> Thanks Marcus, >>>>>> >>>>>> for your fast reply. >>>>>> >>>>>> On Sat, Apr 26, 2025 at 4:08 AM Marcus D. Leech < >>>>>> patchvonbr...@gmail.com> wrote: >>>>>> >>>>>>> On 25/04/2025 20:50, Nikos Balkanas wrote: >>>>>>> >>>>>>> Hello, >>>>>>> >>>>>>> I need to buy a new NIC. What would you suggest? >>>>>>> The one I use is an old Mellanox 10 Gbs, before the Connect-4 series. >>>>>>> It can only do 1996 S/s, need 19960 (10x more) to work with latest >>>>>>> uhd. >>>>>>> Using Ubuntu 24.04 and uhd 4.6.0 >>>>>>> >>>>>>> So, 1.996ksps vs 19.960ksps? You hardly need a 10Gbit link to >>>>>>> support that. So, perhaps something >>>>>>> is being lost here in your requirements? >>>>>>> >>>>>> >>>>>> True. Can't explain it in terms of bandwidth. 16 * 1996 = 31.936 >>>>>> Kbps, 16 * 19960 = 319.360 Kbps well short of a 10 Gbps line:( >>>>>> Does a complex pair count as 1 sample, or 2? >>>>>> I have followed all the instructions in >>>>>> https://kb.ettus.com/USRP_Host_Performance_Tuning_Tips_and_Tricks, >>>>>> Even installed the DPDK drivers. My Mellanox is too old to use their >>>>>> OFED drivers:( >>>>>> >>>>>>> >>>>>>> On a related question. it seems that the streamer doesn't crash >>>>>>> anymore >>>>>>> when receiving less than MAXSPS samples, instead it reads 0:( >>>>>>> This was due to the sse2 code not aligned in convert. >>>>>>> I change my stream args to cpu_format=sc16, otw=sc16, so no >>>>>>> conversion required. >>>>>>> Streamer still doesn't read anything. Is there a reason for it? >>>>>>> >>>>>>> You'd need to share more of your code. This should just work as far >>>>>>> as I can tell. >>>>>>> >>>>>>> Thanks. these are just the usrp code: >>>>>> >>>>>> int main() >>>>>> { >>>>>> uhd_stream_args_t stream_args = >>>>>> { >>>>>> >>>>>> .cpu_format = "sc16", >>>>>> >>>>>> .otw_format = "sc16", >>>>>> .args = >>>>>> "", >>>>>> >>>>>> .n_channels = 1, >>>>>> >>>>>> .channel_list = &channel >>>>>> }; >>>>>> ..uhd_stream_cmd_t stream_cmd = >>>>>> { >>>>>> >>>>>> .stream_mode = UHD_STREAM_MODE_NUM_SAMPS_AND_DONE, >>>>>> >>>>>> .stream_now = true >>>>>> }; >>>>>> >>>>>> if (uhd_init(0, 0, gain)) do_exit(20); >>>>>>> if ((err = uhd_usrp_get_rx_stream(dev[0], &stream_args, >>>>>>> rx_streamer[0]))) >>>>>>> { >>>>>>> uhd_get_last_error(errmsg, 127); >>>>>>> error(log, "Failed to get streamer[0] (%d). %s.\n", 0, FL, >>>>>>> LN, FN, err, errmsg); >>>>>>> uhd_rx_streamer_free(&rx_streamer[0]); >>>>>>> rx_streamer[0] = NULL; >>>>>>> uhd_rx_metadata_free(&md[0]); >>>>>>> md[0] = NULL; >>>>>>> do_exit(30); >>>>>>> } >>>>>>> if ((err = uhd_rx_streamer_max_num_samps(rx_streamer[0], >>>>>>> &maxsamps))) >>>>>>> >>>>>> { >>>>>>> uhd_get_last_error(errmsg, 127); >>>>>>> error(log, "Failed to get max samples/buffer[0] (%d). >>>>>>> %s.\n", 0, FL, LN, FN, err, >>>>>>> ..errmsg); >>>>>>> do_exit(35); >>>>>>> } >>>>>>> if (maxsamps != MAXSMPS) >>>>>>> warn(log, "Incorrect maxsamples (%ld). Expected %d.\n", 0, >>>>>>> FL, LN, FN, maxsamps, >>>>>>> MAXSMPS); >>>>>>> info(log, "Max samples/buffer[0]: %ld\n", 0, maxsamps); >>>>>>> >>>>>>> if ((err = uhd_rx_streamer_issue_stream_cmd(rx_streamer[0], >>>>>>> &stream_cmd))) >>>>>>> >>>>>> { >>>>>>> uhd_get_last_error(errmsg, 127); >>>>>>> error(log, "Failed to start streamer[0] (%d). %s.\n", 0, >>>>>>> FL, LN, FN, err, errmsg); >>>>>>> do_exit(40); >>>>>>> } >>>>>>> >>>>>> [...] >>>>>> do_exit(0) >>>>>> } >>>>>> >>>>>> >>>>>>> bool uhd_init(size_t channel, double srate, double gain) >>>>>>> { >>>>>>> double tmp; >>>>>>> uhd_rx_metadata_error_code_t err; >>>>>>> >>>>>>> if ((err = >>>>>>> uhd_set_thread_priority(uhd_default_thread_priority, true))) >>>>>>> warn(log, "Unable to set main thread priority (%d). >>>>>>> %s.\n", 0, FL, LN, FN, >>>>>>> err, uhdError(err)); >>>>>>> /* Create USRP */ >>>>>>> f ((err = uhd_usrp_make(&dev[channel], "type=x300"))) >>>>>>> { >>>>>>> error(log, "Failed to create USRP (%d). %s.\n", 0, FL, >>>>>>> LN, FN, err, >>>>>>> uhdError(err)); >>>>>>> dev[channel] = NULL; >>>>>>> return(FAIL); >>>>>>> >>>>>> } >>>>>>> info(stderr, "Created USRP with args\n", 0); >>>>>>> >>>>>>> /* Create RX streamer */ >>>>>>> if ((err = uhd_rx_streamer_make(&rx_streamer[channel]))) >>>>>>> { >>>>>>> error(log, "Failed to create rx_streamer[%d] (%d). %s.\n", >>>>>>> 0, FL, LN, FN, >>>>>>> channel, err, uhdError(err)); >>>>>>> return(FAIL); >>>>>>> } >>>>>>> /* Create RX metadata */ >>>>>>> if ((err = uhd_rx_metadata_make(&md[channel]))) >>>>>>> { >>>>>>> error(log, "Failed to create md[%d] (%d). %s.\n", 0, FL, LN, >>>>>>> FN, channel, >>>>>>> err, uhdError(err)); >>>>>>> return(FAIL); >>>>>>> } >>>>>>> >>>>>>> /* Get master clock rate */ >>>>>>> if ((err = uhd_usrp_get_master_clock_rate(dev[channel], 0, >>>>>>> &tmp))) >>>>>>> >>>>>> { >>>>>>> error(log, "Failed to set master clock to %.0lf Mhz >>>>>>> (%d). %s.\n", 0, FL, >>>>>>> LN, FN, tmp/1000000, err, uhdError(err)); >>>>>>> return(FAIL); >>>>>>> } >>>>>>> info(stderr, "Master clock is at %.0lf Mhz\n", 0, >>>>>>> tmp/1000000); >>>>>>> /* Set the sample rate */ >>>>>>> if (srate && !uhd_set_rx_rate_check(channel, srate)) >>>>>>> return(FAIL); >>>>>>> /* Set the tuner gain SBX-120 is 0-31.5 in .5 db steps */ >>>>>>> >>>>>> if ((err = uhd_usrp_set_rx_gain(dev[channel], gain, channel, >>>>>>> ""))) >>>>>>> { >>>>>>> error(log, "Failed to set tuner[%d] gain to %.0lf db >>>>>>> (%d). %s.\n", 0, FL, >>>>>>> LN, FN, channel, gain, err, uhdError(err)); >>>>>>> return(FAIL); >>>>>>> } >>>>>>> if (!(err = uhd_usrp_get_rx_gain(dev[channel], channel, >>>>>>> "", &tmp))) >>>>>>> info(log, "Tuner[%d] gain set to %.0lf (%.0lf) dB\n", >>>>>>> 0, channel, tmp, gain); >>>>>>> >>>>>> ./* Set channel bw to conserve tuner resources. Not needed, >>>>>> set by srate */ >>>>>> uhd_usrp_set_rx_bandwidth(dev[channel], srate, channel); >>>>>> ./* Disable subtracting constant averaged background. >>>>>> Signal looks cleaner */ >>>>>> if ((err = >>>>>> uhd_usrp_set_rx_dc_offset_enabled(dev[channel], false, channel))) >>>>>> { >>>>>> warn(log, "Failed to disable FPGA DC offset on >>>>>> channel %d(%d). %s.\n", 0, >>>>>> FL, LN, FN, channel, err, uhdError(err)); >>>>>> } >>>>>> info(stderr, "Disabled FPGA DC offset on channel >>>>>> %d\n", 0, channel); >>>>>> return(SUCCESS); >>>>>> } >>>>>> >>>>>> This is the generated output: >>>>>> >>>>>> [INFO] [UHD] linux; GNU C++ version 13.2.0; Boost_108300; >>>>>> UHD_4.6.0.0+ds1-5.1ubuntu0.24.04.1 >>>>>> [INFO] [X300] X300 initialization sequence... >>>>>> [INFO] [X300] Maximum frame size: 8000 bytes. >>>>>> [INFO] [X300] Radio 1x clock: 200 MHz >>>>>> Sat Apr 26 03:33:48 2025 [00] [+] Created USRP with args >>>>>> Sat Apr 26 03:33:48 2025 [00] [+] Master clock is at 200 Mhz >>>>>> Sat Apr 26 03:33:48 2025 [00] [+] Tuner[0] gain set to 30 (30) dB >>>>>> Sat Apr 26 03:33:48 2025 [00] [*] scanner.l:1446:main Incorrect >>>>>> maxsamples (1996). Expected 19960. >>>>>> Sat Apr 26 03:33:48 2025 [00] [+] Max samples/buffer[0]: 1996 >>>>>> [WARNING] [0/Radio#0] Ignoring stream command for finite acquisition >>>>>> of zero samples >>>>>> I hope this reads OK. Maybe next time I should attach the code:) >>>>>> >>>>>>> TIA >>>>>>> Nikos >>>>>>> >>>>>>> _______________________________________________ >>>>>>> USRP-users mailing list -- usrp-users@lists.ettus.com >>>>>>> To unsubscribe send an email to usrp-users-le...@lists.ettus.com >>>>>>> >>>>>>> >>>>>>> I believe that max number of samples-per-buffer is limited by MTU >>>>>> size. Which is typically around 8000 or so for "jumbo frames". >>>>>> >>>>>> >>>>>> >>>>> >>> >> >
_______________________________________________ USRP-users mailing list -- usrp-users@lists.ettus.com To unsubscribe send an email to usrp-users-le...@lists.ettus.com