This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

分布式生成

See Also
另请参阅#

观看这段视频,来自Sandworm地形生成系列视频教程:

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允许使用分布式计算生成地形。

注意
Distributed computing makes sense when used for speeding up terrain generation that takes more than an hour. Applying distributed computing to generate a small terrain area with low-detail data (10 meters or more per pixel) may be unprofitable at all.分布式计算是有意义的,当用于加快地形生成需要一个多小时。应用分布式计算来生成一个小地形区域与低分数据(每像素10米或更多)可能无利可图。

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并分配任务,另一台是Worker执行部分任务 分配给他们的工作(处理源数据)。 带有 Sandworm 工具的 UnigineEditor 和地形项目应该在 Master 上打开,而 Worker 运行控制台应用程序。 源文件(地理数据)和公共缓存应存储在共享文件夹中。 如果 Worker 仍有可用资源,则可以在其上运行其他进程并参与地形生成 立即,即不重新启动生成过程。 Master 根据结果创建资源。

注意
All workstations performing computations for a certain terrain generation job must be running on the same operating system (Windows or Linux). UNIGINE SDK version should also be the same.为特定地形生成作业执行计算的所有工作站必须运行在相同的操作系统上(Windows或Linux)。UNIGINE SDK版本也应该是一样的。

Participants of the process:该过程的参与者:

Master

Computer that manages the whole generation process, forms the task pool, and distributes tasks between Workers. Master tracks all connected Workers and assigns tasks to them. Master itself also performs calculations. Master is run via Sandworm.管理整个生成过程的计算机,形成任务池,并在 Worker 之间分配任务。 Master 跟踪所有连接的 Worker 并将任务分配给他们。Master 本身也执行计算。 Master 通过 Sandworm 运行。

Worker

Computer connected over the network to Master and performing specific tasks assigned by Master. Worker is enabled by running bin/SandwormNode_x64.exe.通过网络连接到Master并执行由Master分配的特定任务的计算机。通过运行bin/SandwormNode_x64.exe启用Worker

注意
The number of Workers connected to one Master is not limited (as long as the network bandwidth allows that).连接到一个 MasterWorker 的数量不受限制(只要网络带宽允许)。

Launching Order
启动顺序#

警告

Before launching any of the network participants, disable Microprofile for it — in \data\configs\default.user, set:在启动任何网络参与者之前,为其禁用 Microprofile - 在 \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.您可以启动主和Worker在任何序列。

You can run additional Workers after the terrain generation process has started, and Master will distribute jobs for them.您可以在地形生成进程启动后运行额外的Worker, Master将为它们分配作业。

One machine can have several Workers running. A Worker can have several processes (forks) that are activated via the menu on Master.一台机器可以运行多个 WorkerWorker 可以有多个通过 Master 上的菜单激活的进程(分支)。

Using Distributed Generation
使用分布式生成#

Workflow:流程:

  1. 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,由于多次读/写和磁头定位操作,生成性能会显著降低。
  2. On each Worker computer, run the Worker console application.On each Worker computer, run the Worker console application.

    注意
    The versions of binary executable files must be the same on all computers.二进制可执行文件的版本必须是相同的所有计算机。
  3. 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 generation settings.打开您将要生成的*.sworm资源,并配置生成设置
    • Enable 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按钮。带有可用Worker列表的窗口将会打开:

      分布式生成窗口

      注意
      If you regenerate the project, this window will appear after the warning on losing any manual modifications.如果您重新生成项目时,这个窗口将会出现警告后失去任何手动修改。

      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.一旦这个窗口是开放的,Worker开始解析共享源数据和生成缓存。这个过程的最后,Worker: Ready To Import显示控制台消息。

    • Clicking the right mouse button on a Worker makes the following options available:Worker上单击鼠标右键,可以获得以下选项:

      Worker的设置

      Worker OptionsWorker的设置
      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.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.
      在同一个Worker上再创建一个进程。
      最佳实践
      We estimate a reasonable number of forks as 4 to 6. Higher values reduce the Worker's performance.我们估计一个合理数量的分支是4到6。更高的值降低WorkerPerformance.
      Shutdown Removes the fork or Worker from the list.从列表中删除分支或Worker
      Clear Cache Clears the Worker's local cache.清除Worker的本地缓存。

      Set the number of forks you need and click Generate.设置您需要的分支数量并单击Generate

  4. 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.在生成过程中,如果需要,您可以连接更多 Worker:在 Worker 上运行控制台应用程序(即使该 Worker 已经在运行 一个或几个)。 这个控制台应用程序会自动连接到 MasterMaster 会为这个 Worker 分配一个进程。

  5. When the terrain generation is completed, disable all Worker processes.当地形生成完成后,禁用所有Worker进程。

Setting Up the Master
设置主#

To set up Master, enable Distributed Generation in Generation Settings: toggle on the Enabled option.要设置Master,请在Generation Settings中启用Distributed Generation:切换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的Editor的机器为Master
Broadcast Port Port for listening to Sandworm by Workers.端口Sandworm Worker听。
Server Port Port used for information exchange.用于信息交换的端口。
Workload on Master Percentage of terrain generation performed by Master.地形生成由Master百分比。
注意
All sources and project cache should be stored in a shared location accessible by both Master and all Workers. The path to this location should be identical on Master and Workers.所有源代码和项目缓存都应该存储在Master和所有Worker都可以访问的共享位置。该位置的路径在MasterWorker上应该是相同的。

Setting Up a Worker
建立一个Worker#

注意
Worker should have the same version of OS and UNIGINE SDK as Master.Worker应该具有与Master相同的OS和UNIGINE SDK版本。

To set up a Worker:建立一个Worker:

  1. Create a new UNIGINE project on a Worker computer with the corresponding project feature enabled:Worker 计算机上创建一个新的 UNIGINE 项目,并启用相应的项目功能

    启用 Worker 应用程序

  2. 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已经准备好的消息应该出现在控制台中:

    Worker已准备好生成

  3. Set the path for storing the local cache using the --sw_local_cache_path console command.设置路径存储本地缓存使用--sw_local_cache_path控制台命令。
  4. Use --sw_broadcast_port, if you want to change the default broadcast port.如果要更改默认广播端口,请使用--sw_broadcast_port
  5. 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网络,连接,下载现场,准备所有层(检查他们的可访问性),并准备好地形的一代。

Worker 应用程序正在运行并准备好生成地形

Worker application is running and ready for terrain generation工作程序正在运行,可以生成地形

You can run multiple console applications on one machine and/or fork one Worker via Master to create more processes.您可以在一台机器上运行多个控制台应用程序和/或叉一个Worker通过Master创建多个进程。

注意
  • Operating System versions on Master and Workers should be identical.MasterWorker上的操作系统版本应该是相同的。
  • The SDK version of the Editor run on Master should be the same as the version of the console app (including precision).SDK版本的编辑器运行在Master应该一样的控制台应用程序的版本(包括精度)。
  • Development/Release version of SDK does not matter.Development/Release版本的SDK无关紧要。

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.当地形生成完成,不再需要Worker时,在Worker上关闭控制台应用程序或通过Master关闭进程。

Generating Landscape in Headless Mode
在无头模式生成景观#

A landscape created in Sandworm project can also be generated in the Headless mode, without running UNIGINE Editor.Sandworm 项目中创建的景观也可以在 无头(Headless)模式下生成,而不需要运行 UNIGINE 编辑器。

To do that:做某事:

  1. Configure a UNIGINE project to enable the corresponding feature:配置一个UNIGINE项目以启用相应的特性

  2. Create and configure a Sandworm project in the Editor, then close the Editor.在编辑器中创建和配置 Sandworm 项目,然后关闭编辑器。

  3. Execute the following command from the command line to start the generation process:在命令行中执行如下命令:

    命令行
    PS D:\projects_location\unigine_project\bin> .\SandwormNode_double_x64.exe --sw_generate project_name.sworm

    where project_name.sworm is your Sandworm project name as shown in the Editor.其中 project_name.sworm 是编辑器中显示的 Sandworm 项目名称。

The landscape is generated into the world that has been set as the export world in the output settings. Any TMS sources used in the project are also downloaded before starting the generation process.在输出设置中,景观生成到设置为 export world 的世界中。在开始生成过程之前,还要下载项目中使用的任何TMS源代码。

警告
The Headless mode doesn't work with distributed computing.Headless 模式不适用于分布式计算。

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或更高的带宽,这可能是由连接到网络的100mb或10mb设备造成的。数据交换速率下降到该设备支持的最大速率,降低了生成速度。
  • 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.检查MasterWorker上的项目是否使用相同的精度(doublefloat)、相同的引擎版本和相同的GDAL版本,否则Worker将显示 Different Builds错误。
  • 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.检查所使用的网络端口MasterWorker允许通过防火墙。
最新更新: 2024-08-16
Build: ()