Fixing Simulator License Acquisition Latency

Many larger semiconductor companies use global licenses for EDA tools to support their distributed teams. Unfortunately, getting a license for a simulator, the bread and butter of design and verification engineers, can be atrociously slow. I have seen waiting times of up to 20 seconds when the round trip time of a ping to the license server was 180ms and the license server still had over a hundred free licenses. Wait times above a few seconds drain productivity. It is surprising that EDA vendors accept two orders of magnitude higher latency in license acquisitions than the ideal when they compete against tools such as Verilator or Icarus Verilog with no license limits or acquisition latency.

Fortunately, most of the latency can be removed by setting the LM_LICENSE_FILE correctly and ensuring that the simulator only asks for licenses that you actually have. You need to do the following:

1. Find a time window where your chosen simulator has a lot of licenses free. Use lmstat to see how many licenses are in use.

$ lmstat -a > lmstat.out

2. Write a small dummy verilog program to use as a profiling object

module dummy;
  initial $display("Hello World");
endmodule

3. Profile the license acquisition time of your simulator

$ compile dummy.v
$ time runsim

If time spits out less than a second, you’re done. The FlexLM license server is slow. It can’t do better than a second. If time spits out multiple seconds, then there are gains to be had.

4. Find the closest license server with the simulation licenses that you are interested in. The output from lmstat -a and ping are your friend.

$ echo $LM_LICENSE_FILE
744@serv1:744@serv2:744@serv3
$ ping serv1
..... 310ms .....
$ ping serv2
..... 180ms .....

In this example serv2 is the closest license server with a simulator license. The other servers are further away or don’t have the license that I am looking for.

5. Edit the $LM_LICENSE_FILE environment variable to put the closest server first

$ export LM_LICENSE_FILE=744@serv2:744@serv1:744@serv3

Profile your simulator again. Did it help? Some EDA vendors will appear to have coded their license acquisition routine as follows:

for (server in $LM_LICENSE_FILE)
  for (license type in [CHEAP, NOT_SO_CHEAP, EXPENSIVE, REALLY_EXPENSIVE, EVERYTHING])
     ask server for that and only that license type // takes a second. FlexLM is slow

The good thing about this is that the vendors will give you the cheapest license that you can get away with. The bad news is that larger companies only buy the global version of the REALLY EXPENSIVE or the EVERYTHING licenses, so their license acquisition time is slower than the cheapskates. If you put the closest license server with the licenses, that you want, first, then you won’t have to wait for the loop to go through all the other license servers. Unfortunately, you are still waiting for FlexLM to tell your simulator that it doesn’t have licenses for the cheap versions.

6. Open the documentation for the simulator. Somewhere there is a command line option, or an environment variable that lets you specify the order of searching for a license. Find it and try it out in your sandbox environment. Below I am assuming that the cheapest license that I have is “REALLY_EXPENSIVE” and that there is a command line option is called force_license:

$ time runsim --force_license REALLY_EXPENSIVE

These two changes did it for me. I went from 20 seconds down to 1.4 seconds. The simulator documentation gave me some further options regarding environment variables, such as alternatives to LM_LICENSE_FILE, but these were only able to cut maybe another 100ms.

I hope that this will help you keep your productivity and your sanity.

Side note: Almost all simulators have a profiling command line option which will give you extra information, such as the amount of time spent waiting for a license. For this dummy file it should be just below 100%. In general, you should use the profiler of your simulator. It is your friend.

Leave a Reply

Your email address will not be published. Required fields are marked *