Author Archives: Yuriy Nazarov

Yuriy Nazarov

Love machine learning

RTX 3090 vs A100 tensorflow performance

When I searched how to estimate GPU performance I found this answer on stackoverflow, which contains the following code:

After Nvidia released a bunch of new generation GPUs I wanted to compare their performance.
To measure fp16 performance dtype was changed to tf.float16.
To benchmark matrix multiplication in tensorflow 2 compatibility mode was used. It can be enabled by replacing

with

So final results for tensorflow 2.4.0 are in table:

GPUfp32 performancefp16 performance
RTX 208010877.23 G ops/sec42471.64 G ops/sec
V10014743.50 G ops/sec89348.57 G ops/sec
RTX 309035958.73 G ops/sec69669.73 G ops/sec
A10079158.13 G ops/sec232681.81 G ops/sec
RTX 409080802.89 G ops/sec162852.21 G ops/sec

How to disable NVIDIA card in X server

I actively using CUDA capable cards from NVIDIA for machine learning applications.
When GPU is under heavy load by ml tasks it’s almost impossible to do anything in graphical interface because screen refreshes too slow.
So I switched to integrated video controller. It’s not solved the issue with low refresh rate right away because X server still using NVIDIA card.
After some trials and errors I found a quick and dirty solution: disable graphics card driver during boot to prevent X server to use a card.
To accomplish this you need to blacklist driver by adding a following line:

to /etc/modprobe.d/blacklist.conf
And don’t forget to update initramfs:

After system boot you can load driver manually by following command:

Wireless Arduino thermometer with data logger

There is a bunch of stuff in my closet, so it requires only time and appropriate mood to build some hardware device. And there is a summer around and weather is rather hot, so it’s not a surprising idea to build a thermometer.
DS1820 is a great thermometer and I started with it, but I have a spare HDPM01 barometer module with built-in thermometer, so let’s use it.
rfm-hdpm01-pinout read more »

Nice birthday gift

It’s well known that I’m a Lego fan. So I’m very happy to add such a beautiful plane to my Lego collection.
20160710_165657
Read more to see functions animation. read more »

Space efficient source code storage

kernel-zip-src

During implementation of DistTest I faced with necessity of building a lot of different linux kernel versions. As a first solution I chose downloading archives from kernel.org for each used version. But I soon realized that about 1000 versions of sources with size 0.5-1GB each would consume a lot of disk space. It’s also impossible to build kernel with exact commit precision using this approach.
Set of base versions with corresponding patches can save disk space, but uses a lot of random I/O during applying patches, so it’s slow on HDD and consume finite rewrite resource of SSD. Temporary nature of sources leads to conclusion “use tmpfs”. But aufs offers much less RAM consuming method – store in RAM only diffs.

read more »

Single threaded performance got stuck

I fell in love with md5 hash algorithm because it can detect some very interesting characteristics of system which I want to benchmark. Almost all computations which need to be performed during computation of md5 hash sum are lying in critical path. It means that it’s almost impossible to parallelize md5 hash sum computation. And I’m not talking about execution in multiple threads, but about instruction level parallelization(superscalar and vector computing). So this feature excluding any new modern tricks used in CPU cores(like out-of-order execution and specialized instruction sets) out of equation and makes it perfect single thread benchmark.
Let’s see some numbers:
Calculate md5(10GiB of zerroes) on i5-760(Turbo frequency: 3.33 GHz, launch date Q3’10)(with Ubuntu 14.04)

And then do the same on i7-6700(Turbo frequency: 4.0 GHz, launch date Q3’15)(with Ubuntu 15.10)

So we have 140 and 155 MB/s per GHz respectively. It is 10.7% performance boost after 5 years of CPU evolution. And it looks so frustrating.
p.s. Yep, I know that CPU now much smarter than 5 years ago and have rich set of specialized instruction sets(like AES-NI which is responsible for +2200% ghash calculation speed). But any software developer should be ready for that fact that unparallelizeable algorithms execution will not become faster for even a bit in near future.

Selfmade dyndns

Dyn.com stopped providing free dyndns hosting some time ago. It were sad news.
However most necessary functionality can be implemented in 70 lines of code.
To dynamically update dns records we must find a way to:

  1. get current ip
  2. update DNS record
  3. schedule script for execution

1. Getting current ip address

Many ISP use NAT for security and money saving reasons. Also NAS used in routers. So, to get your IP address you need to ask your IP address from service located outside your network.
For example internet.yandex.ru web page ask resource http://ipv4.internet.yandex.ru/api/v0/ip to determine IP address. So, let’s use it.

2. Updating DNS record

Yandex provide API for DNS records management for domains parked in yandex. API reference should be located here but link is currently broken :-(. UPD: API reference.
In two words you should send POST request with token in header and data in request’s body to https://pddimp.yandex.ru/api2/admin/dns/edit url.
It should looks like following snippet:

3. Scheduling dns records updating

Use the cron, Luke :-) I mean that adding following line to cronjobs would be a simplies way to schedule updating of our dns records:

That’s all. Complete script on github.

Few words about power management

Not so long time ago I’ve faced with problem: on the same linux distributive some machines use Inte Turbo Boost but some others didn’t.
So… To investigate this problem I’ve read enough article about power management and want to summarize key aspects below.
Holy Grail of power management is ACPI(Advanced Configuration and Power Interface). It describes sleep(Sx), processor(Cx) and performace(Px) states.
Performance states came to replace legacy throtling(Tx) states.

  • S5(“Soft-Off”) All hardware is in off state.
  • S4(“Suspend to disk”) S5 + bootloader can determine this state + WOL available
  • S3(“Suspend to RAM”) RAM state preserved as well as S3 capable devices
  • S2(“Standby”) Almost the same as S3
  • S1(“Power On Suspend/Stopgrant”) All power on, but Hard Drives and not S1 capable devices is in off state, CPU is stopped.
  • S0 The system is turned on. Cx states is S0 substates
    • C3(“Sleep”) cache not preserved
    • C2(“Stop-Clock”) all preserved but clock is off
    • C1(“Halt”) all preserved but CPU do nothing
    • C0 is operating state. Px states is C0 substates
      • Pn Minimum frequency
      • P1 Maximum base frequency
      • P0 TurboBoost enabled

So… About TurboBoost issues solution. It was just a BIOS bug(or feature? Who knows?) that doesn’t moved cpu to P0 state on some boards and does on another.

Yet another security note. Hardlinks.

Let’s imagine that you have a bunch of files(with default mode “rw-r–r–“) and you configured automatic or performed manual hardlink based backup of them.
Well…
Then you moved one of these files to “secured” folder, that have strict rights (“drwx——” for example).
Before adding some confidential information to this file it was good idea to change file permissions to more strict one. But it is not clear how important it is because no one but owner can access file located at “secured/file” when “secured” folder have “drwx——” rights.
Well… Let’s preserve old permissions if changing of them is not necessary.
But what about hardlink to file saved in usual folder? Oh yes, file located at “usual/file” still can be opened by everyone.
Conclusion:
– You must remember about all hardlinks of your files when you think about security.
– Creating hardlinks by inode and opening file by inode denied by security reasons.

Some weekend’s madness

I’ve just tried to follow intellij idea’s manual and develop some useless plugin. And now my plugin can display “Hello world” program on perl.
Screenshot from 2013-08-19 00:05:08
You also can view this madness on github.
UPD1. Some new lexical constructions support added.
idea