Water ecological process simulation operation method and system based on Actor model
Through the water ecological process simulation calculation method based on the Actor model, the problems of insufficient number of calculation units of the water ecological process model and insufficient spatial heterogeneity are solved, and efficient and fault-tolerant water ecological process model grid calculation is realized, which improves the calculation efficiency and Accuracy.
Patent Information
- Application Number
- CN202411208890.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-27
AI Technical Summary
The existing water ecological process model has limited number of calculation units and insufficient spatial heterogeneity, which makes it difficult to effectively evaluate the ecological toxicity effect of water bodies, and the traditional sequential calculation model leads to too long evaluation time and calculation failure.
Using the water ecological process simulation operation method based on the Actor model, the computing node resources are monitored through the resource manager and the node manager, multiple task units correspond to the grid computing unit, and tasks are executed through the load balancing mechanism to dynamically increase the computing node resources. , realize fault tolerance and efficiency of grid computing.
It effectively solves the hardware failure problem in grid computing of water ecological process models, improves calculation efficiency and accuracy, improves fault tolerance, and realizes the practicality of ultra-large-scale computing.
Smart Images

Figure CN119201428A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computing demand processing technology, and in particular to a water ecological process simulation operation method and system based on an Actor model. Background Art
[0002] Although the dose of trace pollutants in water bodies is very low, they are toxic to aquatic organisms due to their bioaccumulation and amplification effects, which in turn have serious impacts on the ecosystem. Therefore, it is urgent to carry out ecological risk assessment for target water bodies, establish a quantitative relationship between pollutant concentrations and ecological effects, and evaluate the harmful effects of environmental pollutants on ecosystems or organisms. Water ecological process models can provide quantitative analysis methods for pollutant concentrations and population ecological effects at the ecosystem scale. Therefore, the application of water ecological process models to ecosystem-scale risk assessment is the most important technical approach and the development trend of regional water environment ecological risk assessment.
[0003] The number of computational units in existing water ecological process models is limited to one, that is, the entire target water body is assumed to be an independent and uniformly mixed computational unit. However, this assumption is obviously not in line with the actual water situation, because real water bodies, especially large rivers, lakes, and reservoirs, generally have spatial heterogeneity. Therefore, generalizing the real water body as a single computational unit cannot capture the differences in the ecotoxicological effects of the target water body. In order to take into account this spatial difference, the general consensus is to divide the study water body into a large number of small and dense computational grids, and each grid that reflects spatial heterogeneity will be used as an independent computational unit. Even though this consensus is widely accepted, it is difficult to achieve in practice. The main reasons are: on the one hand, a large number of computational units generate a large amount of computational work, and the traditional sequential calculation mode often leads to a long evaluation time; on the other hand, local computational failures cause the overall calculation process to fail. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the related art. To this end, the present invention provides a water ecological process simulation operation method and system based on the Actor model.
[0005] The first aspect of the present invention provides a water ecological process simulation calculation method based on the Actor model, comprising:
[0006] S1: Establish a resource manager and a node manager corresponding to each computing node, and monitor the resource status of the computing node through the node manager and the resource manager;
[0007] S2: multiple task units are established from a single computing node, wherein a single task unit corresponds to a single grid computing unit of the water ecological process model;
[0008] S3: Map the computing tasks corresponding to each grid computing unit of the water ecological process model to tasks to be executed, and synchronously update the configuration files of the tasks to be executed and the task units;
[0009] S4: According to the resource situation, the resource manager and the node manager are used to maintain load balancing of multiple task units, and multiple tasks to be executed are respectively executed by multiple load-balanced task units to obtain calculation results.
[0010] According to the water ecological process simulation operation method based on the Actor model provided by the present invention, the resource manager in step S1 is ResourceManager Actor, and the node manager is NodeManager Actor.
[0011] According to a water ecological process simulation calculation method based on the Actor model provided by the present invention, the resource situation in step S1 includes the resource consumption of the computing node and the progress of the model calculation, and the resource situation is reported to the resource manager by the node manager through the heartbeat method.
[0012] According to a water ecological process simulation operation method based on an Actor model provided by the present invention, in step S2, the expression of the number of task units corresponding to a single computing node is:
[0013] N T =N C -1;
[0014] Among them, N T The number of task units established for the current computing node, N C The number of CPU cores in the current computing node.
[0015] According to a water ecological process simulation operation method based on an Actor model provided by the present invention, in step S3, the step of synchronously updating the configuration files of the tasks to be executed and the task units further includes:
[0016] S31: When a task unit is established, the node manager sends different model configuration messages to multiple task units;
[0017] S32: The task unit stores the model configuration messages in sequence into a temporary mailbox;
[0018] S33: The task to be executed receives the model configuration message through the temporary mailbox, and applies for a temporary workspace according to the model configuration message;
[0019] S34: The task to be executed pulls the configuration file of the corresponding water ecological process model from the shared resources of the Actor system and updates the configuration file of the task unit.
[0020] According to the water ecological process simulation calculation method based on the Actor model provided by the present invention, the calculation result in step S4 is sent by the task unit to the shared resources of the Actor system through the TCP protocol.
[0021] According to the method for simulating water ecological processes based on the Actor model provided by the present invention, step S4 further includes:
[0022] S41: When the task unit completes the operation of the task to be executed, the temporary workspace corresponding to the task to be executed is released.
[0023] According to the method for simulating water ecological processes based on the Actor model provided by the present invention, step S4 also includes:
[0024] S421: When the operation of the task to be executed fails, the node manager generates an abnormal heartbeat message in response to the operation failure;
[0025] S422: The resource manager receives the abnormal heartbeat message, locates and releases the temporary workspace corresponding to the task to be executed that has failed in operation.
[0026] According to the method for simulating water ecological processes based on the Actor model provided by the present invention, step S4 also includes:
[0027] S431: When a computing node fails, a node manager corresponding to the failed computing node responds to the computing node failure;
[0028] S432: The resource manager recycles the unfinished tasks to be executed corresponding to the failed computing node;
[0029] S433: The resource manager allocates the recovered unfinished tasks to be executed to other computing nodes according to the resource conditions of other computing nodes, and the reallocated computing nodes continue to execute the unfinished tasks to be executed.
[0030] A second aspect of the present invention provides a water ecological process simulation computing system based on an Actor model, which is used to execute a water ecological process simulation computing method based on an Actor model as described in any one of the above, including:
[0031] A mapping module, the mapping module is used to map the computing tasks corresponding to each grid computing unit of the water ecological process model to tasks to be executed;
[0032] Task unit: Multiple task units are set in each computing node of the Actor system, and multiple task units execute multiple tasks to be executed respectively;
[0033] Node managers, where multiple node managers respectively manage the resource status of multiple computing nodes of the Actor system and the execution progress of tasks to be executed, and upload the resource status and the execution progress to the resource manager via heartbeat mode;
[0034] Resource manager, which is used to manage multiple computing nodes of the Actor system and maintain load balancing among multiple computing nodes.
[0035] The present invention provides an Actor model-based water ecological process simulation operation method and system, which are suitable for grid computing of water ecological process models of ultra-large scale, have strong practicality, and can effectively solve the hardware failure problem existing in grid computing of water ecological process models. Compared with the traditional sequential grid computing method, the present invention can dynamically increase computing node resources without affecting normal computing. In addition, the present invention proposes to map grid computing with the Actor system, convert multiple independent grid computing tasks into independent Actor objects, and robustly and effectively solve the scale computing problem of the water ecological process model. Overall, it can improve the fault tolerance of water ecological process simulation, and improve computing efficiency and accuracy.
[0036] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 It is a flow chart of a water ecological process simulation operation method based on an Actor model provided by an embodiment of the present invention;
[0039] Figure 2 It is a schematic diagram of the structure of a water ecological process simulation computing system based on the Actor model provided in an embodiment of the present invention.
[0040] Reference numerals:
[0041] 100, mapping module; 200, computing node; 210, task unit; 300, node manager; 400, resource manager. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.
[0043] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0044] In order to better understand the present invention, the technical terms appearing in the embodiments of the present invention are first explained below.
[0045] The Actor model is a mathematical model for handling concurrent computing. It uses the Actor object as a common primitive for concurrent computing. In the Actor system, everything can play an Actor, and Actors can be completely independent of each other. All actions taken by an Actor when receiving a message are parallel, and there is no clear order for actions in a method. In the Actor model, an Actor is the smallest system unit, consisting of three parts: state, behavior, and mailbox. The state refers to the variables of the object, which are managed by the Actor itself, effectively avoiding the atomicity problems of locks and memory in a concurrent environment; behavior refers to the calculation logic, which changes its own state by receiving messages; the mailbox is a bridge for communication between Actors. Actors are independent of each other and can only communicate through messages. Actors constantly process the messages received in their own mailboxes to perform operations and change their internal states. Therefore, the message sender and the receiver are separated. This separation leads to the inherent concurrency of the Actor system. In addition, fault tolerance is another outstanding advantage of the Actor model. The supervision mechanism ensures that parent-child dependencies are established between Actors, which will hand over the failure control to the supervisor parent object, making it suitable for use in parallel processing.
[0046] Combine the following Figure 1 to Figure 2 Embodiments of the present invention are described.
[0047] The first aspect of the present invention provides a water ecological process simulation calculation method based on an Actor model, comprising:
[0048] S1: Establish a resource manager and a node manager corresponding to each computing node, and monitor the resource status of the computing node through the node manager and the resource manager;
[0049] The resource manager in step S1 is ResourceManager Actor, and the node manager is NodeManager Actor.
[0050] The resource situation in step S1 includes the resource consumption of the computing node and the progress of the model calculation, and the resource situation is reported to the resource manager by the node manager through the heartbeat method.
[0051] In step S1, first, a ResourceManager Actor is created in the Actor system as the Master Manager of the entire Actor cluster system. It is responsible for monitoring the resource usage of each computing node in the entire cluster, assigning computing tasks to each computing node, and receiving the fault information submitted upward by the faulty node when a computing node fails. It is also responsible for recovering the operation, restarting, or completely terminating the computing node.
[0052] Furthermore, a NodeManagerActor is created on each computing node in the Actor system as the node manager of the Actor cluster system. It is responsible for monitoring the computing node resource usage and the progress of model calculation, and sends the above information to the ResourceManagerActor in the form of heartbeats, reporting the node calculation status to the ResourceManagerActor at all times.
[0053] S2: multiple task units are established from a single computing node, wherein a single task unit corresponds to a single grid computing unit of the water ecological process model;
[0054] In step S2, the expression for the number of task units corresponding to a single computing node is:
[0055] N T =N C -1;
[0056] Among them, N T The number of task units established for the current computing node, N CThe number of CPU cores in the current computing node.
[0057] Furthermore, the specific steps in step S2 are as follows: on a computing node, the current NodeManagerActor collects the number of CPU cores of the node, marked as nCores; then, nCores-1 TaskActors are created on the computed node, and each TaskActor corresponds to a grid computing unit.
[0058] S3: Map the computing tasks corresponding to each grid computing unit of the water ecological process model to tasks to be executed, and synchronously update the configuration files of the tasks to be executed and the task units;
[0059] Among them, in step S3, the step of synchronously updating the configuration files of the tasks to be executed and the task units further includes:
[0060] S31: When a task unit is established, the node manager sends different model configuration messages to multiple task units;
[0061] S32: The task unit stores the model configuration messages in sequence into a temporary mailbox;
[0062] S33: The task to be executed receives the model configuration message through the temporary mailbox, and applies for a temporary workspace according to the model configuration message;
[0063] S34: The task to be executed pulls the configuration file of the corresponding water ecological process model from the shared resources of the Actor system and updates the configuration file of the task unit.
[0064] In steps S31 to S34, NodeManagerActor first sends different model configuration messages to the created TaskActors. After receiving the message, it is stored in a mailbox. The messages are stored and processed in a sequential manner to avoid the occurrence of race conditions. The subsequently created TaskActor receives the model configuration message in the mailbox, starts to apply for a temporary workspace on the local node, and then downloads the water ecology model executable program and its model configuration file from the Actor system shared resources, and then updates the model configuration file based on the received model configuration information.
[0065] S4: According to the resource situation, the resource manager and the node manager are used to maintain load balancing of multiple task units, and multiple tasks to be executed are respectively executed by multiple load-balanced task units to obtain calculation results.
[0066] After step S3, that is, after updating the configuration file and obtaining the temporary workspace, the water ecology model executable program is started, the model is run in the temporary workspace, and the model calculation status information is regularly sent to the local NodeManager. One TaskActor is responsible for the calculation life cycle management of a water ecology process model.
[0067] When maintaining load balancing, NodeManagerActor will periodically send information to ResourceManagerActor, mainly including two types of messages. One is the resource usage of the computing node. When it is determined that the computing node has available computing resources, ResourceManagerActor assigns new computing tasks to NodeManagerActor. The other is the heartbeat information of the computing node. When it is determined that NodeManagerActor is unavailable, ResourceManagerActor will try to handle the NodeManagerActor exception.
[0068] The calculation result in step S4 is sent by the task unit to the shared resources of the Actor system via the TCP protocol.
[0069] Wherein, step S4 also includes:
[0070] S41: When the task unit completes the operation of the task to be executed, the temporary workspace corresponding to the task to be executed is released.
[0071] Furthermore, when TaskActor successfully completes the water ecology model calculation, after sending the calculation results to the Actor system shared storage resources via TCP protocol, it will release the temporary computing space where TaskActor is located and send a message to NodeManagerActor. NodeManager will clean up the TaskActor and recreate a new TaskActor and assign the corresponding computing tasks.
[0072] Wherein, step S4 also includes:
[0073] S421: When the operation of the task to be executed fails, the node manager generates an abnormal heartbeat message in response to the operation failure;
[0074] S422: The resource manager receives the abnormal heartbeat message, locates and releases the temporary workspace corresponding to the task to be executed that has failed in operation.
[0075] Furthermore, when the computing task of TaskActor fails, or when a software or hardware exception occurs, TaskActor will not be able to send heartbeat information to NodeManagerActor on time. NodeManagerActor will locate the space (temporary directory) where the TaskActor calculation is executed based on the abnormal heartbeat information, release the temporary computing space where the TaskActor is located, and send a recycling message to NodeManagerActor. NodeManager will clean up the TaskActor and recreate a new TaskActor to re-execute the model calculation.
[0076] Wherein, step S4 also includes:
[0077] S431: When a computing node fails, a node manager corresponding to the failed computing node responds to the computing node failure;
[0078] S432: The resource manager recycles the unfinished tasks to be executed corresponding to the failed computing node;
[0079] S433: The resource manager allocates the recovered unfinished tasks to be executed to other computing nodes according to the resource conditions of other computing nodes, and the reallocated computing nodes continue to execute the unfinished tasks to be executed.
[0080] When an exception occurs in a task of a computing node, NodeManagerActor will recycle the unfinished task and send it back to the task pool of ResourceManagerActor, which will redistribute it to the NodeManagerActor in the cluster, thus ensuring that the cluster has strong fault tolerance.
[0081] When a computing node, namely NodeManagerActor, fails, ResourceManagerActor will recycle the unfinished tasks of the failed machine node back to ResourceManagerActor, and reallocate the tasks according to the resource usage of other nodes to achieve load balancing of computing tasks. The cluster does not need to be restarted and the simulation process will not be interrupted, thus ensuring the fault tolerance of the cluster.
[0082] When new machine nodes are added to the cluster, ResourceManagerActor will distribute the unfinished tasks in the task pool to the newly added computing nodes to achieve load balancing of computing tasks. The cluster does not need to be restarted and the simulation process will not be interrupted, thus ensuring the scalability of the cluster.
[0083] A second aspect of the present invention provides a water ecological process simulation computing system based on an Actor model, which is used to execute a water ecological process simulation computing method based on an Actor model as described in any one of the above, including:
[0084] A mapping module 100, which is used to map the computing tasks corresponding to each grid computing unit of the water ecological process model into tasks to be executed;
[0085] Task unit 210, multiple task units 210 are set in each computing node 200 of the Actor system, and the multiple task units 210 respectively execute multiple tasks to be executed;
[0086] Figure 2 The diagram is only an example system diagram. In actual system operation, this system should include multiple computing nodes. Figure 2 The illustrated plurality of task units includes task unit (0, 0) to task unit unit (4, 4).
[0087] A node manager 300, wherein the plurality of node managers 300 respectively manage the resource conditions of the plurality of computing nodes 200 of the Actor system and the execution progress of the tasks to be executed, and upload the resource conditions and the execution progress to the resource manager 400 via a heartbeat method;
[0088] The resource manager 400 is used to manage the multiple computing nodes 200 of the Actor system and maintain the load balance of the multiple computing nodes 200.
[0089] When the water ecological process simulation operation system based on the Actor model provided by the present invention is running, it is first necessary to build an Actor cluster environment. Specifically, the Akka library of the Scala language implements the Actor model, which draws on the implementation of the Actor model of Erlang and introduces many new features, providing a powerful tool for concurrent programming. Akka is an excellent distributed concurrent framework developed in the Scala language and runs on the Java virtual machine. It also supports programming using JVM-based languages such as Scala, Java and Kotlin. The Actor in Akka is a higher-level abstraction than a thread, and ultimately runs in a Java thread. Multiple Actors can share a thread at the bottom layer.
[0090] When using Akka for concurrent programming, you don't have to worry about the problems faced by traditional multi-threaded programming, such as underlying threads, locks, and shared data conflicts. Akka provides a wealth of components, such as mailboxes, routing components, persistence components, etc., and provides a high and unified abstraction of distributed and parallel modes at the bottom layer. A complete high-concurrency distributed application can be implemented with a small amount of code.
[0091] Akka programs are composed of multiple Actors. Its working principle is to divide a large computing task into many small tasks, and then assign these tasks to multiple Actors for calculation. Actors can not only run in the current JVM, but also run on any machine across JVMs. This is the key to the distributed computing of Akka programs. In addition, Akka provides supervision and monitoring of various Actor roles, various computing management strategies and methods, including fault tolerance mechanisms, built-in thread management, remote operation management (remoting), etc., as well as a distributed messaging system to coordinate and control the safe operation of the overall operation. The installation of Akka cluster software includes operating system, Scala environment, AKKA software package, etc.
[0092] In addition, the supervision mechanism of the Actor model is organized in a hierarchical structure. In the application logic system, the first level is the resource manager ResourceManagerActor. There is only one in the entire Actor system, and the location is specified by the user. It is responsible for the decomposition, allocation and cluster computing node computing resource management of the water ecology model computing tasks. As its backup, there is only one SecondaryResourceManagerActor in the entire Actor system, and the location is specified by the user; the second level is the computing node manager, which is located in the computing node and named NodeManagerActor. There are multiple in the entire Actor system, the number is the number of computing nodes, and it is responsible for the distribution, execution, tracking and computing resource supervision of the computing task of this node; the third level is the computing task executor TaskActor, which is the executor of the water ecology process model calculation. There are multiple in the entire Actor system, the number is the product of the number of all computing nodes and the number of computing cores of the node-1, and it is responsible for the startup, computing execution and status tracking of a single water ecology model computing process.
[0093] The Actor is then constructed. Specifically, in order to support the system fault tolerance and fault recovery capabilities of the Actor model, the supervision mechanism of the Actor model is organized in a hierarchical structure, that is, the parent Actor creates the child Actor. In addition to maintaining its own status, the parent Actor is responsible for the exceptions that occur in the next layer of Actor, forming a tree-like parent-child hierarchical supervision structure. On the specific operational level, the parent Actor is constructed through the Props property of AKKA, and the child Actor is constructed in the constructor of the parent Actor class instead of in the message processing function. The benefit of this design is that when the parent Actor is created, its child Actor is automatically constructed. When the Actor system fails and needs to be destroyed, the parent Actor will be destroyed together with its child Actor, which is very beneficial to the fault-tolerant design of concurrent programs.
[0094] Secondly, the Actor system is constructed. Specifically, the original intention of the Actor model is to solve the problem of parallel processing. It splits a set of complex functions into different Actors. Different Actors can complete different logics. Actors interact by passing messages. This is different from method calls. Actors do not need to wait for returns after sending messages, so Actors can continue to execute immediately after sending messages, which avoids blocking. In addition, an Actor can only process one message at a time, and the message is immutable, so there is no need for locks. Therefore, when using the Actor model to design a system, the system functions can be split according to the process and split into a bunch of various Actors. In order to manage various Actors in a unified way, a container is usually required. This container is called an Actor System. One or more Actor Systems can be flexibly created on each computing node, and Actors in multiple Actor Systems can communicate through messages.
[0095] In this embodiment, as described in the principle of the above-mentioned method for simulating the operation of water ecological processes based on the Actor model, the core of the mapping between the water ecological process model grid computing system and the Actor system is to map the model calculation on each grid unit to an independent TaskActor. After this TaskActor is started, it obtains the model input information and the shared model executable program and model configuration file on the grid unit. Once the three types of information are obtained, in the message processing function receive of this TaskActor, the model input information is parsed, the model configuration file is updated, and the model is driven to start calculation at this node. Because the number of grid units is much larger than the number of TaskActors in the cluster, the grid calculation of the water ecological model is performed in multiple iterations in the cluster system. Ideally, the number of grid calculations supported each time is the sum of the product of the number of all computing nodes in the cluster and (the number of node cores-1).
[0096] The grid computing task distribution of the water ecological process model is completed by ResourceManagerActor. It determines whether the computing task can be delegated to each computing node based on the heartbeat information sent by each computing node. If it can, it extracts the unfinished computing grid information from the task pool and sends it to NodeManagerActor. If it is found that the computing node has no excess computing resources, then ignore this message until the computing node has available resources.
[0097] ResourceManagerActor is created by the Actor System object. In the entire Actor cluster, there is only one ResourceManagerActor. When an exception occurs in the secondary Actor, the cluster will randomly select a computing node to recreate a replacement as a replacement to ensure the fault tolerance of the cluster.
[0098] NodeManagerActor is created by Actor System object. There is only one NodeManagerActor per computing node, which is responsible for creating (number of node cores - 1) TaskActors. NodeManagerActor sends heartbeat information to ResourceManagerActor regularly to receive grid computing tasks.
[0099] TaskActor is created by NodeManagerActor object. Multiple TaskActors on each computing node receive grid computing tasks assigned by NodeManagerActor.
[0100] Since the water ecological process model grids are calculated independently, there is no communication between TaskActors. The states of the actors are independent, and each actor only manages its own state. All communication between actors uses immutable messages, which provides very good security and robustness for the program. TaskActor only communicates with its parent actor, the NodeManagerActor. All NodeManagerActors communicate with the only ResourceManagerActor. This communication mode is conducive to ensuring the fault tolerance of the cluster, while simplifying the program design and implementation of parallel systems.
[0101] Furthermore, the implementation effect of a water ecological process simulation calculation method and system based on the Actor model provided by the present invention is described below in a specific embodiment.
[0102] Assuming that the total number of model grids is 10,000 and the calculation time of a single grid is t, then the traditional sequential calculation requires time Tt=10,000 / 1t. When the water ecological model cluster computing method is adopted, it is assumed that the total number of computing node cores in the cluster is 100. Considering the extreme case of thread resource preemption on a single computing node, assuming that the calculation time of a single grid is 1.5t, the cluster calculation requires time Ct=10,000 / (100)×1.5t. The acceleration ratio obtained by the cluster is 66.7, that is, when there are 100 computing cores, a acceleration ratio of 66.7 can be obtained, which proves that the cluster mode in the method and system provided by the present invention can improve the calculation speed of the water ecological process model.
[0103] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A water ecological process simulation calculation method based on Actor model, characterized in that: include: S1: Establish a resource manager and a node manager corresponding to each computing node, and monitor the resource status of the computing node through the node manager and the resource manager; S2: multiple task units are established from a single computing node, wherein a single task unit corresponds to a single grid computing unit of the water ecological process model; S3: Map the computing tasks corresponding to each grid computing unit of the water ecological process model to tasks to be executed, and synchronously update the configuration files of the tasks to be executed and the task units; S4: According to the resource situation, the resource manager and the node manager are used to maintain load balancing of multiple task units, and multiple tasks to be executed are respectively executed by multiple load-balanced task units to obtain calculation results.
2. According to claim 1, a method for simulating water ecological processes based on an Actor model is characterized in that: The resource manager in step S1 is ResourceManager Actor, and the node manager is NodeManager Actor.
3. The method for simulating water ecological processes based on the Actor model according to claim 1 is characterized in that: The resource situation in step S1 includes the resource consumption of the computing node and the progress of the model calculation. The resource situation is reported to the resource manager by the node manager through the heartbeat method.
4. The method for simulating water ecological processes based on the Actor model according to claim 1 is characterized in that: In step S2, the expression for the number of task units corresponding to a single computing node is: N T =N C -1; Among them, N T The number of task units established for the current computing node, N C The number of CPU cores in the current computing node.
5. The method for simulating water ecological processes based on the Actor model according to claim 1 is characterized in that: In step S3, the step of synchronously updating the configuration files of the tasks to be executed and the task units further includes: S31: When a task unit is established, the node manager sends different model configuration messages to multiple task units; S32: The task unit stores the model configuration messages in sequence into a temporary mailbox; S33: The task to be executed receives the model configuration message through the temporary mailbox, and applies for a temporary workspace according to the model configuration message; S34: The task to be executed pulls the configuration file of the corresponding water ecological process model from the shared resources of the Actor system and updates the configuration file of the task unit.
6. The method for simulating water ecological processes based on the Actor model according to claim 1 is characterized in that: The calculation result in step S4 is sent by the task unit to the shared resources of the Actor system via the TCP protocol.
7. The method for simulating water ecological processes based on the Actor model according to claim 5 is characterized in that: Step S4 also includes: S41: When the task unit completes the operation of the task to be executed, the temporary workspace corresponding to the task to be executed is released.
8. The method for simulating water ecological processes based on the Actor model according to claim 5 is characterized in that: Step S4 also includes: S421: When the operation of the task to be executed fails, the node manager generates an abnormal heartbeat message in response to the operation failure; S422: The resource manager receives the abnormal heartbeat message, locates and releases the temporary workspace corresponding to the task to be executed that has failed in operation.
9. The method for simulating water ecological processes based on the Actor model according to claim 1 is characterized in that: Step S4 also includes: S431: When a computing node fails, a node manager corresponding to the failed computing node responds to the computing node failure; S432: The resource manager recycles the unfinished tasks to be executed corresponding to the failed computing node; S433: The resource manager allocates the recovered unfinished tasks to be executed to other computing nodes according to the resource conditions of other computing nodes, and the reallocated computing nodes continue to execute the unfinished tasks to be executed.
10. A water ecological process simulation computing system based on an Actor model, used to execute a water ecological process simulation computing method based on an Actor model as claimed in any one of claims 1 to 9, characterized in that: include: A mapping module, the mapping module is used to map the computing tasks corresponding to each grid computing unit of the water ecological process model to tasks to be executed; Task unit: Multiple task units are set in each computing node of the Actor system, and multiple task units execute multiple tasks to be executed respectively; Node managers, where multiple node managers respectively manage the resource status of multiple computing nodes of the Actor system and the execution progress of tasks to be executed, and upload the resource status and the execution progress to the resource manager via heartbeat mode; Resource manager, which is used to manage multiple computing nodes of the Actor system and maintain load balancing among multiple computing nodes.