Jetson Engine v2 User Guide
Welcome to the user guide for Jetson Engine v2. As you may recall, Jetson Engine v1 applies a client-server concept that allows a ChessBase application running on any Windows laptop to access a UCI engine running on a remote machine (like Nvidia’s Jetson Xavier device). We have extended v1 to cover broader usages. In v2, the Jetson Engine software allows a ChessBase client to remotely connect to any UCI engine running on any of the following three types of backend servers:
-
Nvidia Jetson Xavier Portable Device: Ubuntu Linux + ARM64 CPU
-
Windows Host: Windows 10 + Intel/AMD64 CPU
-
Linux Host: Ubuntu Linux + Intel/AMD64 CPU
In v2, all UCI engines (LCZero, Stockfish, Fat Fritz, Fritz, Komodo, Houdini, etc.) are supported. Moreover, you can access strong engines from ChessBase even if you don’t have a laptop equipped with powerful GPU/CPU and abundant memory. Jetson Engine v2 also allows multiple users to simultaneously access and launch whatever engines they prefer. You can even share the same engine, with the server launching individual engine instances associated with each client. Clients and servers can be connected by either the home WiFi network or direct cable connections, as long as both the client and server can communicate via their IP addresses. The examples in this user guide use 192.168.10.x and 192.168.55.x as the IP addresses for the home WiFi network and the Xavier device, respectively.
Take the following steps to set up Jetson Engine v2:
***Please Note: Steps 1-3 are to be done on the server end and steps 4-6 are to be done on the laptop client with ChessBase.***
1. Prepare the Backend Engine Server: Though any host can technically be used as the backend server, we recommend deploying servers that have a reasonable amount of memory (8GB+), multi-core CPU, and Nvidia modern GPU. In this user guide, the three servers we use have the following configurations:
-
Jetson Xavier NX Device: 6-core ARMv8 64-bit CPU, 8G memory, Nvidia Volta GPU with 384 CUDA cores and 48 Tensor cores, and network connections with either direct MicroUSB-to-USB cable or home WiFi. Note that Jetson AGX Xavier is supported, too. It comes with 32GB memory, 8-Core ARMv8 64-bit CPU, and Nvidia Volta GPU with 512 CUDA cores and 64 Tensor cores. Both Jetson devices are running on Ubuntu Linux 18.04 for ARM64. In this user guide, the Xavier device has IP address 192.168.55.1 with hostname jxvnx03. Please follow this special procedure on how to set up Xavier device.
-
Windows 10 Host: 8-core Intel Xeon 64-bit CPU, 16GB memory, Nvidia RTX 2070 GPU with 2304 CUDA cores and 288 Tensor cores, and network connections with home WiFi. Dual-GPU configurations are tested, too. In this user guide, the Windows server has IP address 192.168.10.3 with hostname T7910.
-
Ubuntu Linux 18.04 Host: 8-core Intel Xeon CPU, 16GB memory, Nvidia RTX 2070 GPU with 2304 CUDA cores and 288 Tensor cores, and network connections with home WiFi. Dual-GPU configurations are tested, too. In this user guide, the Linux host has IP address 192.168.10.6 with hostname T5820UB.
Note: Please use PuTTY to log in to Xavier/Linux server and Remote Desktop to log in to Windows server.
It is recommended to use a dedicated account in the server to hold the engine folder. In this user guide, we use the account "jetson" as the example for all three types of hosts. For Xavier and Linux, the home folder is /home/jetson. For Windows, the home folder is C:\Users\jetson.
2. Copy Backend Package to Server Home Folder: Download JetsonBackend_xxx.zip file on your computer and copy it to the backend home folder created in Step 1. For Xavier/Linux server, use pscp to copy JetsonBackend_Xavier.zip/JetsonBackend_X64Linux.zip to the backend server. You can do so by typing the following command:
pscp JetsonBackend_Xavier.zip
jetson@192.168.55.1:/home/jetson
pscp JetsonBackend_X64Linux.zip jetson@192.168.10.6:/home/jetson
If Xavier/Linux has internet access, you can also use the wget command.
For Windows server, there are many ways to copy JetsonBackend_X64Win.zip to the backend server. We directly downloaded the package within the Windows server.
Once the package is copied to the backend server, unzip it. You should see the subfolder "JetsonBackend" appear. The JetsonBackend folder contains the following contents:
-
Engine agent jetson_agent (.exe): An agent is the program that accepts connections from ChessBase clients, and then distributes UCI requests to the backend engines and relays UCI responses back to the clients. The agent is the only program a user needs to run the backend server. In Windows, the agent program is jetson_agent.exe, whereas in Xavier/Linux, it is jetson_agent.
-
Engine folders: Each engine folder is associated with an engine that can be launched in the server. The folder name (EngineName) must be set in the configuration file (jetson_agent.conf) to link to the actual engine binary to launch. Different folders may use the same type of engine with different configurations.
-
Note: each engine folder has the engine program in it. Please do not attempt to manually load the engine program since engine programs are automatically loaded by the agent.
-
Note: For lc0 and Fat Fritz engines on Windows backend, please also download CUDA_cuDNN_DLL.zip, unzip it, and copy all the DLL files to each folder.
-
-
Engine configuration file (jetson_agent.conf): The configuration file tells the agent where to look for the engine program and what configuration options to use with it. Detailed information about how to set configuration is in jetson_agent.conf. Here is an example of what the configuration looks like:
Here is an example of what the "JetsonBackend" folder contents look like on Windows and Xavier/Linux:
3. Launch the Backend Agent on the Server: After the engine backend package is installed in Step 2, you can now launch jetson_agent.exe (for Windows) or jetson_agent (for Xavier and Linux). First, go into the “JetsonBackend” folder. Then launch the agent by typing "jetson_agent.exe" (Windows) or "./jetson_agent" (Xavier/Linux).
Note: For Xavier and Linux, you might run into the following error:
-bash: ./jetson_agent: Permission
denied
You will need to add an execute permission to the agent program by
running "sudo chmod a+x jetson_agent"
Once the agent is launched, all the configured backend engines will be waiting for connections from ChessBase clients that are able to access it.
Windows agent loading seven engines and Linux agent loading four engines based on configurations
By saying "waiting for connections from ChessBase clients that are able to access it", we mean the ChessBase client must be in the same subnet where the backend server resides. ChessBase on our laptop is able to access all three backend servers by using two separate IP addresses: 192.168.55.55 to access the Xavier device (192.168.55.1, via MicroUSB-to-USB cable direct connection) and 192.168.10.2 to access the Windows server (192.168.10.3) and the Linux server (192.168.10.6), both via home WiFi network.
Here is some extra information you might find useful:
Cloud Access: Some may wonder if it’s possible to access the backend server via Internet. To that we say yes! You can turn on "Port Forwarding" from your home Internet router, and then the ChessBase client can access it from anywhere in the world. Port forwarding is just one method – we’re pretty sure there are other ways for cloud access with better security. Future Jetson Engine versions (perhaps v3…) may add secure access features to allow safe cloud access. You could also simply tweak the source codes (which will be published soon) to add secure features in your favor. We have successfully performed a proof-of-concept test for the Port Forwarding scenario. You can find the instructions here.
Agent Loaded Automatically: The backend server is the machine providing services, so you may want the agent to launch automatically when the server is up to avoid having to log in to the server and launch it manually. To achieve this, you may set a cronjob (for Xavier/Linux) or task scheduler (for Windows). There are other ways to automatically load the agent.
Agent Loaded in the Background: When manually loading the agent, we suggest loading it in the background or with the window minimized. There should be many different ways to load the agent in the background. One possible way is to run "start /min jetson_agent.exe" for Windows or "nohup ./jetson_agent &" for Linux.
Firewall Warning: Windows Defender Firewall may give you a warning when you launch jetson_agent.exe on a Windows server for the very first time. This likely occurs because the home WiFi network was set up as a "public network." It is not a huge issue - just click "Allow access" if it appears.
Possible Firewall Warning when launching Windows agent
4. Auto-Generating ChessBase UCI Engines on Client: Once the backend server is prepared and the agent is launched, the ChessBase client will scan the agent to retrieve a list of engines. A bunch of UCI engine executables will be automatically generated and can then be loaded by ChessBase. Please download JetsonFrontend zip package, save it anywhere in your laptop (for example, C:\Users\username), and then unzip it. The subfolder "JetsonUCI" should show up.
To retrieve a list of engines, type in the following command to scan the backend server:
jetson_scan.exe scan server_ip [mgmt_port]
Here is an example of scanning the backend server 192.168.10.3, the Windows backend.
Note: mgmt_port is optional. Deafult 53350 is used if not provided. To use customized mgmt_port, the port number should be provided in file "mgmt.port" in backend folder.
As mentioned earlier, the scan will return a list of available engines from the given backend server. Then their associated UCI engine executables (.exe files) will be automatically generated. The auto-generated UCI engine executables have a special naming format like this:
JRE_X64WIN_192.168.10.3_53352_lc0-cuda
JRE - Jetson Remote Engine
X64WIN - Engine is retrieved from a Windows server running on Intel/AMD X64 CPU. (For Linux server on Intel/AMD64, it is X64LNX and for Xavier device, it is XAVIER.)
192.168.10.3 - IP address of backend server. As mentioned earlier, this user guide use 192.168.10.3 for a Windows server, 192.168.10.6 for a Linux server, and 192.168.55.1 for Xavier device. If you have engines from another server, you should use the scan command with the different IP address to retrieve the engine list.
53352 - Uniquely assigned TCP port associated with the engine name (lc0-cuda in this example) for the agent to accept connections. Port assignment is done via the jetson_agent.conf file, which was mentioned in Step 2.
lc0-cuda - Engine name associated with a certain engine or engine configuration pre-defined in the jetson_agent.conf file.
The example below shows all the engines retrieved from the three backend servers (four from Windows, four from Linux, and three from Xavier):
JRE Engines retrieved from multiple backend servers
5. Create UCI Engines from ChessBase on the Client: Launch ChessBase and click "Create UCI Engine." Go to the "JetsonUCI" folder where those JRExxx engines were generated. Select one of the engines to prompt ChessBase to issue UCI commands to retrieve engine information. The UCI commands will be relayed to the backend server and the responses will be transferred back. ChessBase actually has no idea the engine is located outside. Repeat this step to load all those JRExxx engines.
Creating UCI engines from auto-generated JRE executables
6. Launch and Run UCI Engines on Client: In ChessBase, go to "Analysis" -> "Let's Check". The default engine that comes with ChessBase is usually Fritz. To switch, select any of the newly created JRE engines from the "Load engine" box. A JRE engine will run.
The "Load engine" box shows a list of JRE engines that have been retrieved from various backend servers that the ChessBase client can access. The following example shows four engines from a Linux server, seven engines from a Windows server, and three engines from a Xavier device.
Normally, the engine names shown in the "Load engine" box are the "id name" string returned by the engine. The Jetson agent in the backend server intercepted the "id name" string and then added JRExxx string to allow for easy identification of where the engine comes from and what type of engine it is. For example, the real id name for a LCZero engine is "Lc0 v0.26.0-dev+git.dirty" whereas the modified id name is “JRE_X64LNX_192.168.10.6_lc0-cuda##Lc0 v0.26.0-dev+git.dirty”. Anything before "##" is an added JRE string and anything after "##" is the original id name string.
Position evaluations by lc0 running from Xavier, Windows, and Linux backend
Summary
This six-step procedure is a one-time thing. Once the JRExxx UCI engine is loaded into ChessBase, it will stay there and is good to run, provided that the Jetson agent is running in the backend server. Hope you found this process to be simple!
Here is some supplemental information that you may find useful:
Supported Engines: So far, we have tested the following backend engines:
-
Leela Chess Zero: Xavier, Windows, Linux
-
Stockfish: Xavier, Windows, Linux
-
Fat Fritz: Windows
-
Fritz 17: Windows
We didn't have a chance to test out other notable engines like Komodo and Houdini, but we believe they should work without an issue since they all follow UCI protocols. Engine authors can contact us if they’d like us to test out their engines on various types of backend servers (e.g., Fat Fritz and Fritz 17 on Linux and Xavier).
Add New Engine Configurations: You may want to add a new engine or a new configuration. Here is an example of what steps to take to add a lc0 engine that has new weights file:
-
[1] Create a new EngineName folder called “lc0-cuda-t60” under the backend server home folder.
-
[2] Copy the engine binaries (lc0 executable, weights file, and other required binaries like Windows DLL) into it.
-
[3] Add a new entry in the jetson_agent.conf file.
-
[4] Repeat steps 4 to 6 of setting up Jetson Engine v2 on the client side.
Note: You don't actually need to touch the existing engines.
The agent on the backend server doesn't need to stop and this process of adding a new engine or a new configuration won't affect other running engine configurations.
Engine Binaries in the Package: In the downloadable package, only lc0 and Stockfish engines are included. Commercial engines are excluded. You can add commercial engines in the backend server if you’ve purchased the licenses. The detailed engine information from the package is listed below:
Leela Chess Zero:
-
Windows: Pre-compiled binaries of v0.25.1 from lc0 releases. We chose package lc0-v0.25.1-windows-gpu-nvidia-cuda.zip. The required DLL files are also copied from this package.
-
Linux: We downloaded the lc0 source code and simply followed their instructions to compile and generate lc0 executables. All lc0 source files were not changed in any form.
-
Xavier: We downloaded the lc0 source code and simply followed their instructions to compile. Lc0 engine source files were not changed in any form. However, the meson.build file must be modified to change the two places from -arch=compute_70 and -code=sm_70 to -arch=compute_72 and -code=sm_72. There is also a known bug from Nvidia about cuDNN-8 support, so before they release a formal fix, we have to apply a work around to load lc0 successfully in Xavier device.
Stockfish:
-
Windows: Pre-compiled binaries of Stockfish 11.
-
Linux: We downloaded the stockfish source code and simply followed their instructions to compile and generate two types of binaries (one with bmi2 option, and one without). All source files were not changed in any form.
-
Xavier: We downloaded the stockfish source code and simply ran "make build ARCH=armv8 COMP=gcc COMPCXX=g++" to generate the engine executable. All source files were not changed in any form.
Engine Binaries Not in the Package: If you want to use an engine not shown in the Jetson Engine package, you can download the pre-compiled engine binaries or compile the source codes provided by engine authors and then put all of them in the backend server.
Checking Backend Status: Since the backend server is shared and accessed by multiple clients, we may want to check the status of a backend server (for example, how many ChessBase clients are connected to it? or what backend engines are running and by which client?). From any ChessBase client, run the command "jetson_scan.exe query server_ip", where server_ip is the IP address of a backend server.
Here is an example of query command showing five clients that are running different engines from one Windows backend server: