Land surface computing task allocation method and device, equipment, medium and product
Patent Information
- Application Number
- CN202510223769.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2045-02-27
AI Technical Summary
[0004]但是,相关技术中,直接根据多个网格的网格数,将多个网格对应的陆面计算任务,均分给多个CPU核的方式,存在多个CPU核之间负载不均衡的问题
[0076]处理器执行存储器存储的计算机执行指令,以实现如第一方面的方法。
Smart Images

Figure CN120179384B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of earth sciences, and in particular to a method, apparatus, equipment, medium, and product for allocating land surface computing tasks. Background Technology
[0002] In the field of Earth science, land surface models are used to simulate physical processes related to vegetation cover, including hydrological cycle variables such as surface runoff, baseflow, vegetation canopy evaporation, and soil evaporation. They can also be applied to the study of land surface processes such as permafrost, forest fires, and urban canopy.
[0003] In related technologies, in the land surface model, the Earth's land surface needs to be divided into multiple grids based on latitude and longitude. According to the number of grids, the land surface computing tasks corresponding to multiple grids are evenly distributed to multiple central processing units (CPUs) cores so that multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to multiple grids.
[0004] However, in related technologies, the method of directly distributing the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the number of grids has the problem of uneven load among multiple CPU cores. Summary of the Invention
[0005] This application provides a method, apparatus, device, medium, and product for allocating computing tasks on the land surface, which improves the load balancing among multiple CPU cores.
[0006] In a first aspect, this application provides a method for allocating land surface computing tasks, including:
[0007] In response to the allocation request, the Earth's land surface is divided into multiple grids;
[0008] Obtain at least one land cover type corresponding to the grid;
[0009] Determine the number of subgrids corresponding to a grid based on at least one land cover type;
[0010] Calculate the total number of subgrids based on the number of subgrids corresponding to each grid.
[0011] Obtain the land surface computation tasks corresponding to each grid;
[0012] Based on the total number of subgrids, the land surface computing tasks corresponding to multiple grids are allocated to multiple central processing unit (CPU) cores, so that multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to multiple grids.
[0013] In this scheme, electronic devices can respond to allocation requests by dividing the Earth's land surface into multiple grids. For each grid, the electronic device can obtain at least one land cover type corresponding to the grid and determine the number of sub-grids corresponding to that grid based on the at least one land cover type. The electronic device can calculate the total number of sub-grids based on the number of sub-grids corresponding to each grid, and allocate the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the total number of sub-grids, so that multiple CPU cores can perform computing tasks on the land surface corresponding to multiple grids. Through the above allocation method of land surface computing tasks, on the one hand, the load balance among multiple CPU cores can be improved, thereby improving the overall computing efficiency of all land surface computing tasks; on the other hand, the memory usage balance among multiple CPU cores can be improved.
[0014] In one implementation, determining the number of subgrids corresponding to a grid based on at least one land cover type includes:
[0015] Obtain the area corresponding to each surface cover type;
[0016] The number of subgrids corresponding to each land cover type is determined based on the area corresponding to each land cover type.
[0017] Calculate the number of subgrids corresponding to each grid based on the number of subgrids corresponding to each surface cover type.
[0018] In this scheme, by using the area corresponding to each surface cover type to determine the number of subgrids, the accuracy of determining the number of subgrids is improved. This allows the allocation method of distributing land surface computing tasks corresponding to multiple grids based on the total number of subgrids (the sum of the number of subgrids corresponding to multiple grids) to improve the load balance among multiple CPU cores and the memory usage balance among multiple CPU cores.
[0019] In one implementation, the number of subgrids corresponding to each land cover type is determined based on the area proportion corresponding to each land cover type, including:
[0020] Obtain the load factor corresponding to each surface coverage type;
[0021] The number of subgrids corresponding to each surface cover type is determined based on the load factor corresponding to each surface cover type and the area corresponding to each surface cover type.
[0022] In this scheme, by using the area and load coefficient corresponding to each surface cover type to determine the number of subgrids, the accuracy of determining the number of subgrids corresponding to each grid is further improved. This allows the allocation method of assigning land surface computing tasks to multiple grids based on the total number of subgrids to improve the load balance among multiple CPU cores and the memory usage balance among multiple CPU cores.
[0023] In one implementation, based on the total number of subgrids, the land surface computation tasks corresponding to multiple grids are allocated to multiple central processing unit (CPU) cores, including:
[0024] For the nth CPU core, determine whether the index value of the nth CPU core is greater than the target index value; where n is a positive integer from 1 to N; and N is the total number of CPU cores.
[0025] If so, then based on the number of grids corresponding to each CPU core, the land surface computing tasks corresponding to multiple grids will be allocated to multiple CPU cores;
[0026] If not, then calculate the number of CPU cores to be allocated based on the index of the nth CPU core and N;
[0027] Calculate the average number of subgrids to be assigned based on the number of subgrids to be assigned and the number of CPU cores to be assigned;
[0028] Based on the starting position number of the grid to be assigned and the average number of grids in the nth iteration, determine the number of grids corresponding to the nth CPU core;
[0029] The number of subgrids to be assigned and the starting position number of the subgrids to be assigned are updated.
[0030] In this scheme, during the process of allocating land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the total number of sub-grids: For the nth CPU core, the electronic device can determine whether the index value of the nth CPU core is greater than the target index value. If so, the electronic device can allocate the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the number of grids corresponding to each CPU core. If not, the electronic device can calculate the number of CPU cores to be allocated based on the index value of the nth CPU core and N; calculate the nth average number of sub-grids based on the number of sub-grids to be allocated and the number of CPU cores to be allocated; determine the number of grids corresponding to the nth CPU core based on the starting position index of the sub-grids to be allocated and the nth average number of sub-grids; and update the number of sub-grids to be allocated and the starting position index of the sub-grids to be allocated. Through the above allocation method, on the one hand, multiple sub-grids can be evenly distributed to multiple CPU cores, improving the load balance among multiple CPU cores and the memory usage balance among multiple CPU cores; on the other hand, the method of determining the target grid from the grids to be allocated based on the continuously adjusted average number of sub-grids can improve the evenness of allocation.
[0031] In one implementation, the number of grids corresponding to the nth CPU core is determined based on the starting position index of the grid to be assigned and the average number of grids in the nth iteration, including:
[0032] For the j-th grid to be assigned, based on the number of subgrids included in the j-th grid to be assigned, the number of subgrids corresponding to the n-th CPU core is increased to obtain the j-th increased number of subgrids;
[0033] If the number of subgrids after the j-th increment is less than or equal to the average number of subgrids, the number of grids corresponding to the n-th CPU core is incremented by 1; where j is successively 1, 2, ..., until the number of subgrids after the j-th increment is greater than the average number of subgrids; the position number of the first grid to be assigned is the starting position number of the grid to be assigned.
[0034] In this scheme, the electronic device can increment the number of subgrids corresponding to the nth CPU core by 1 if the number of subgrids after the j-th increment is less than or equal to the average number of subgrids. This avoids the number of subgrids included in the grid allocated to a CPU core exceeding the average number of subgrids. In other words, this method achieves an even distribution of subgrids, improving load balancing among multiple CPU cores and memory usage balancing among the corresponding CPU cores.
[0035] In one implementation, land surface computation tasks corresponding to multiple grids are allocated to multiple CPU cores based on the number of grids corresponding to each CPU core, including:
[0036] For any CPU core, determine the first start position number and the first end position number based on the number of grids corresponding to the CPU core;
[0037] The target grid corresponding to the CPU core is determined based on the first starting position number and the first ending position number;
[0038] The land surface computation task corresponding to the target grid is assigned to the CPU core.
[0039] In this scheme, for any CPU core, the electronic device can determine the first starting position number (the starting position number of the target grid corresponding to the CPU core) and the first ending position number (the ending position number of the target grid corresponding to the CPU core) based on the number of grids corresponding to the CPU core. Then, based on the first starting position number and the first ending position number, the target grid corresponding to the CPU core can be determined. The electronic device can then allocate the land surface computation tasks corresponding to the target grid to the CPU core. Through this method, the target grid corresponding to each CPU core can be accurately determined, and thus the land surface computation tasks corresponding to the target grid can be accurately allocated to the CPU core.
[0040] Secondly, embodiments of this application provide a land surface computing task allocation device, comprising:
[0041] The processing module is used to divide the Earth's land surface into multiple grids in response to allocation requests;
[0042] The processing module is also used to obtain at least one land cover type corresponding to the grid;
[0043] The processing module is also used to determine the number of subgrids corresponding to a grid based on at least one land cover type;
[0044] The processing module is also used to calculate the total number of subgrids based on the number of subgrids corresponding to each grid.
[0045] The processing module is also used to obtain the land surface calculation tasks corresponding to each grid.
[0046] The allocation module is used to distribute the land surface computing tasks corresponding to multiple grids to multiple central processing unit (CPU) cores based on the total number of subgrids, so that multiple CPU cores can perform calculations on the land surface computing tasks corresponding to multiple grids.
[0047] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0048] In one implementation, the processing module is specifically used for:
[0049] Obtain the area corresponding to each surface cover type;
[0050] The number of subgrids corresponding to each land cover type is determined based on the area corresponding to each land cover type.
[0051] Calculate the number of subgrids corresponding to each grid based on the number of subgrids corresponding to each surface cover type.
[0052] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0053] In one implementation, the processing module is specifically used for:
[0054] Obtain the load factor corresponding to each surface coverage type;
[0055] The number of subgrids corresponding to each surface cover type is determined based on the load factor corresponding to each surface cover type and the area corresponding to each surface cover type.
[0056] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0057] In one implementation, the allocation module is specifically used for:
[0058] For the nth CPU core, determine whether the index value of the nth CPU core is greater than the target index value; where n is a positive integer from 1 to N; and N is the total number of CPU cores.
[0059] If so, then based on the number of grids corresponding to each CPU core, the land surface computing tasks corresponding to multiple grids will be allocated to multiple CPU cores;
[0060] If not, then calculate the number of CPU cores to be allocated based on the index of the nth CPU core and N;
[0061] Calculate the average number of subgrids to be assigned based on the number of subgrids to be assigned and the number of CPU cores to be assigned;
[0062] Based on the starting position number of the grid to be assigned and the average number of grids in the nth iteration, determine the number of grids corresponding to the nth CPU core;
[0063] The number of subgrids to be assigned and the starting position number of the subgrids to be assigned are updated.
[0064] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0065] In one implementation, the allocation module is specifically used for:
[0066] For the j-th grid to be assigned, based on the number of subgrids included in the j-th grid to be assigned, the number of subgrids corresponding to the n-th CPU core is increased to obtain the j-th increased number of subgrids;
[0067] If the number of subgrids after the j-th increment is less than or equal to the average number of subgrids, the number of grids corresponding to the n-th CPU core is incremented by 1; where j is successively 1, 2, ..., until the number of subgrids after the j-th increment is greater than the average number of subgrids; the position number of the first grid to be assigned is the starting position number of the grid to be assigned.
[0068] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0069] In one implementation, the allocation module is specifically used for:
[0070] For any CPU core, determine the first start position number and the first end position number based on the number of grids corresponding to the CPU core;
[0071] The target grid corresponding to the CPU core is determined based on the first starting position number and the first ending position number;
[0072] The land surface computation task corresponding to the target grid is assigned to the CPU core.
[0073] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0074] Thirdly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0075] The memory stores instructions that the computer executes;
[0076] The processor executes computer-executable instructions stored in memory to implement the method as described in the first aspect.
[0077] The electronic device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be repeated here.
[0078] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method as described in the first aspect.
[0079] When the computer-executable instructions in the computer-readable storage medium provided in this application are executed by a processor, the technical solutions shown in the above method embodiments can be implemented. The implementation principle and beneficial effects are similar, and will not be repeated here.
[0080] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the method of the first aspect.
[0081] When the computer program in the computer program product provided in this application is executed by a processor, it can implement the technical solution shown in the above method embodiments. The implementation principle and beneficial effects are similar, and will not be repeated here. Attached Figure Description
[0082] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0083] Figure 1 A schematic diagram illustrating a method for allocating land surface computing tasks according to an embodiment of this application;
[0084] Figure 2 A flowchart illustrating an embodiment of a method for allocating land surface computing tasks provided in this application;
[0085] Figure 3a A flowchart illustrating a second embodiment of a land surface computation task allocation method provided in this application;
[0086] Figure 3b A schematic diagram illustrating a speedup ratio provided in an embodiment of this application;
[0087] Figure 3c A schematic diagram illustrating another speedup ratio provided in an embodiment of this application;
[0088] Figure 4 A flowchart illustrating a third embodiment of a land surface computation task allocation method provided in this application;
[0089] Figure 5 A flowchart illustrating a method for allocating land surface computing tasks according to an embodiment of this application, in embodiment four.
[0090] Figure 6 A schematic diagram of a land surface computing task allocation device provided in an embodiment of this application;
[0091] Figure 7 This is a structural diagram of an electronic device provided in this application.
[0092] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0093] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0094] It should be noted that the methods, apparatus, equipment, media and products for allocating land surface computing tasks in this application can be used in the field of earth sciences, or in any field other than earth sciences. This application does not limit the application fields of the methods, apparatus, equipment, media and products for allocating land surface computing tasks.
[0095] In the field of Earth science, land surface models are used to simulate physical processes related to vegetation cover, including hydrological cycle variables such as surface runoff, baseflow, vegetation canopy evaporation, and soil evaporation. They can also be applied to the study of land surface processes such as permafrost, forest fires, and urban canopy.
[0096] In related technologies, in the land surface model, the Earth's land surface needs to be divided into multiple grids based on latitude and longitude. According to the number of grids, the land surface computing tasks corresponding to multiple grids are evenly distributed to multiple central processing units (CPUs) cores so that multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to multiple grids.
[0097] However, in related technologies, the method of directly distributing the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the number of grids has the problem of uneven load among multiple CPU cores.
[0098] Based on the aforementioned technical problems, the technical concept of this application embodiment is as follows: For each grid, the electronic device can obtain at least one land cover type corresponding to the grid, and determine the number of sub-grids corresponding to the grid based on the at least one land cover type. The electronic device can calculate the total number of sub-grids based on the number of sub-grids corresponding to each grid, and allocate the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the total number of sub-grids.
[0099] The above-mentioned method of allocating land-based computing tasks improves the load balancing among multiple CPU cores.
[0100] The following is a detailed description of a method for allocating land surface computing tasks provided in the embodiments of this application.
[0101] To facilitate understanding, let's first combine... Figure 1 The application scenarios involved in the embodiments of this application are described.
[0102] Figure 1 This is a schematic diagram illustrating a method for allocating land surface computing tasks according to an embodiment of this application.
[0103] like Figure 1 As shown, the scenario includes a terminal device 10, an electronic device 20, and at least one server. For example, Figure 1 Four servers are shown: server 30, server 40, server 50, and server 60.
[0104] Electronic device 20 can communicate with terminal device 10 and at least one server respectively.
[0105] It should be noted that the electronic device 20 can be a server, a server cluster, or a terminal device (such as a computer), and this application embodiment does not limit this. It should also be noted that when the electronic device 20 is a terminal device, the electronic device 20 can be integrated with the terminal device 10 into a single device.
[0106] It should also be noted that, for any given server, the server may include at least one CPU core (exemplary, Figure 1 (This shows that each server includes two CPU cores).
[0107] In this application scenario, electronic device 20 can respond to an allocation request by dividing the Earth's land surface into multiple grids. The allocation request can be sent by terminal device 10.
[0108] Electronic device 20 can acquire at least one land cover type corresponding to the grid.
[0109] Electronic device 20 can determine the number of subgrids corresponding to a grid based on at least one land cover type.
[0110] Electronic device 20 can calculate the total number of subgrids based on the number of subgrids corresponding to each grid.
[0111] Electronic device 20 can acquire the land surface calculation tasks corresponding to each grid.
[0112] The electronic device 20 can allocate land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the total number of subgrids, so that multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to multiple grids. It should be noted that multiple CPU cores belong to at least one server.
[0113] It should be noted that, Figure 1 This is merely a schematic diagram illustrating one application scenario provided by an embodiment of this application. This embodiment does not necessarily represent... Figure 1 The actual form of the various components included is not limited, nor is the actual form of the components included defined. Figure 1 The interaction methods between components are limited, and can be set according to actual needs in the application of the solution.
[0114] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0115] Figure 2 A flowchart illustrating an embodiment of a land surface computation task allocation method provided in this application is shown below. Figure 2 As shown, the method includes the following steps:
[0116] S201: In response to the allocation request, the Earth's land surface is divided into multiple grids.
[0117] In this embodiment, the Earth's surface includes the Earth's land surface and the Earth's oceans.
[0118] Electronic devices can receive allocation requests sent by terminal devices.
[0119] Electronic devices can respond to allocation requests by dividing the Earth's land surface into multiple grids.
[0120] In one implementation, electronic devices divide the Earth's land surface into multiple grids based on latitude and longitude.
[0121] S202: Obtain at least one land cover type corresponding to the grid.
[0122] In this embodiment, for any given grid, the electronic device can obtain at least one type of land cover corresponding to that grid.
[0123] In one implementation, the grid can correspond to 100 land cover types.
[0124] For example, the land cover type can be wetland; as another example, the land cover type can be river.
[0125] S203: Determine the number of subgrids corresponding to a grid based on at least one land cover type.
[0126] In this embodiment, the electronic device can determine the number of subgrids corresponding to a grid based on at least one land cover type.
[0127] In one implementation,
[0128] Electronic devices can obtain the area corresponding to the surface cover type in various places.
[0129] Electronic devices can determine the number of subgrids corresponding to each surface cover type based on the area corresponding to each surface cover type.
[0130] Electronic devices can calculate the number of subgrids corresponding to a grid based on the number of subgrids corresponding to the surface cover type in each region.
[0131] In one implementation,
[0132] Electronic devices can obtain the area corresponding to the surface cover type in various places.
[0133] Electronic devices can obtain the load factor corresponding to the surface coverage type in each region.
[0134] Electronic devices can determine the number of subgrids corresponding to each surface coverage type based on the load factor corresponding to each surface type and the area corresponding to each surface coverage type.
[0135] Electronic devices can calculate the number of subgrids corresponding to a grid based on the number of subgrids corresponding to the surface cover type in each region.
[0136] In one implementation,
[0137] Electronic devices can obtain the load factor corresponding to the surface coverage type in each region.
[0138] Electronic devices can determine the number of subgrids corresponding to each surface coverage type based on the load factor corresponding to each surface type.
[0139] Electronic devices can calculate the number of subgrids corresponding to a grid based on the number of subgrids corresponding to the surface cover type in each region.
[0140] In one implementation,
[0141] Electronic devices can determine the number of land cover types based on at least one land cover type corresponding to a grid.
[0142] Electronic devices can determine the number of subgrids corresponding to a grid based on the number of land cover types.
[0143] S204: Calculate the total number of subgrids based on the number of subgrids corresponding to each grid.
[0144] In this embodiment, the electronic device can calculate the total number of subgrids based on the number of subgrids corresponding to each grid after obtaining the number of subgrids corresponding to each grid.
[0145] Understandably, the total number of subgrids is the sum of the number of subgrids corresponding to each grid.
[0146] S205: Obtain the land surface calculation tasks corresponding to each grid.
[0147] In this embodiment, the electronic device can acquire the land surface calculation tasks corresponding to each grid.
[0148] For example, land surface computing tasks could include calculating the ratio of carbon absorption to carbon release. Another example is calculating the contribution of human activities to surface runoff.
[0149] S206: Based on the total number of subgrids, the land surface computing tasks corresponding to multiple grids are allocated to multiple CPU cores so that multiple CPU cores can perform computing on the land surface computing tasks corresponding to multiple grids.
[0150] In this embodiment, the electronic device can allocate the land surface computing tasks corresponding to multiple grids to multiple CPU cores according to the total number of subgrids, so that multiple CPU cores can perform calculations on the land surface computing tasks corresponding to multiple grids.
[0151] The following section explains the process by which electronic devices allocate land surface computing tasks corresponding to multiple grids to multiple PU cores based on the total number of subgrids.
[0152] In one implementation,
[0153] For the nth CPU core, the electronic device can determine whether the index value of the nth CPU core is greater than a target index value; where n is a positive integer from 1 to N; and N is the total number of CPU cores. In one implementation, the target index value can be the index value of the Nth CPU core.
[0154] If so, the electronic device can allocate the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the number of grids corresponding to each CPU core.
[0155] If not, the electronic device can calculate the number of CPU cores to be allocated based on the index of the nth CPU core and N. The electronic device can calculate the average number of sub-grids to be allocated based on the number of sub-grids to be allocated and the number of CPU cores to be allocated. The electronic device can determine the number of grids corresponding to the nth CPU core based on the starting position index of the sub-grids to be allocated and the average number of sub-grids to be allocated. The electronic device can update the number of sub-grids to be allocated and the starting position index of the sub-grids to be allocated.
[0156] The beneficial effects of this embodiment are as follows: The electronic device can respond to an allocation request by dividing the Earth's land surface into multiple grids. For each grid, the electronic device can obtain at least one land cover type corresponding to the grid, and determine the number of sub-grids corresponding to that grid based on the at least one land cover type. The electronic device can calculate the total number of sub-grids based on the number of sub-grids corresponding to each grid, and allocate the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the total number of sub-grids, so that multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to multiple grids. Through the above-mentioned allocation method of land surface computing tasks, on the one hand, the load balance among multiple CPU cores can be improved, thereby improving the overall computing efficiency of all land surface computing tasks; on the other hand, the memory usage balance among multiple CPU cores can be improved.
[0157] Figure 3a A flowchart illustrating a second embodiment of a land surface computation task allocation method provided in this application is shown below. Figure 3a As shown, the method includes the following steps:
[0158] S301: In response to the allocation request, the Earth's land surface is divided into multiple grids.
[0159] In this embodiment, the electronic device can respond to an allocation request by dividing the Earth's land surface into multiple grids.
[0160] The specific implementation process is the same as that of S201, and will not be described in detail here.
[0161] S302: Obtain at least one land cover type corresponding to the grid.
[0162] In this embodiment, the electronic device can obtain at least one land cover type corresponding to the grid.
[0163] The specific implementation process is the same as that of S202, and will not be described in detail here.
[0164] S303: Obtain the area corresponding to each surface cover type.
[0165] In this embodiment, the electronic device can obtain the area corresponding to each surface coverage type.
[0166] For example, consider a grid that includes four land cover types: wetland, river, grassland, and snow mountain. Electronic devices can obtain the area corresponding to each land cover type.
[0167] S304: Determine the number of subgrids corresponding to each land cover type based on the area corresponding to each land cover type.
[0168] In this embodiment, the electronic device can determine the number of subgrids corresponding to each surface cover type based on the area corresponding to each surface cover type.
[0169] In one implementation,
[0170] Electronic devices can compare the areas corresponding to different land cover types and determine the land cover type corresponding to the smaller one as the baseline land cover type.
[0171] Electronic equipment can determine that the number of subgrids corresponding to the baseline land cover type is 1.
[0172] For the second land cover type, the electronic device can determine the area ratio of the second land cover type to the area of the reference land cover type. It should be noted that the second land cover type can be any land cover type included in the grid, excluding the reference land cover type.
[0173] The electronic device can determine the number of subgrids corresponding to the second land cover type based on the area ratio and the number of subgrids corresponding to the baseline land cover type. In one implementation, the ratio of the number of subgrids corresponding to the second land cover type to the number of subgrids corresponding to the baseline land cover type is consistent with the area ratio.
[0174] In one implementation,
[0175] Electronic devices can obtain the area corresponding to the surface cover type in various places.
[0176] Electronic devices can obtain the load factor corresponding to the surface coverage type in each region.
[0177] Electronic devices can determine the number of subgrids corresponding to each surface coverage type based on the load factor corresponding to each surface type and the area corresponding to each surface coverage type.
[0178] S305: Calculate the number of subgrids corresponding to each grid based on the number of subgrids corresponding to each surface cover type.
[0179] In this embodiment, the electronic device can calculate the number of sub-grids corresponding to a given grid based on the number of sub-grids corresponding to each surface cover type. It can be understood that the number of sub-grids corresponding to a given grid is the sum of the number of sub-grids corresponding to each surface cover type.
[0180] S306: Calculate the total number of subgrids based on the number of subgrids corresponding to each grid.
[0181] In this embodiment, the electronic device can calculate the total number of subgrids based on the number of subgrids corresponding to each grid.
[0182] The specific implementation process is the same as that of S204, and will not be described in detail here.
[0183] S307: Obtain the land surface calculation tasks corresponding to each grid.
[0184] In this embodiment, the electronic device can acquire the land surface calculation tasks corresponding to each grid.
[0185] The specific implementation process is the same as that of S205, and will not be described in detail here.
[0186] S308: Based on the total number of subgrids, the land surface computing tasks corresponding to multiple grids are allocated to multiple central processing unit (CPU) cores, so that multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to multiple grids.
[0187] In this embodiment, the electronic device can allocate the land surface computing tasks corresponding to multiple grids to multiple central processing unit (CPU) cores based on the total number of subgrids, so that multiple CPU cores can perform calculations on the land surface computing tasks corresponding to multiple grids.
[0188] The above methods can improve the load balancing among multiple CPU cores and the memory usage balancing among multiple CPU cores.
[0189] Figure 3b This is a schematic diagram illustrating a speedup ratio provided in an embodiment of this application. For example... Figure 3b As shown, when the maximum number of subgrids included in the grid is 20, the speedup ratio of the method of this application to the methods of related technologies gradually increases with the increase of the total number of CPU cores. In other words, the method of this application has a significant speedup effect.
[0190] Figure 3c This is a schematic diagram illustrating another speedup ratio provided in an embodiment of this application. For example... Figure 3c As shown, when the maximum number of subgrids included in the grid is 60, the speedup ratio of the method in this application to the methods of related technologies gradually increases as the total number of CPU cores increases.
[0191] The beneficial effects of this embodiment are as follows: The electronic device can respond to an allocation request by dividing the Earth's land surface into multiple grids. For each grid, the electronic device can obtain at least one land cover type corresponding to the grid. The electronic device can obtain the area corresponding to each land cover type and determine the number of sub-grids corresponding to each land cover type based on the area. The electronic device can calculate the number of sub-grids corresponding to each grid based on the number of sub-grids corresponding to each land cover type. The electronic device can calculate the total number of sub-grids based on the number of sub-grids corresponding to each grid and allocate the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the total number of sub-grids, so that multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to multiple grids. By using the area corresponding to each land cover type to determine the number of sub-grids corresponding to a grid, the accuracy of determining the number of sub-grids corresponding to a grid is improved. This allows the allocation method of allocating land surface computing tasks corresponding to multiple grids based on the total number of sub-grids (the sum of the number of sub-grids corresponding to multiple grids) to improve the load balancing among multiple CPU cores and the memory usage balancing among multiple CPU cores.
[0192] The following describes, through method embodiment three, the process by which an electronic device allocates land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the total number of subgrids.
[0193] Figure 4 A flowchart illustrating a method for allocating land surface computing tasks, as provided in Embodiment 3 of this application, is shown below. Figure 4 As shown, the method includes the following steps:
[0194] S401: For the nth CPU core, determine whether the index value of the nth CPU core is greater than the target index value.
[0195] In this embodiment, the electronic device can determine to assign a corresponding sequence number value to each CPU core.
[0196] For the nth CPU core, the electronic device can determine whether the index value of the nth CPU core is greater than a target index value. In one implementation, the target index value can be the index value of the Nth CPU core.
[0197] It should be noted that n is a positive integer from 1 to N; N is the total number of CPU cores.
[0198] If so, then execute S402.
[0199] If not, then execute S403.
[0200] In one implementation, the electronic device can determine whether the index of the nth CPU core is greater than a target index by executing "do n=1,N". Here, the target index is N(ndivs), which represents the total number of CPU cores.
[0201] S402: Based on the number of grids corresponding to each CPU core, the land surface computing tasks corresponding to multiple grids are allocated to multiple CPU cores.
[0202] In this embodiment, if the sequence number of the nth CPU core is greater than the target sequence number, the electronic device can allocate the land surface calculation tasks corresponding to multiple grids to multiple CPU cores according to the number of grids corresponding to each CPU core.
[0203] In one implementation,
[0204] For any given CPU core, the electronic device can determine the first starting position number and the first ending position number based on the number of grids corresponding to the CPU core. It should be noted that these first starting position number and first ending position number refer to the starting and ending position numbers of at least one target grid that can be assigned to the CPU core. For example, if the position numbers of the three target grids assigned to the CPU core are 1, 2, and 3, then the first starting position number is 1, and the first ending position number is 3.
[0205] For example, an electronic device may determine a first start position number and a first end position number based on the following statements.
[0206] pos=1
[0207] do n=1,N
[0208] istart(n) = pos
[0209] iend(n) = pos + my_npts(n) - 1
[0210] pos = pos + my_npts(n)
[0211] enddo
[0212] The electronic device can determine the target grid corresponding to the CPU core based on the first starting position number and the first ending position number.
[0213] Electronic devices can allocate the land surface computation tasks corresponding to the target grid to the CPU cores.
[0214] S403: Calculate the number of CPU cores to be allocated based on the serial number of the nth CPU core and N.
[0215] In this embodiment, the electronic device can calculate the number of CPU cores to be allocated based on the serial number of the nth CPU core and N, provided that the serial number of the nth CPU core is not the target serial number.
[0216] In one implementation, the electronic device determines the number of CPU cores to be allocated by the difference between N and the index value of the nth CPU core.
[0217] S404: Calculate the average number of subgrids n based on the number of subgrids to be assigned and the number of CPU cores to be assigned.
[0218] In this embodiment, the electronic device can calculate the average number of the nth subgrid based on the number of subgrids to be allocated (ncost_left) and the number of CPU cores to be allocated (ndivs_left).
[0219] In one implementation, the electronic device can execute "avg_cost = real(ncosts_left) / ndivs_left" to obtain the average number of grid cells in the nth iteration. Here, ndivs_left = N - n + 1. It should be noted that avg_cost is a real number.
[0220] It should be noted that before determining the number of grids corresponding to the first CPU core, the number of subgrids to be allocated is the same as the total number of subgrids (ncost_left = ncost).
[0221] In one implementation, the electronic device can determine the average number of subgrids (nth) as the ratio of the number of subgrids to be allocated to the number of CPU cores to be allocated.
[0222] S405: Determine the number of grids corresponding to the nth CPU core based on the starting position number of the grid to be assigned and the average number of grids in the nth round.
[0223] In this embodiment, the electronic device can determine the number of grids corresponding to the nth CPU core based on the obtained starting position number of the grid to be assigned and the average number of grids in the nth time.
[0224] In one implementation,
[0225] For the j-th grid to be assigned, the electronic device can increase the number of subgrids corresponding to the n-th CPU core based on the number of subgrids included in the j-th grid to be assigned, thus obtaining the j-th increased number of subgrids.
[0226] The electronic device can determine whether the number of grid cells after the j-th increment is greater than the average number of grid cells.
[0227] If the electronic device determines that the number of grids after the j-th increment is less than or equal to the average number of grids, it can increment the number of grids corresponding to the n-th CPU core by 1.
[0228] Here, j takes values of 1, 2, ..., until the number of subgrids after the j-th increment is greater than the average number of subgrids.
[0229] It should be noted that the position number of the first grid cell to be assigned is the starting position number of the grid cell to be assigned.
[0230] In one implementation,
[0231] For example, an electronic device can determine the number of grids corresponding to the nth CPU core based on the following statement.
[0232]
[0233] do i = cur_pos, npts
[0234] cur_npts = cur_npts + 1
[0235] cur_cost = cur_cost + cost(i)
[0236] if (cur_cost > avg_cost) exit
[0237] enddo
[0238] my_npts(n) = cur_npts – 1
[0239] cur_cost = cur_cost – cost(i)
[0240] It should be noted that cur_pos is the starting position number of the grid to be allocated; npts is the total number of grids.
[0241] S406: Update the number of subgrids to be assigned and the starting position number of the subgrids to be assigned.
[0242] In this embodiment, the electronic device can update the number of subgrids to be assigned and the starting position number of the subgrids to be assigned.
[0243] In one implementation, the electronic device can update the number of subgrids to be assigned based on the number of target grids. Understandably, the difference between the number of subgrids to be assigned before the update and the number of subgrids included in the entire target grid is the updated number of subgrids to be assigned.
[0244] In one implementation, the electronic device can update the starting position number of the grid to be assigned based on the number of target grids. Understandably, the sum of the original starting position number and the number of target grids constitutes the updated starting position number.
[0245] The beneficial effects of this embodiment are as follows: In this embodiment, during the process of allocating land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the total number of sub-grids, for the nth CPU core, the electronic device can determine whether the index value of the nth CPU core is greater than the target index value. If so, the electronic device can allocate the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the number of grids corresponding to each CPU core. If not, the electronic device can calculate the number of CPU cores to be allocated based on the index value of the nth CPU core and N; calculate the nth average number of sub-grids based on the obtained number of sub-grids to be allocated and the number of CPU cores to be allocated; determine the number of grids corresponding to the nth CPU core based on the obtained starting position index of the sub-grids to be allocated and the nth average number of sub-grids; and update the number of sub-grids to be allocated and the starting position index of the sub-grids to be allocated. The above allocation method can, on the one hand, distribute multiple subgrids evenly to multiple CPU cores, improving the load balance among multiple CPU cores and the memory usage balance of multiple CPU cores; on the other hand, the method of determining the target grid from the grids to be allocated based on the continuously adjusted average number of subgrids can improve the averaging of the allocation.
[0246] Figure 5 A flowchart illustrating Embodiment 4 of a method for allocating land surface computing tasks provided in this application is shown below. Figure 5 As shown, the method includes the following steps:
[0247] S501: In response to the allocation request, the Earth's land surface is divided into multiple grids.
[0248] In this embodiment, the electronic device can respond to an allocation request by dividing the Earth's land surface into multiple grids.
[0249] The specific implementation process is the same as that of S201, and will not be described in detail here.
[0250] S502: Obtain at least one land cover type corresponding to the grid.
[0251] In this embodiment, the electronic device can obtain at least one land cover type corresponding to the grid.
[0252] The specific implementation process is the same as that of S202, and will not be described in detail here.
[0253] S503: Obtain the area corresponding to each surface cover type.
[0254] In this embodiment, the electronic device can obtain the area corresponding to each surface coverage type.
[0255] The specific implementation process is the same as that of S303, and will not be described in detail here.
[0256] S504: Obtain the load factor corresponding to the surface coverage type of each region.
[0257] In this embodiment, the electronic device can obtain the load coefficient corresponding to the surface coverage type in each region.
[0258] The load factor indicates the computational load corresponding to the land cover type. Understandably, when one grid corresponds to one land cover type, the larger the load factor for that land cover type, the greater the load on the land surface computation tasks for that grid, and the longer it takes for the CPU core to process those tasks.
[0259] For example, the load factor for wetland type can be 0.9, the load factor for river type can be 0.95, the load factor for grassland type can be 0.9, and the load factor for snow mountain type can be 0.5.
[0260] S505: Determine the number of subgrids corresponding to each surface cover type based on the load factor corresponding to each surface cover type and the area corresponding to each surface cover type.
[0261] In this embodiment, the electronic device can determine the number of subgrids corresponding to each surface coverage type based on the load coefficient corresponding to each surface type and the area corresponding to each surface coverage type.
[0262] In one implementation,
[0263] Electronic devices can calculate the product value based on the load factor corresponding to each surface type and the area corresponding to each surface coverage type.
[0264] Electronic devices can compare the product values corresponding to different land cover types and determine the land cover type corresponding to the smaller one as the baseline land cover type.
[0265] Electronic equipment can determine that the number of subgrids corresponding to the baseline land cover type is 1.
[0266] For the second land cover type, the electronic device can determine the ratio of the product value of the second land cover type to the product value of the reference land cover type. It should be noted that the second land cover type can be any land cover type included in the grid, other than the reference land cover type.
[0267] The electronic device can determine the number of subgrids corresponding to the second land cover type based on this ratio and the number of subgrids corresponding to the baseline land cover type.
[0268] S506: Calculate the number of subgrids corresponding to each grid based on the number of subgrids corresponding to each surface cover type.
[0269] In this embodiment, the electronic device can calculate the number of sub-grids (cost(Npts)) corresponding to a given grid based on the number of sub-grids corresponding to each surface coverage type. It should be noted that Npts represents the total number of grids.
[0270] S507: Calculate the total number of subgrids based on the number of subgrids corresponding to each grid.
[0271] In this embodiment, the electronic device can calculate the total number of subgrids (Ncost = sum(cost)) based on the number of subgrids corresponding to each grid.
[0272] S508: Obtain the land surface calculation tasks corresponding to each grid.
[0273] In this embodiment, the electronic device can acquire the land surface calculation tasks corresponding to each grid.
[0274] S509: Based on the total number of subgrids, the land surface computing tasks corresponding to multiple grids are allocated to multiple CPU cores so that multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to multiple grids.
[0275] In this embodiment, the electronic device can allocate the land surface computing tasks corresponding to multiple grids to multiple central processing unit (CPU) cores based on the total number of subgrids, so that multiple CPU cores can perform calculations on the land surface computing tasks corresponding to multiple grids.
[0276] The following section explains the process by which electronic devices allocate land surface computing tasks corresponding to multiple grids to multiple PU cores based on the total number of subgrids.
[0277] In one implementation,
[0278] For the nth CPU core, the electronic device can determine whether the index value of the nth CPU core is greater than the target index value; where n is a positive integer from 1 to N; and N is the total number of CPU cores.
[0279] If so, the electronic device can allocate land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the number of grids corresponding to each CPU core. In one implementation, for any CPU core, the electronic device can determine a first start position number and a first end position number based on the number of grids corresponding to the CPU core, determine the target grid corresponding to the CPU core based on the first start position number and the first end position number, and allocate the land surface computing tasks corresponding to the target grid to the CPU core.
[0280] If not, the electronic device can calculate the number of CPU cores to be allocated based on the index of the nth CPU core and N. The electronic device can calculate the average number of sub-grids to be allocated based on the number of sub-grids to be allocated and the number of CPU cores to be allocated. The electronic device can determine the number of grids corresponding to the nth CPU core based on the starting position index of the sub-grids to be allocated and the average number of sub-grids to be allocated. The electronic device can update the number of sub-grids to be allocated and the starting position index of the sub-grids to be allocated.
[0281] The following section explains the process by which an electronic device determines the number of grids corresponding to the nth CPU core based on the starting position number of the grid to be assigned and the average number of grids in the nth iteration.
[0282] In one implementation,
[0283] For the j-th grid to be assigned, the electronic device can increase the number of subgrids corresponding to the n-th CPU core based on the number of subgrids included in the j-th grid to be assigned, thus obtaining the j-th increased number of subgrids.
[0284] If the electronic device determines that the number of grids after the j-th increment is less than or equal to the average number of grids, it can increment the number of grids corresponding to the n-th CPU core by 1.
[0285] Where j takes the values 1, 2, ..., until the number of subgrids after the j-th increment is greater than the average number of subgrids; the position number of the first grid to be assigned is the starting position number of the grid to be assigned.
[0286] In another implementation,
[0287] For any given grid, the electronic device can also obtain the corresponding land surface calculation results. These land surface calculation results are obtained by the CPU core corresponding to the grid performing calculations on the land surface calculation task.
[0288] The electronic device can acquire the atmospheric calculation results corresponding to the grid. These atmospheric calculation results are obtained by the second CPU core corresponding to the grid, which performs the atmospheric calculation tasks for that grid. The second CPU core corresponding to the grid is determined by allocating and processing atmospheric calculation tasks across multiple grids based on the number of grid cells.
[0289] Electronic devices can establish a correspondence between land surface calculation results and atmospheric calculation results.
[0290] The beneficial effects of this embodiment are as follows: The electronic device can respond to an allocation request by dividing the Earth's land surface into multiple grids. For each grid, the electronic device can obtain at least one land cover type corresponding to the grid. The electronic device can obtain the area corresponding to each land cover type and determine the number of sub-grids corresponding to each land cover type based on the area and load factor. The electronic device can calculate the number of sub-grids corresponding to each grid based on the number of sub-grids corresponding to each land cover type. The electronic device can calculate the total number of sub-grids based on the number of sub-grids corresponding to each grid and allocate the land surface computing tasks corresponding to multiple grids to multiple CPU cores based on the total number of sub-grids, so that multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to multiple grids. By using the area corresponding to each land cover type to determine the number of sub-grids corresponding to a grid, the accuracy of determining the number of sub-grids corresponding to a grid is improved. This allows the allocation method of allocating land surface computing tasks corresponding to multiple grids based on the total number of sub-grids (the sum of the number of sub-grids corresponding to multiple grids) to improve the load balance among multiple CPU cores and the memory usage balance among multiple CPU cores.
[0291] Figure 6 This is a schematic diagram of a land surface computing task allocation device provided in an embodiment of this application. Figure 6 As shown, the land surface computing task allocation device 60 may include a processing module 61 and an allocation module 62.
[0292] Processing module 61 is used to divide the Earth's land surface into multiple grids in response to an allocation request;
[0293] Processing module 61 is also used to obtain at least one land cover type corresponding to the grid;
[0294] Processing module 61 is also used to determine the number of subgrids corresponding to the grid based on at least one land cover type;
[0295] Processing module 61 is also used to calculate the total number of subgrids based on the number of subgrids corresponding to each grid.
[0296] Processing module 61 is also used to obtain the land surface calculation tasks corresponding to each grid;
[0297] The allocation module 62 is used to allocate the land surface computing tasks corresponding to multiple grids to multiple central processing unit (CPU) cores according to the total number of subgrids, so that multiple CPU cores can perform calculations on the land surface computing tasks corresponding to multiple grids.
[0298] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0299] In one implementation, processing module 61 is specifically used for:
[0300] Obtain the area corresponding to each surface cover type;
[0301] The number of subgrids corresponding to each land cover type is determined based on the area corresponding to each land cover type.
[0302] Calculate the number of subgrids corresponding to each grid based on the number of subgrids corresponding to each surface cover type.
[0303] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0304] In one implementation, processing module 61 is specifically used for:
[0305] Obtain the load factor corresponding to each surface coverage type;
[0306] The number of subgrids corresponding to each surface cover type is determined based on the load factor corresponding to each surface cover type and the area corresponding to each surface cover type.
[0307] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0308] In one implementation, allocation module 62 is specifically used for:
[0309] For the nth CPU core, determine whether the index value of the nth CPU core is greater than the target index value; where n is a positive integer from 1 to N; and N is the total number of CPU cores.
[0310] If so, then based on the number of grids corresponding to each CPU core, the land surface computing tasks corresponding to multiple grids will be allocated to multiple CPU cores;
[0311] If not, then calculate the number of CPU cores to be allocated based on the index of the nth CPU core and N;
[0312] Calculate the average number of subgrids to be assigned based on the number of subgrids to be assigned and the number of CPU cores to be assigned;
[0313] Based on the starting position number of the grid to be assigned and the average number of grids in the nth iteration, determine the number of grids corresponding to the nth CPU core;
[0314] The number of subgrids to be assigned and the starting position number of the subgrids to be assigned are updated.
[0315] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0316] In one implementation, allocation module 62 is specifically used for:
[0317] For the j-th grid to be assigned, based on the number of subgrids included in the j-th grid to be assigned, the number of subgrids corresponding to the n-th CPU core is increased to obtain the j-th increased number of subgrids;
[0318] If the number of subgrids after the j-th increment is less than or equal to the average number of subgrids, the number of grids corresponding to the n-th CPU core is incremented by 1; where j is successively 1, 2, ..., until the number of subgrids after the j-th increment is greater than the average number of subgrids; the position number of the first grid to be assigned is the starting position number of the grid to be assigned.
[0319] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0320] In one implementation, allocation module 62 is specifically used for:
[0321] For any CPU core, determine the first start position number and the first end position number based on the number of grids corresponding to the CPU core;
[0322] The target grid corresponding to the CPU core is determined based on the first starting position number and the first ending position number;
[0323] The land surface computation task corresponding to the target grid is assigned to the CPU core.
[0324] The land surface computing task allocation device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0325] Figure 7 This is a structural diagram of an electronic device provided in this application. Figure 7 As shown, the electronic device 70 includes a processor 71 and a memory 72. The processor 71 is communicatively connected to the memory 72, which stores computer execution instructions. The processor 71 is configured to execute the technical solutions in any of the aforementioned method embodiments by executing the computer execution instructions stored in the memory 72.
[0326] Optionally, the memory 72 can be either standalone or integrated with the processor 71. Optionally, when the memory 72 is a device independent of the processor 71, the electronic device 70 may further include a bus 73 for connecting the aforementioned devices.
[0327] The electronic device is used to execute the technical solutions in any of the foregoing method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.
[0328] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the technical solutions provided in any of the foregoing method embodiments.
[0329] This application also provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the technical solutions provided in the foregoing method embodiments.
[0330] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0331] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0332] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0333] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0334] When an integrated unit / module is implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0335] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0336] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as these combinations of technical features do not contradict each other, they should be considered within the scope of this specification.
[0337] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0338] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for allocating land surface computing tasks, characterized in that, include: In response to the allocation request, the Earth's land surface is divided into multiple grids; Obtain at least one land cover type corresponding to the grid; The number of subgrids corresponding to the grid is determined based on the at least one land cover type; the number of subgrids corresponding to the grid is determined based on the number of subgrids corresponding to each land cover type or the number of land cover types, wherein the number of subgrids corresponding to each land cover type is determined based on the area corresponding to each land cover type and / or the load factor corresponding to each land cover type; Calculate the total number of subgrids based on the number of subgrids corresponding to each grid. Obtain the land surface computation tasks corresponding to each grid; Based on the total number of subgrids, the land surface computing tasks corresponding to multiple grids are allocated to multiple central processing unit (CPU) cores, so that the multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to the multiple grids.
2. The method according to claim 1, characterized in that, Determining the number of subgrids corresponding to the grid based on the at least one land cover type includes: Obtain the area corresponding to each surface cover type; The number of subgrids corresponding to each surface cover type is determined based on the area corresponding to each surface cover type. Calculate the number of subgrids corresponding to each surface cover type.
3. The method according to claim 2, characterized in that, The step of determining the number of subgrids corresponding to each surface cover type based on the area corresponding to each surface cover type includes: Obtain the load factor corresponding to each surface coverage type; The number of subgrids corresponding to each surface cover type is determined based on the load coefficient and the area corresponding to each surface cover type.
4. The method according to any one of claims 1-3, characterized in that, The step of allocating the land surface computing tasks corresponding to multiple grids to multiple central processing unit (CPU) cores based on the total number of sub-grids includes: For the nth CPU core, determine whether the index value of the nth CPU core is greater than a target index value; where n is a positive integer from 1 to N; N is the total number of CPU cores; and the target index value is the index value of the Nth CPU core. If so, then based on the number of grids corresponding to each CPU core, the land surface computing tasks corresponding to multiple grids will be allocated to multiple CPU cores; If not, then calculate the number of CPU cores to be allocated based on the sequence number of the nth CPU core and N; Calculate the average number of subgrids n based on the number of subgrids to be allocated and the number of CPU cores to be allocated. The number of grids corresponding to the nth CPU core is determined based on the starting position number of the grid to be assigned and the average number of grids in the nth order. The number of subgrids to be assigned and the starting position number of the subgrids to be assigned are updated.
5. The method according to claim 4, characterized in that, The step of determining the number of grids corresponding to the nth CPU core based on the obtained starting position index of the grid to be allocated and the average number of grids in the nth order includes: For the j-th grid to be allocated, the number of subgrids corresponding to the n-th CPU core is increased based on the number of subgrids included in the j-th grid to be allocated, to obtain the j-th increased number of subgrids; If the number of subgrids after the j-th increment is less than or equal to the average number of subgrids, the number of grids corresponding to the n-th CPU core is incremented by 1; where j is taken as 1, 2, ..., until the number of subgrids after the j-th increment is greater than the average number of subgrids; the position number of the first grid to be assigned is the starting position number of the grid to be assigned.
6. The method according to claim 4, characterized in that, The process of allocating land surface computation tasks corresponding to multiple grids to multiple CPU cores based on the number of grids corresponding to each CPU core includes: For any CPU core, the first start position number and the first end position number are determined based on the number of grids corresponding to the CPU core; The target grid corresponding to the CPU core is determined based on the first starting position number and the first ending position number; The land surface computation task corresponding to the target grid is assigned to the CPU core.
7. A land surface computing task allocation device, characterized in that, include: The processing module is used to divide the Earth's land surface into multiple grids in response to allocation requests; The processing module is also used to obtain at least one land cover type corresponding to the grid; The processing module is further configured to determine the number of subgrids corresponding to the grid based on the at least one land cover type; the number of subgrids corresponding to the grid is determined based on the number of subgrids corresponding to each land cover type or the number of land cover types, wherein the number of subgrids corresponding to each land cover type is determined based on the area corresponding to each land cover type and / or the load factor corresponding to each land cover type; The processing module is also used to calculate the total number of subgrids based on the number of subgrids corresponding to each grid. The processing module is also used to obtain the land surface calculation tasks corresponding to each grid. The allocation module is used to allocate the land surface computing tasks corresponding to multiple grids to multiple central processing unit (CPU) cores according to the total number of subgrids, so that the multiple CPU cores can perform computing processing on the land surface computing tasks corresponding to the multiple grids.
8. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-6.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-6.
Citation Information
Patent Citations
Method for calculating grid data of VIC land surface model
CN109062695A
Data processing method and apparatus and electronic device
US20230140242A1