Data processing method and equipment
By using the control unit in the blockchain computing device to calculate and send the N-bit calculation offset of the computing core, the computing core can efficiently perform hash calculations, solving the problems of low computing efficiency and high cost, and achieving improvements in computing efficiency. Improvements and cost savings.
Patent Information
- Application Number
- CN202410753285.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-17
AI Technical Summary
The computing efficiency of existing blockchain computing devices is low and the cost is high, making it difficult to effectively improve it.
The control unit obtains the total number of computing cores in all chips of the computing device, calculates the initial random number in the form of an N-bit floating point number for each computing core as the calculation offset, and sends the offset to each chip so that each After receiving the computing task data, the computing core performs hash calculation according to the offset, which reduces the transmission of allocation information for the computing range, improves computing efficiency, and saves register resources.
The computing efficiency is greatly improved, the register resource occupation and chip area of the computing core are reduced, and the cost is correspondingly saved.
Smart Images

Figure CN118656340A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a data processing method and device. Background Art
[0002] At present, blockchain technology is widely used in various fields. The implementation of blockchain technology usually requires a lot of computing processes by computing devices. How to improve the computing efficiency of computing devices is a goal that has been pursued in this field. However, the computing efficiency of existing computing devices still needs to be improved, and the cost of computing devices also has room for reduction. Summary of the invention
[0003] Based on the above situation, the main purpose of the present invention is to provide a data processing method and device to improve computing efficiency and save costs.
[0004] To achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0005] A data processing method comprises the following steps: a control unit acquires the total number of computing cores in all chips of a computing device; the control unit calculates the computing number corresponding to each computing core according to a random number space and the total number, and calculates an initial random number in the form of an N-bit floating point number of each computing core according to the computing number as an N-bit computing offset; wherein N is less than the number of bits in the random number space; the control unit sends the corresponding N-bit computing offset to each chip, and each chip receives the N-bit computing offset belonging to its own computing core and stores it in a register of the corresponding computing core; the control unit broadcasts the same computing task data to all chips of the computing device, and after each computing core of each chip receives the computing task data, replaces the high N-bit data of the random number space with the N-bit computing offset in its own register as a starting computing value, and uses M random numbers in the random number space starting from the starting computing value in sequence as a computing value upper limit, combines each computing value with the computing task data respectively and performs hash calculation, and sends the computing value corresponding to the computing result less than the target value to the control unit, wherein M does not exceed the computing number.
[0006] Preferably, the control unit also broadcasts the target value to each chip, and the application top layer of each chip stores the target value; each computing core also stores a sub-target value, and each computing core compares the calculation result with the sub-target value after performing a hash calculation. If the calculation result is less than the sub-target value, the corresponding calculation value is uploaded to the application top layer of the chip to which the computing core belongs as a candidate calculation value; the application top layer of the chip combines the candidate calculation value with the computing task data and performs a hash calculation, and sends the calculation value corresponding to the calculation result less than the target value to the control unit; wherein, the target value is less than the sub-target value.
[0007] Preferably, if a computing core still fails to obtain a calculation result less than the sub-target value after performing M hash calculations, the calculation of the computing task data is stopped and no notification is sent to the top application layer of the corresponding chip.
[0008] Preferably, the control unit is connected in series with the chips in the computing device in sequence; the control unit numbers the computing cores in all the chips of the computing device, and sends the number of the computing core in the chip to each chip; the control unit sends the corresponding N-bit calculation offset to a certain numbered computing core via a directly connected chip, and when a certain chip receives the N-bit calculation offset of the certain number, it determines whether the certain number belongs to the computing core in this chip. If so, the N-bit calculation offset of the certain number will no longer be forwarded to the next chip, and the N-bit calculation offset of the certain number will be stored in the register of the corresponding computing core. Otherwise, the N-bit calculation offset of the certain number will be forwarded to the next chip.
[0009] Preferably, after receiving multiple calculation values, the control unit combines each received calculation value with the calculation task data and performs hash calculation, and sends the calculation value corresponding to the target value whose calculation result is smaller than the target value to the upstream.
[0010] The present invention also provides a data processing device, comprising: a control unit and a computing device; the control unit obtains the total number of computing cores in all chips of the computing device; the control unit calculates the computing number corresponding to each computing core according to the random number space and the total number, and calculates the initial random number in the form of an N-bit floating point number of each computing core according to the computing number as an N-bit computing offset; wherein N is less than the number of bits in the random number space; the control unit sends the corresponding N-bit computing offset to each chip, and each chip receives the N-bit computing offset belonging to its own computing core and stores it in the register of the corresponding computing core; the control unit broadcasts the same computing task data to all chips of the computing device, and after each computing core of each chip receives the computing task data, replaces the high N-bit data of the random number space with the N-bit computing offset in its own register as the starting computing value, and uses the M random numbers in the random number space starting from the starting computing value in sequence as the upper limit of the computing value, and combines each computing value with the computing task data respectively and performs hash calculation, and sends the computing value corresponding to the calculation result less than the target value to the control unit, wherein M does not exceed the computing number.
[0011] Preferably, the control unit also broadcasts the target value to each chip, and the application top layer of each chip stores the target value; each computing core also stores a sub-target value, and each computing core compares the calculation result with the sub-target value after performing a hash calculation. If the calculation result is less than the sub-target value, the corresponding calculation value is uploaded to the application top layer of the chip to which the computing core belongs as a candidate calculation value; the application top layer of the chip combines the candidate calculation value with the computing task data and performs a hash calculation, and sends the calculation value corresponding to the calculation result less than the target value to the control unit; wherein, the target value is less than the sub-target value.
[0012] Preferably, if a computing core still fails to obtain a calculation result less than the sub-target value after performing M hash calculations, the calculation of the computing task data is stopped and no notification is sent to the top application layer of the corresponding chip.
[0013] Preferably, the control unit is connected in series with the chips in the computing device in sequence; the control unit numbers the computing cores in all the chips of the computing device, and sends the number of the computing core in the chip to each chip; the control unit sends the corresponding N-bit calculation offset to a certain numbered computing core via a directly connected chip, and when a certain chip receives the N-bit calculation offset of the certain number, it determines whether the certain number belongs to the computing core in this chip. If so, the N-bit calculation offset of the certain number will no longer be forwarded to the next chip, and the N-bit calculation offset of the certain number will be stored in the register of the corresponding computing core. Otherwise, the N-bit calculation offset of the certain number will be forwarded to the next chip.
[0014] Preferably, after receiving multiple calculation values, the control unit combines each received calculation value with the calculation task data and performs hash calculation, and sends the calculation value corresponding to the target value whose calculation result is smaller than the target value to the upstream.
[0015] Through the above scheme, on the one hand, when the control unit receives a computing task data, the control unit broadcasts the same computing task data to all chips of the computing device. After each computing core receives the computing task data, it can cooperate to perform hash calculations according to its own N-bit computing offset, without sending the allocation information of each computing range to each computing core, thereby greatly improving the computing efficiency. On the other hand, through the above scheme, each computing core only needs to store the N-bit computing offset, and does not need to store the number of bits in the random number space, thereby greatly saving the register resources of the computing core. Under the same circumstances, it saves the chip area and corresponding costs.
[0016] Other beneficial effects of the present invention will be explained in the specific implementation manner through the introduction of specific technical features and technical solutions. Through the introduction of these technical features and technical solutions, those skilled in the art should be able to understand the beneficial technical effects brought about by the technical features and technical solutions. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings.
[0018] Figure 1 A schematic diagram of a computing device according to a preferred embodiment of the present invention;
[0019] Figure 2 It is a schematic diagram of a computing device according to another preferred embodiment of the present invention. DETAILED DESCRIPTION
[0020] The present invention is described below based on embodiments, but the present invention is not limited to these embodiments. In the following detailed description of the present invention, some specific details are described in detail. In order to avoid confusing the essence of the present invention, known methods, processes, procedures, and components are not described in detail.
[0021] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.
[0022] Unless the context clearly requires otherwise, throughout the specification and claims, the words "include", "comprising" and similar words should be interpreted in an inclusive sense rather than an exclusive or exhaustive sense; that is, in the sense of "including but not limited to".
[0023] In the description of the present invention, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0024] Figure 1 It is a schematic diagram of a computing device of an embodiment of the present invention, which can be used to complete relevant computing tasks in blockchain technology. The computing device includes a control unit (such as a main control chip) and a computing device (which can be called a computing power board). The computing device includes multiple chips, each chip has an application top layer and multiple computing cores that can be calculated in parallel and managed by the application top layer. The control unit is connected in series with the chips in the computing device in turn. The control unit is used to configure and control all chips in the computing device. In addition, the control unit receives computing task data from the upstream and broadcasts the computing task data to each chip. Each chip performs hash calculation on the configuration of the computing core in the chip and the computing task data according to the control unit to obtain a computing result. Finally, the computing value corresponding to the computing result being less than the target value is sent to the control unit.
[0025] like Figure 1 As shown, the control unit is directly connected to a chip, which is connected to the next chip, thus forming a series connection. When the control unit needs to communicate with a chip that is not directly connected, the communication data needs to be forwarded through the chips between the two. Figure 2 FIG. 1 is a schematic diagram of a computing device according to another embodiment of the present invention, wherein the computing device includes a plurality of Figure 1 The control unit is used to control each computing device.
[0026] The control unit obtains the total number of computing cores in all chips of the computing device. The control unit can broadcast a message to inquire about the number of cores to each chip. After each chip receives the message, it sends the number of computing cores of the chip to the control unit. In this way, the control unit obtains the number of computing cores in each chip, and then can calculate the total number of computing cores in all chips.
[0027] The control unit calculates the number of calculations corresponding to each computing core based on the random number space and the total number, and calculates the initial random number in the form of an N-bit floating point number for each computing core based on the number of calculations as an N-bit calculation offset; wherein N is less than the number of bits in the random number space. The random number space can be denoted as R. The common size of the random number space is 4 bytes (i.e., 32 bits). N can be 20. Subsequent hash calculations need to select any value in the random number space R to calculate and obtain the corresponding calculation result. The total number of computing cores is denoted as m, and the number of calculations r corresponding to each computing core can be expressed as: r=R / m. In this way, for the computing core numbered i, its initial random number can be expressed as: N(i)=(i-1)*r. The initial random number N(i) exists in the form of an N-bit floating point number.
[0028] As mentioned above, the control unit calculates the corresponding N-bit calculation offset for each computing core of each chip, and then sends the corresponding N-bit calculation offset to each chip. Each chip receives the N-bit calculation offset belonging to its own computing core and stores it in the register of the corresponding computing core.
[0029] At this point, each computing core of each chip has obtained the corresponding N-bit calculation offset. The above steps can usually be completed when the computing device is initialized. Thereafter, once the control unit receives a computing task data, the control unit broadcasts the same computing task data to all chips of the computing device. After each computing core receives the computing task data, it can perform corresponding hash calculations based on its own N-bit computing offset. Specifically, the control unit broadcasts the same computing task data to all chips of the computing device. After each computing core of each chip receives the computing task data, it replaces the high N-bit data in the random number space with the N-bit computing offset in its respective register as the starting calculation value, and uses the M random numbers in the random number space starting from the starting calculation value as the upper limit of the calculation value. Each calculation value is combined with the computing task data and hashed, and the calculation value corresponding to the calculation result less than the target value is sent to the control unit, where M does not exceed the number of calculations. The specific calculation process of each computing core will be described in detail below. The computing core first uses the starting computing value as the computing value, combines the computing value with the computing task data and performs a hash calculation, and if the calculation result is less than the target value, the corresponding computing value is sent to the control unit; then, the computing core uses the starting computing value plus bit 1 as the new computing value, combines the new computing value with the computing task data and performs a hash calculation, and if the calculation result is less than the target value, the corresponding computing value is sent to the control unit; this cycle is repeated until the computing core generates the Mth computing value, combines the Mth computing value with the computing task data and performs a hash calculation, and if the calculation result is less than the target value, the corresponding computing value is sent to the control unit, at this point, the computing core has completed its computing task, and stops the calculation (operation) for this round of computing task data, and continues to calculate for the next computing task data after receiving the next computing task data. In some embodiments, the computing task data includes multiple fields, such as the hash value, version number, and timestamp of the previous block.
[0030] Through the above scheme, on the one hand, when the control unit receives a computing task data, the control unit broadcasts the same computing task data to all chips of the computing device. After each computing core receives the computing task data, it can cooperate to perform hash calculations according to its own N-bit computing offset, without sending the allocation information of each computing range to each computing core, thereby greatly improving the computing efficiency. On the other hand, through the above scheme, each computing core only needs to store the N-bit computing offset, and does not need to store the number of bits in the random number space, thereby greatly saving the register resources of the computing core. Under the same circumstances, it saves the chip area and corresponding costs.
[0031] After receiving multiple calculation values, the control unit can further combine each received calculation value with the calculation task data and perform hash calculations, and send the calculation value corresponding to the calculation result which is less than the target value to the upstream.
[0032] In order to balance the processing efficiency and facilitate the control unit to adjust the target value of each chip, the following scheme is also adopted in some embodiments. The control unit broadcasts the target value to each chip, and the top application layer of each chip stores the target value; each computing core also stores a sub-target value. After performing a hash calculation, each computing core compares the calculation result with the sub-target value. If the calculation result is less than the sub-target value, the corresponding calculation value is uploaded to the top application layer of the chip to which the computing core belongs as a candidate calculation value; the top application layer of the chip combines the candidate calculation value with the computing task data and performs a hash calculation, and sends the calculation value corresponding to the calculation result less than the target value to the control unit; wherein the target value is less than the sub-target value. In this scheme, each computing core stores the sub-target value, so that the computing circuit of the computing core can be used to realize a fast comparison between the calculation result and the sub-target value, thereby discarding the calculation result greater than the sub-target value, avoiding sending a large number of calculation results to the top application layer of the chip, which leads to the calculation load and processing efficiency of the top application layer. In addition, when the difficulty coefficient of the computing task data increases, that is, the target value decreases, the control unit can send the target value of the letter to the top application layer of each chip, so as to facilitate the adjustment of the calculation target of each chip.
[0033] In some embodiments, if a computing core still fails to obtain a calculation result less than the sub-target value after performing M hash calculations, it stops the calculation of the current round of computing task data (and continues the calculation of the next computing task data after receiving the next computing task data) and does not send a notification to the top application layer of the chip to which it belongs, so as to avoid bus resource occupation caused by sending a notification to the top application layer for each calculation.
[0034] In some embodiments, the control unit numbers the computing cores in all chips of the computing device, and sends the number of the computing core in the chip to each chip; the control unit sends the corresponding N-bit calculation offset to a certain numbered computing core via a directly connected chip, and when a certain chip receives the N-bit calculation offset of the certain number through its application top layer, it determines whether the certain number belongs to the computing core in the chip, and if so, it will no longer forward the N-bit calculation offset of the certain number to the next chip, and store the N-bit calculation offset of the certain number in the register of the corresponding computing core, otherwise, the N-bit calculation offset of the certain number is forwarded to the next chip. Specifically, the control unit stores the number of each chip, and after each chip reports the number of its own computing cores to the control unit, the control unit numbers each computing core based on the total number of computing cores; then the control unit sends the number of the computing core in the chip to each chip, and the application top layer of the chip stores it after receiving the number of the computing core in the chip. When the control unit needs to send an N-bit calculation offset to the computing core in a certain chip, it first sends a data packet with the computing core number and the N-bit calculation offset to the first chip directly connected to the control unit. After the application top layer of the first chip receives the data packet, it determines whether the computing core number therein is the number of the computing core in this chip. If so, it writes it into the register of the corresponding computing core. Otherwise, it forwards the data packet to the next chip until the data packet is received by the target chip.
[0035] The present invention also provides a data processing device, comprising: a control unit and a computing device;
[0036] The control unit obtains the total number of computing cores in all chips of the computing device;
[0037] The control unit calculates the number of calculations corresponding to each computing core according to the random number space and the total number, and calculates an initial random number in the form of an N-bit floating point number for each computing core according to the number of calculations as an N-bit calculation offset; wherein N is less than the number of bits in the random number space;
[0038] The control unit sends a corresponding N-bit calculation offset to each chip, and each chip receives the N-bit calculation offset belonging to its own computing core and stores it in a register of the corresponding computing core;
[0039] The control unit broadcasts the same computing task data to all chips of the computing device. After each computing core of each chip receives the computing task data, it replaces the high N bits of the random number space with the N-bit computing offset in its respective register as the starting computing value, and uses the M random numbers in the random number space starting from the starting computing value as the upper limit of the computing value. Each computing value is combined with the computing task data and hashed, and the computing value corresponding to the computing result less than the target value is sent to the control unit, wherein M does not exceed the computing quantity.
[0040] It will be appreciated by those skilled in the art that, under the premise of no conflict, the above-mentioned preferred solutions can be freely combined and superimposed. Among them, the flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings, for example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. The numbering of each step in this article is only for the convenience of description and reference, and is not used to limit the order of execution. The specific execution order is determined by the technology itself, and those skilled in the art can determine various allowable and reasonable orders based on the technology itself.
[0041] Those skilled in the art will appreciate that, without conflict, the above-mentioned preferred solutions can be freely combined and superimposed.
[0042] It should be understood that the above-mentioned embodiments are merely illustrative and not restrictive. Without departing from the basic principles of the present invention, various obvious or equivalent modifications or substitutions that can be made by those skilled in the art to the above-mentioned details will all be included in the scope of the claims of the present invention.
Claims
1. A data processing method, It is characterized in that The steps include: The control unit obtains the total number of computing cores in all chips of the computing device; The control unit calculates the number of calculations corresponding to each computing core according to the random number space and the total number, and calculates an initial random number in the form of an N-bit floating point number for each computing core according to the number of calculations as an N-bit calculation offset; wherein N is less than the number of bits in the random number space; The control unit sends a corresponding N-bit calculation offset to each chip, and each chip receives the N-bit calculation offset belonging to its own computing core and stores it in a register of the corresponding computing core; The control unit broadcasts the same computing task data to all chips of the computing device. After each computing core of each chip receives the computing task data, it replaces the high N bits of the random number space with the N-bit computing offset in its respective register as the starting computing value, and uses the M random numbers in the random number space starting from the starting computing value as the upper limit of the computing value. Each computing value is combined with the computing task data and hashed, and the computing value corresponding to the computing result less than the target value is sent to the control unit, wherein M does not exceed the computing quantity.
2. The data processing method according to claim 1, It is characterized in that The control unit further broadcasts the target value to each chip, and the application top layer of each chip stores the target value; Each computing core also stores a sub-target value. After performing a hash calculation, each computing core compares the calculation result with the sub-target value. If the calculation result is less than the sub-target value, the corresponding calculation value is uploaded to the top application layer of the chip to which the computing core belongs as a candidate calculation value. The application top layer of the chip combines the candidate calculation value with the calculation task data and performs hash calculation, and sends the calculation value corresponding to the calculation result being less than the target value to the control unit; Among them, the target value is smaller than the sub-target value.
3. The data processing method according to claim 2, It is characterized in that If a computing core still fails to obtain a calculation result less than the sub-target value after performing M hash calculations, the calculation of the computing task data will be stopped and no notification will be sent to the top application layer of the corresponding chip.
4. The data processing method according to claim 2, It is characterized in that The control unit is sequentially connected in series with the chips in the computing device; The control unit numbers the computing cores in all chips of the computing device, and sends the number of the computing core in the chip to each chip; The control unit sends the corresponding N-bit calculation offset to a computing core with a certain number via a directly connected chip. When a chip receives the N-bit calculation offset of the certain number, it determines whether the certain number belongs to the computing core in the chip. If so, the N-bit calculation offset of the certain number will no longer be forwarded to the next chip, and the N-bit calculation offset of the certain number will be stored in the register of the corresponding computing core. Otherwise, the N-bit calculation offset of the certain number will be forwarded to the next chip.
5. The data processing method according to claim 1, It is characterized in that After receiving multiple calculation values, the control unit combines each received calculation value with the calculation task data and performs hash calculation, and sends the calculation value corresponding to the calculation result smaller than the target value to the upstream.
6. A data processing device, It is characterized in that include: Control unit and computing device; The control unit obtains the total number of computing cores in all chips of the computing device; The control unit calculates the number of calculations corresponding to each computing core according to the random number space and the total number, and calculates an initial random number in the form of an N-bit floating point number for each computing core according to the number of calculations as an N-bit calculation offset; wherein N is less than the number of bits in the random number space; The control unit sends a corresponding N-bit calculation offset to each chip, and each chip receives the N-bit calculation offset belonging to its own computing core and stores it in a register of the corresponding computing core; The control unit broadcasts the same computing task data to all chips of the computing device. After each computing core of each chip receives the computing task data, it replaces the high N bits of the random number space with the N-bit computing offset in its respective register as the starting computing value, and uses the M random numbers in the random number space starting from the starting computing value as the upper limit of the computing value. Each computing value is combined with the computing task data and hashed, and the computing value corresponding to the computing result less than the target value is sent to the control unit, wherein M does not exceed the computing quantity.
7. The data processing device according to claim 6, It is characterized in that The control unit further broadcasts the target value to each chip, and the application top layer of each chip stores the target value; Each computing core also stores a sub-target value. After performing a hash calculation, each computing core compares the calculation result with the sub-target value. If the calculation result is less than the sub-target value, the corresponding calculation value is uploaded to the top application layer of the chip to which the computing core belongs as a candidate calculation value. The application top layer of the chip combines the candidate calculation value with the calculation task data and performs hash calculation, and sends the calculation value corresponding to the calculation result being less than the target value to the control unit; Among them, the target value is smaller than the sub-target value.
8. The data processing device according to claim 7, It is characterized in that If a computing core still fails to obtain a calculation result less than the sub-target value after performing M hash calculations, the calculation of the computing task data will be stopped and no notification will be sent to the top application layer of the corresponding chip.
9. The data processing device according to claim 7, It is characterized in that The control unit is sequentially connected in series with the chips in the computing device; The control unit numbers the computing cores in all chips of the computing device, and sends the number of the computing core in the chip to each chip; The control unit sends the corresponding N-bit calculation offset to a computing core with a certain number via a directly connected chip. When a chip receives the N-bit calculation offset of the certain number, it determines whether the certain number belongs to the computing core in the chip. If so, the N-bit calculation offset of the certain number will no longer be forwarded to the next chip, and the N-bit calculation offset of the certain number will be stored in the register of the corresponding computing core. Otherwise, the N-bit calculation offset of the certain number will be forwarded to the next chip.
10. The data processing device according to claim 6, It is characterized in that After receiving multiple calculation values, the control unit combines each received calculation value with the calculation task data and performs hash calculation, and sends the calculation value corresponding to the calculation result smaller than the target value to the upstream.
