Real time EMC bandwidth with sysfs

Hello,

I am aware that I can read EMC freq from Tegrastats.
But I am seeking the precise ‘sysfs’ to read the existing percentage.
I went through
https://devtalk.nvidia.com/default/topic/1049939/jetson-nano/feature-request-query-like-usage-for-tegrastats-command/post/5328819/#5328819
and tried printing almost everything with cat command.
I am expecting that

sudo cat /sys/kernel/debug/bpmp/debug/clk/emc/rate

should give be current status. But this returns always 2133000000 which equals

sudo cat /sys/kernel/debug/bpmp/debug/clk/emc/max_rate

I am using jetpack 4.2.2 at MaxN mode. jetsonclocks is on.

Is there any way to read present value X from EMC_FREQ X@2133 without using tegrastats utility?
Thanks in advance!

MaxN mode boost the clock to max rate that’s normally.

Hi Shane, Thanks for the input.
I know a certain load at which $sudo tegrastats gives output as EMC_FREQ 29%@2133.
I am trying to get sysfs output something similar.

MaxN mode boosts the clocks, but then, from which source tegrastats is getting that 29% is the real question.

It could be “/sys/kernel/debug/tegra_central_actmon/mc_all/avg_activity”

Thanks again!
But unfortunately avg_activity doesn’t exists.

root@nvidia:~# cat /sys/kernel/debug/tegra_central_actmon/mc_all/avg_activity
cat: /sys/kernel/debug/tegra_central_actmon/mc_all/avg_activity: No such file or directory

root@nvidia:~# cat /sys/kernel/debug/tegra_central_actmon/mc_all/
actv_type           boost_rate_dec      boost_rate_inc      boost_step          boost_threshold_dn  boost_threshold_up  down_wmark          state               up_wmark

I am using Xavier with Jetpack 4.2.2.

The K4.9 could be “/sys/kernel/actmon_avg_activity/mc_all”

Yep! that matches.Thanks a ton!! Need to divide by Y from EMC_FREQ X@2133 to get the percentage number.

Hi again ShaneCCC,

is it possible to create a sustained traffic of data so that I can measure EMC freq for known data load?
For example,
I tried this experiment-

  • Create a buffer of 1 GB in C language.
  • Do memcopies in a loop.
  • Start time and end time of memory transfers is recorded accurate to microseconds.
  • and compare this with percentage shown in tegrastats utility.
    Somehow numbers are not making sense.
    Am I missing some basic concept?
    Thanks in advance.

Hi,

tegrastats EMC bandwidth is calculated based on activity monitor calculation.
Can you share what is the goal of your experiment what you what problem you are observing?
you can use multiple instances of mbw application to load the emc lines
mbw -t0 100 -b 12 -n 10000 &

Thanks for the pointer bbasu,
Aim of my experiment is validate the EMC_Freq% number that is displayed in tegrastats. For that, I need to create some trustworthy data traffic load at EMC.

I tried mbw utility as you suggested.
I am using my xavier in MaxN mode + Jetson_clocks turned on.

AVG MEMCPY number obtained from mbw utility is 7818.160 MiB/s.

while, I ran tegrastats in parallel. The EMC_FREQ number obtained is 26%@2133.
This is equivalent to 2133 x 0.26 x 64/1000 = 35.49 GB/s.

These both numbers don’t match.

Hi BMohit,

emc utilization in tegrastats does not tells about the BW. It talks about the % of activity going on External Memory Controller. So there is no direct correlation between Memory BW and EMC activity.

regards
Bibek

Hi Bibek,
I have been discussing on this topic on forums since many days.
This discussion - https://devtalk.nvidia.com/default/topic/1066512/measuring-ddr-bandwidth-/?offset=6#5401827 even helped me with the formula to convert frequency at EMC into DDR bandwidth.

This website https://developer.ridgerun.com/wiki/index.php?title=Xavier/JetPack_4.1/Performance_Tuning/Evaluating_Performance also says that “EMC_FREQ 17% 17=Percentage of bandwidth used relative to running frequency”.

I am little bit confused with your last reply.

Why DDR Bandwidth can not be related to EMC frequency?
If it is not the EMC frequency, then what is the correct way to measure DDR bandwidth being utilised while running a neural network?

Hi,

Tegrastats just prints the activity rate detected by activity monitor. Its not the accurate depiction of Memory BW.

regards
Bibek