分布式发电
您应该升级到
Terrain generation is a complex task and may require substantial time depending on the area size and data resolution. Sandworm allows using distributed computing to generate terrain.地形生成是一项复杂的任务,可能需要大量时间,具体取决于区域大小和数据分辨率。 Sandworm 允许使用分布式计算来生成地形。
The concept is to use several computers united into a network, one of which is Master and assigns tasks, and the other are Workers that perform portions of work (processing of source data) assigned to them. UnigineEditor with the Sandworm tool and a terrain project should be open on Master, while Workers run the console application. Source files (geodata) and common cache shall be stored in a shared folder. If a Worker still has available resources, additional processes may be run on it and participate in terrain generation immediately, i.e., without restarting the generation process. Master creates the asset based on the result.这个概念是使用多台计算机联合成一个网络,其中一台是 Master 并分配任务,另一台是 Workers 执行分配给它们的部分工作(处理源数据)。带有 Sandworm 工具和地形项目的 UNIGINE 编辑器应该在 Master 上打开,而 Workers 运行控制台应用程序。源文件(地理数据)和公共缓存应存储在共享文件夹中。如果 Worker 仍有可用资源,则可以在其上运行其他进程并立即参与地形生成,即无需重新启动生成进程。 Master 根据结果创建资产。
Participants of the process:过程参与者:
Launching Order发射令#
Before launching any of the network participants, disable Microprofile for it — in \data\configs\default.user, set:在启动任何网络参与者之前,禁用微轮廓为此——在 \data\configs\default.user 中,设置:
<microprofile_enabled>0</microprofile_enabled>
Otherwise, every instance would run Microprofile, causing memory waste.否则,每个实例都会运行 Microprofile,造成内存浪费。
You can launch Master and Workers in any sequence.您可以按任何顺序启动 Master 和 Workers。
You can run additional Workers after the terrain generation process has started, and Master will distribute jobs for them.您可以在地形生成过程开始后运行额外的 Workers,而 Master 将为它们分配作业。
One machine can have several Workers running. A Worker can have several processes (forks) that are activated via the menu on Master.一台机器可以运行多个 Workers。一个 Worker 可以有多个通过 Master 上的菜单在 激活的进程(分叉)。
Using Distributed Generation使用分布式生成#
Workflow:工作流程:
-
Prepare your environment.准备好你的环境。
Connect all computers to the network. It is recommended to use a network with at least 1 Gb bandwidth. Otherwise, you may experience network lags (see the Troubleshooting section). Check that your network doesn't block broadcasting, otherwise distributed computation will be unavailable.将所有计算机连接到网络。建议使用带宽至少为1 Gb的网络。否则,您可能会遇到网络延迟(请参阅故障排除部分)。检查您的网络是否阻止广播,否则分布式计算将不可用。
It is recommended to use an SSD drive to store the generation cache and output files. If an HDD is used, the generation performance is significantly lower due to multiple read/write and head positioning operations.建议使用 SSD 驱动器来存储生成缓存和输出文件。如果使用 HDD,由于多次读/写和磁头定位操作,生成性能显着降低。 -
On each Worker computer, run the Worker console application.在每台 Worker 计算机上,运行 Worker 控制台应用程序.
The versions of binary executable files must be the same on all computers.所有计算机上的二进制可执行文件的版本必须相同。 -
On the Master computer:在 Master 计算机上:
- Run UnigineEditor and open the Sandworm tool (Tools -> Sandworm).跑步UnigineEditor并打开 Sandworm 工具 (Tools -> Sandworm)。
- Open the *.sworm asset you are going to generate and configure the output settings.打开要生成的 *.sworm 资产并配置输出设置.
- Click the Distributed option and specify the Master's settings. Save the project configuration.单击 Distributed 选项并指定 Master 的设置.保存项目配置。
-
Click the Generate button. The window with the list of available Workers will open:单击 Generate 按钮。包含可用 Workers 列表的窗口将打开:
As soon as this window is open, Workers start parsing the shared source data and generating cache. In the end of this process, the console message Worker: Ready To Import is displayed.此窗口一打开,Workers 就开始解析共享源数据并生成缓存。在此过程结束时,将显示控制台消息 Worker: Ready To Import。
-
Clicking the right mouse button on a Worker makes the following options available:在 Worker 上单击鼠标右键可以使用以下选项:
Worker Options工人选项Create Fork Creates one more process on the same Worker. We estimate a reasonable number of forks as 4 to 6. Higher values reduce the Worker's performance.在同一个 Worker 上再创建一个进程。We estimate a reasonable number of forks as 4 to 6. Higher values reduce the Worker's performance.We estimate a reasonable number of forks as 4 to 6. Higher values reduce the Worker's performance.We estimate a reasonable number of forks as 4 to 6. Higher values reduce the Worker's performance.我们估计合理数量的分叉为 4 到 6。较高的值会降低 Worker的性能。Shutdown Removes the fork or Worker from the list.从列表中删除 fork 或 Worker。 Clear Cache Clears the Worker's local cache.清除 Worker 的本地缓存。 Set the number of forks you need and click Generate.设置所需的分叉数,然后单击 Generate。
-
During the generation process, you can connect more Workers, if necessary: run the console application on a Worker (even if this Worker is already running one or several). This console application will automatically connect to Master, and Master will assign a process to this Worker.在生成过程中,您可以连接更多的 Workers,如有必要:在 Worker 上运行控制台应用程序(即使这个 Worker 已经在运行一个或多个)。这个控制台应用程序会自动连接到 Master,Master 会给这个 Worker 分配一个进程。
- When the terrain generation is completed, disable all Worker processes.地形生成完成后,禁用所有 Worker 进程。
Setting Up the Master设置主#
To set up Master, select the Distributed option in the Generation section. In the Parameters, toggle on the Enabled option.要设置 Master,请在 Generation 部分中选择 Distributed 选项。在 Parameters 中,打开 Enabled 选项。
Master settings:Master 设置:
Enabled | If toggled on, distributed computing is enabled for the terrain generation, and the machine running the Editor with Sandworm is Master.如果打开,则为地形生成启用分布式计算,运行编辑器的机器为 Sandworm 为 Master。 |
---|---|
Broadcast Port | Port for listening to Sandworm by Workers.通过 Workers 监听 Sandworm 的端口。 |
Server Port | Port used for information exchange.用于信息交换的端口。 |
Workload on Master | Percentage of terrain generation performed by Master.Master 执行的地形生成百分比。 |
Setting Up a Worker设置工人#
To set up a Worker:要设置 Worker:
-
Create a new UNIGINE project on a Worker computer with the corresponding project feature enabled:创建具有相应项目的 Worker 计算机上的新 UNIGINE 项目特征启用:
-
Run the SandwormNode_x64.exe console application stored in the bin/ folder of your project. The message that Worker is ready should appear in console:运行存储在项目的 bin/ 文件夹中的 SandwormNode_x64.exe 控制台应用程序。 Worker 准备就绪的消息应该出现在控制台中:
- Set the path for storing the local cache using the --sw_local_cache_path console command.使用 --sw_local_cache_path 控制台命令设置存储本地缓存的路径。
- Use --sw_broadcast_port, if you want to change the default broadcast port.如果要更改默认广播端口,请使用 --sw_broadcast_port。
- Worker detects Master on the network, connects to it, downloads the scene, prepares all layers (checks their accessibility), and is ready for terrain generation.Worker 在网络上检测到 Master,连接到它,下载场景,准备所有图层(检查它们的可访问性),并准备好生成地形。
You can run multiple console applications on one machine and/or fork one Worker via Master to create more processes.您可以在一台机器上运行多个控制台应用程序和/或通过 Master 分叉一个 Worker 以创建更多进程。
- Operating System versions on Master and Workers should be identical.Master 和 Workers 上的操作系统版本应该相同。
- The SDK version of the Editor run on Master should be the same as the version of the console app (including precision).在 Master 上运行的编辑器的 SDK 版本应与控制台应用程序的版本相同(包括精度)。
- Development/Release version of SDK does not matter.SDK 的 Development/Release 版本无关紧要。
When the terrain generation is completed and you don't need Workers anymore, close the console application on Workers or shut down processes via Master.当地形生成完成并且您不再需要 Workers 时,关闭 Workers 上的控制台应用程序或通过 Master 关闭进程。
Troubleshooting故障排除#
If the network latency is too large despite 1Gb bandwidth or higher, this can be caused by a 100 Mb or 10 Mb device connected to the network. Data exchange rate drops down to the maximum rate supported by such device, slowing down the generation speed.如果网络延迟过大,尽管带宽为 1Gb 或更高,这可能是由连接到网络的 100 Mb 或 10 Mb 设备引起的。数据交换率下降到该设备支持的最大速率,降低了生成速度。
- Some 100 Mb or 10 Mb devices can have a working network interface when they are turned off.某些 100 Mb 或 10 Mb 设备在关闭时可以具有工作网络接口。
- Some 1 Gb devices, when turned off, have a network interface working at 100 Mb rate, which slows down connection on LAN.某些 1 Gb 设备在关闭时具有以 100 Mb 速率工作的网络接口,这会减慢 LAN 上的连接速度。
Other recommendations:其他建议:
- Check that your projects on Master and Workers use the same precision (double or float), the same engine versions, and the same GDAL versions, otherwise the Workers would display the Different Builds error.检查您在 Master 和 Workers 上的项目是否使用相同的精度(double 或 float)、相同的引擎版本和相同的 GDAL 版本,否则 Workers 会显示不同的构建错误。
- Use SSD to store shared source data and cache.使用SSD存储共享源数据和cache.
- Add the application to the antivirus exclusions, as it may reduce performance.将应用程序添加到防病毒例外中,因为它可能会降低性能。
- Check that network ports used by Master and Workers are allowed by the firewall.检查防火墙是否允许 Master 和 Workers 使用的网络端口。