izard: (Default)
2024-10-19 10:12 am
Entry tags:

Exams and big tech interviews

Back in university, my friends and I had a trick when it came to exams in advanced physics and math courses: we’d try to sit exams with a postdoc or, better yet, a PhD student rather than a seasoned professor. Professors, with decades of experience, could gauge a student’s depth of understanding after just a few questions, accurately assigning grades. PhD students, however, lacked this refined intuition and often gave higher grades if you could converse confidently about basic concepts and demonstrate a good grasp of basic terminology. They usually tended to assume the best, consciously or subconsciously. The real test wasn’t the material itself, but skilfully steering the exam into a dialogue where you could shine.

So, why do I find myself reflecting on this old trick now? Read more... )
izard: (Default)
2024-02-22 08:50 pm
Entry tags:

At last: Russian LLM fine-tune

For a long time, there was no decent local LLM that understood and spoke Russian well. I've tested many fine-tunes, and they all behaved significantly dumber when answering in Russian than their respective English originals.

Russian internet has a huge potential training corpus second only to English; but smart French, German, Spanish and Arabic fine-tunes for local LLMs existed for months now, and there was no Russian one.

Until Serge Gotsuliak released his finetune few days ago.

Highly recommend it, works great with llama.cpp. I was missing RAG on my Russian books, will set it up now.

There is a drawback: 4-bit quant that I tested needs GPU[s] with ~48GB VRAM, or Apple silicon machine with 64GB+ RAM to run at decent speed.
izard: (Default)
2021-08-09 09:38 pm
Entry tags:

My stupid bug, again

I just lost several hours today debugging the following:

I am linking to a library that has a function declared in a header as:
MACRO_EXPANDING_TO_RETURN_TYPE create_object_pointer(uint64_t* arg1, int arg2, int arg3);

I can’t include the corresponding header, so just cut&pasted the function declaration before use as:
extern
MACRO_EXPANDING_TO_RETURN_TYPE create_object_pointer(uint64_t* arg1, int arg2, int arg3);

Then I was calling it in my code:
return another_lib_func (create_object_pointer(arg1, arg2, arg3), “PASSING RESULT FROM lib_func");

another_lib_func is:
int another_lib_func(RETURN_TYPE t, String s)
{
If (t == NULL) return -1;
If (t->value < 0) return -1;
….
}

It segfaulted in another_lib_func, at second line. Why?
Read more... )
izard: (Default)
2021-02-25 09:33 pm
Entry tags:

Crazy arithmetics.

All numbers below are my estimates. Let's divide s/w engineers to two halves - 50% of "good" and 50% of "bad". For simplicity, I don't account for average ones, ignore the continuum and reduce the problem to one dimension. These three omissions make results almost absolutely unreliable, but still fun.

80% of bad engineers want to switch to management. (The rest think they are good engineers - D-K).
20% of good engineers want to switch to management. (Different reasons).
50% of bad engineers who want to switch to management, do become a manager. (Persistence is key, but some bad engineers still won't make it).
80% of good engineers who want to switch to management, do become a manager. (They are good engineers because they are smart and can reach their goals).
20% of bad engineers who switched to management, are good managers. (Being a manager is a different skill).
50% of good engineers who switched to management, are good managers. (It is a different skill, but being smart helps).

Few multiplies, and voila:
Percentage of managers with "bad engineer" background ~= 71%, and ~29% were good engineers in their previous life.
However, with numbers above (I swear I didn't tune them) half of good managers were formerly good engineers.
izard: (Default)
2021-02-17 08:50 pm
Entry tags:

Hey yeah!

Is it a good time to move?
visa
Regardless, with current regulations we should fly within 4 weeks. See you there soon!
izard: (Default)
2020-12-08 01:19 pm
Entry tags:

20 years ago, my first cubicle in UK

Exactly 20 years ago I was setting up my work space in my first cubicle:

There was a thin Windows terminal to HP-UX server connected to several racks with telco equipment. The racks were green from outside and brown inside. That was supposed to make them look friendlier to engineers working with them, though I am not sure if it helped.
izard: (Default)
2020-10-08 07:50 pm
Entry tags:

my work 20 years ago.

20 years ago I started working for Nortel as a contractor. One of my first assignments was to write a script in C to automatically stress test creating tons of entries in a pre-SQL database (developed in 70s) that was storing cellular network configs.

The database mixed data with code processing it, so each config had to be tested separately. The config I had to test was lawful intercept config. For every cell phone number that could be eavesdropped on, there should have been an agency name string and court order/secret order number attached.

So I added MI6 with secret order numbers beginning with 007, and KGB with secret order numbers beginning with 1937, and ran tests where most of cell subscribers were being listened to by KGB.
izard: (Default)
2020-05-06 10:40 am
Entry tags:

my stupid bug

I was recently working on a problem, where one of the performance metrics I measured was ~100x higher than expected. It is almost impossible to make a 100x optimization, unless something is severely broken...

In the end, it appeared to be my error. But it was not a measurement error, I triple checked my measurement code and it was correct.

The buggy part was printing the end result. I made a typo in printf format, "%ull" instead of "%llu", so it printed "ll" in the end. Then I mistook "ll" for "11" when reading, and this multiplied the result 100x. I was slightly curious why random performance readings always end with 11, but I still did not catch it. Only after I pasted the result to Excel to plot a graph I realized what went wrong.
This made it in my list of top 5 stupid programming errors I ever made :)
izard: (Default)
2020-02-29 03:00 pm

Embedded world 2020 in one picture


Few years ago I managed to attend both MWC and Embedded world. Now no more MWC :(, and Embedded world looks half empty.
izard: (Default)
2020-01-18 01:21 pm

Amazon prices

Any idea why the same item on Amazon.de costs me 7% less than it costs my wife? We are using the same link, but see different prices... Of course I ordered it, but what the heck?
izard: (Default)
2019-12-25 01:55 pm
Entry tags:

20 years ago [1]

All NDAs have expired, so I can start a diary with 20 years delay.

I started working as a full time software engineer in November 1999. The product I was working on was supposed to be a VOIP phone, to be shown at CeBIT 2000. The hardware platform was set and ready, with Motorola Dragonball CPU and a DSP (I dont recall the make). In the team there were three programmers working on VOIP software, two system software engineers including myself, and a contractor who developed DSP API and driver.

During 9 months I was working on that little thing, I hacked GCC backend to produce correct code for uCLinux/Dragonball (first C, then C++ with exceptions support), implemented a watchdog, created an app to configure the phone's IP settings with DTMFs, and fixed couple of bugs in DSP driver.

I have a lot of respect for the Mera management, who invested a lot of money to this product development, and although it was not commercial success, some bits from this project ended up in other more successful products. Alas these bits that survived were not platform related, so all my work had quickly perished.

It was a great experience: I could use unlimited internet at work, and some times I stayed there at night. The team was great and I am still in touch with two of my teammates (both moved to US).

My salary was $200 first, quickly raised to $300. (That was a lot of money for a student in Nizhny Novgorod, 1999/2000). E.g renting a good one bedroom apartment was ~$100.
izard: (Default)
2019-10-19 09:43 am

Datacenters

I know a bit about datacenters from my previous job. So every time I see a building like this one in the city I am estimating how many petaflops are hidden there. About hidden - my favorite datacenter in Munich is one that is hidden below a huge children's playground. (No, I won't reveal the exact location). There are several buildings like this in the city - secured, without windows, many cameras around, chillers on the roof and generators, etc.

This one is next to a compound of Chinese consulate, and security measures look very similar.
izard: (Default)
2019-10-13 08:57 am

My first computers

1988 - Moldavian make.
1990 - Spectrum'48 clone, assembled at a local avionics factory.
1992 - Spectrum'48 with proper keyboard and monitor, 5'' floppy drive and AY38910-12
1995 - Intel 80286, 1MB RAM, 270MB!!!HDD, DOS 6.22
1996 - 2400b modem upgrade => 2:5066/44.0 - FIDONET!
1997 - AMD K5 100Mhz, 8MB RAM, still 270MB HDD, CDROM, Win95OSR2
Moved to Nizhny Novgorod
1998 - 80486, 4MB RAM, Linux Slackware/1.2 kernel
2001 - Pentium 4, 16MB RAM, Win2k/Linux Slackware 2.2 kernel
2002 - iBook clamshell, MacOS X
Moved to St. Petersburg
2004 - Mac Mini
...
Now I have many Macs to play with :)
izard: (Default)
2019-09-21 08:31 pm

Bugs

I just bought a big and expensive programming book at Powell's, from MIT Press, and in one of the first meaningful code sample, in the very beginning I read:

#define PI = 3.1592654

WTF!!! There are 2 bugs in this line, and I paid 80 bucks for the book!

Btw I am staying in Portland until next Sunday, so if you are around plz give me a shout..
izard: (Default)
2019-09-16 05:21 pm

So long, and thanks for all the fish

Starting today, I no longer work at Intel. That were great 16+ years, but now it is time for a change. My new job is even more interesting, but I am not going to post anything about it online. Just one thing: my job title has changed from Application Engineer to S/w Performance Engineer.
izard: (Default)
2019-08-23 01:06 pm

US immigration arithmetics

USCIS publishes a number of L1 visas it grants each year. I was trying to see if "hire American, buy American" affected L1s.

But some numbers do not add up, akin to a puzzle:
"units of less than 10 beneficiaries are masked so as to limit the possibility of the de-anonymization of data. "D" represents data withheld to protect privacy. The letter H replaces the value ... where one could deduce the value of D. "
ACCENTURE LLP is in top 10 L1 visa petitioners.
total - 183
Continuing L1A - 95
Continuing L1B - D
Continuing Blanket L1 - D
Initial L1A - H
Initial L1B - D

I wonder why they needed "H" here, because of Benford's law?
izard: (Default)
2019-08-08 01:02 pm

I suspected it was a CPU error

Every time I suspect I found a CPU errata, it ends up being something else. This time a compiler bug, again.
GCC 8.2.1, compiles _mm512_*fmaddsub*_pd intrinsics to vfmadd132pd instruction when compiling with -O0.

When compiling with -O1, -O2 or -O3 it compiles to vfmaddsub132pd, as expected. Happy debugging!
izard: (Default)
2019-07-29 10:17 am

Intrinsics and compiler smarts

Recently I was wondering why relatively simple and short SIMD/SSE intrinsics code is ~1.5 slower when compiled by ICC, than when compiled with CLANG.

When one uses intrinsics, it is supposed to be almost assembly, compiler should only do [optimal] register allocations and deal with input and output variables. However, compilers now do much more than that, especially the optimizations they perform on top of intrinsics are often very non-obvious.

In case of the code I examined, ICC produced ~20% faster code for a scalar part, and ~10% faster code for one vector basic block, but ~2x slower for another vector basic block. When combined, these resulted in ~1.5x difference.

It is not the first time I noticed the compiler optimizations significantly alter SIMD intrinsics flow, but before it was always something small, like fusing 2 instructions when a SIMD equivalent exists, etc. In this case it just produced 2x+ instructions! Alas, just changing to -O0 won't make it back to the planned flow, as O0 adds too many intermediates... So if I am certain that my instruction flow is better than compilers, I'll have to do inline asm rather than intrinsics.
izard: (Default)
2019-06-21 09:30 am

Big data does not work

Big data, AI.. Look at a screenshot from one of the biggest US job sites:

:)
izard: (Default)
2019-04-27 03:00 pm

Software performance: consultant's perspective.

After ~13 years working full time in software performance consulting role, I think now I have enough statistics about different types of software optimization projects.

~20% of the projects are the most challenging, a customer comes to me because their software is already well optimized, but they found a performance regression on a new platform, or in a new middleware, OS kernel, compiler, etc. There are some common patterns for these projects, but usually they are unique. The fix is usually on system level, CPU u-arch level or combination of two. It is almost never with software/algorithms.

~30% are interesting. The software is reasonably optimized, the team understands current performance and constraints, but there is a regression or unexpected slowdown, or they just need it to run ~20% faster. In these cases couple of simple tricks with system and u-arch optimizations usually work. No need to deeply investigate application business logic either. These projects are my usual trade, not too fancy, but OK. Specialisation pays off. Sometimes I also find something to learn on these projects, but not very often.

Read more... )