Running Leela and Fat Fritz on your notebook

6/14/2020 – Neural network (NN) engines – Leela Chess Zero, Fat Fritz – have become superbly strong, and provide fascinating positional analysis. However, in order to unleash the full power of the NN algorithms, we must use some kind of GPU accelerator device. The problem is that a compact laptop often can’t sustain the running NN engines and will crash. Here is a super elegant solution to this problem!

Fritz 17 - The giant PC chess program, now with Fat Fritz Fritz 17 - The giant PC chess program, now with Fat Fritz

The most popular chess program offers you everything you will need as a dedicated chess enthusiast, with innovative training methods for amateurs and professionals alike.

More...

Jetson Lc0: Leela and Fat Fritz on a portable GPU device

I am 15-year-old WIM Evelyn Zhu. The beautiful game of chess has and continues to be a huge part of my life. At the age of seven, I started playing chess competitively. Since then, I’ve worked my way up to being one of the top players of my age in the USA.

For the past two years, I’ve been more or less settled with the neural network (NN) based Leela Chess Zero (aka Lc0) engine, the open-source implementation of Google DeepMind’s Alpha Zero. It has consistently beaten other engines, most recently winning the 17th season of the TCEC against Stockfish with a score of 52.5 – 47.5. Lc0 is quite fascinating as is seems to show evaluations in a more positional manner, without searching very deep as other non-NN engines do.

The same applies to the NN engine Fat Fritz (FF), which is part of the Fritz 17 package and with which I intend to experiment with in the future. I am in touch with ChessBase, who will be providing me with betas of the upcoming version. They say it is already now a great leap forward in playing strength.

In order to unleash the power of its NN algorithms, we must use some kind of GPU accelerator device, such as Nvidia’s modern GPU GTX 10 or RTX 20 series.

Modern laptops are, in fact, often equipped with the aforementioned devices. The problem is that the compact profile of a laptop often can’t sustain the running of lc0. When it comes to running an engine for purposes such as opening preparation and game analysis, my laptop (with GTX 1050) tends to crash from overheat.

Because of this issue, I started to wonder if there was a way for laptops to connect to an external, portable Nvidia GPU device and, at the same time, still be able to launch the lc0 engine with ChessBase.

I raised this question to my dad, who is familiar with computer peripheral devices, and he told me there is probably a solution. He mentioned that Nvidia recently released a considerably powerful GPU device, the Jetson Xavier NX module, which is intended for IoT purposes such as AI-powered robotics and autonomous vehicles. This new device has 384 NVIDIA CUDA® Cores and 48 Tensor Cores and claims to reach 21 TOPS AI performance. In essence, it is an excellent candidate for running lc0.

He advised me to figure out the following three points to make this work:

  1. Launch lc0/FF engine inside the Xavier NX device: The lc0 source code is mainly Intel x86/amd64 architecture for both Windows and Linux. Even though Jetson Xavier NX is based on ARM64 architecture, it comes with Ubuntu Linux 18.04, so it is possible to recompile the source code.

  2. Launch UCI engine in ChessBase on Windows laptop: Since I still want to use ChessBase on my Windows laptop the same way I did before, I have to create a UCI engine program that can process ChessBase-issued UCI commands. This does not seem very difficult since I can simply borrow the main program from the lc0 source code and only keep the part with UCI loop logics.

  3. Communications between frontend UCI and backend lc0/FF: For this point, I need to create a data communication channel to transmit the UCI commands to the backend lc0/FF engine. Then, I have to return the results back to the frontend UCI engine. This can be done via network programming or serial port programming since Jetson Xavier NX supports both.

After an intensive few weeks of work, I managed to come up with a simple Windows UCI engine program (point 2) as well as the communication mechanism between UCI and lc0 backend (point 3). My dad helped me crack point 1 as it took some effort to tweak and recompile the lc0 source code for ARM64 and CUDA/CUDNN libraries to successfully load it in the Xavier NX device.

With everything in place, I’m able to simply connect the Xavier NX device with a MicroUSB-to-USB cable to my Windows laptop, launch the lc0 engine from the Xavier NX device (via PuTTY, a secure remote login tool), and then load the UCI engine from ChessBase. And that’s it! The performance is great using the popular network 256x20-t40-1541.pb.gz.

Here is a demo video showing how to run the Jetson Lc0 engine.

The Jetson Xavier NX device is small and very convenient to carry. I also managed to put it inside a case that is dedicated to the Jetson Nano development board.

The Jetson Xavier NX Device connectd to my laptop without a case...

... and in the elegant little case built for it.

Whether or not your laptop comes with Nvidia GPU, you can still run Jetson Lc0 to achieve the high performance of lc0 because you are running on an external GPU device.

This portable Leela Chess Zero and Fat Fritz device really solves my laptop crash issue! I am now using this device for any chess analysis that needs an engine’s help. I’m hoping my work will help many other chess enthusiasts who face a similar issue.

Besides Jetson Xavier NX, the same programs can be used on a more powerful Jetson AGX Xavier, which doubles the performance of lc0.

Coming soon: full instructions on installing the Jetson Lc0/FF with ChessBase on your notebook.

About the author

Evelyn Zhu is a Women International Master and U.S. National Master from Long Island, New York. She started playing chess competitively at a young age and has won numerous individual and team championships. She greatly enjoys giving back to the chess community through her work as a tournament organizer, tournament director, and camp coach. Along with chess, Evelyn finds passion in computer science and engineering. As such, she frequently participates in coding competitions and enjoys learning about the potential of computers and AI.



Discuss

Rules for reader comments

 
 

Not registered yet? Register