CPU-DCU architecture-oriented astronomical identification calculation memory access optimization method

Through the astronomical certification and memory access optimization method for the CPU-DCU architecture, the bottleneck of data cross-grid authentication in the astronomical cross-certification system is solved, and efficient data access and computing performance improvement is achieved.

CN119960984AActive Publication Date: 2025-05-09TIANJIN UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510040418.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-10
Publication Date
2025-05-09
Estimated Expiration
2045-01-10

AI Technical Summary

Technical Problem

In the process of cross-certification of large-scale star tables, the existing astronomical cross-certification system has bottlenecks in cross-grid authentication, resulting in low memory access efficiency and inability to effectively utilize high-performance computing resources.

Method used

The astronomical authentication calculation memory access optimization method for CPU-DCU architecture is adopted, and the celestial data is stored through grid processing and vectorization. The transmission subtask is divided using the maximum thread concurrent number of DCU, and the kernel function and double buffering mechanism are set to optimize the memory access process of data between the DCU global memory and computing components.

Benefits of technology

It improves the memory access efficiency of DCU's certification calculation, improves the overall computing performance of astronomical cross-certification authentication algorithm, and can significantly improve the efficiency of certification and authentication calculation while ensuring the calculation accuracy and integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119960984A_ABST
    Figure CN119960984A_ABST
Patent Text Reader

Abstract

The invention discloses an astronomical identification calculation memory access optimization method for a CPU-DCU architecture, and the method comprises the steps: S1, carrying out the grid processing of the celestial body data of a to-be-identified star catalogue A and a to-be-identified star catalogue B, and recording the boundary information of each grid through the hierarchical vectorization of star catalogue-strip-grid; s2, dividing celestial body data in the star catalogue A and the star catalogue B into a plurality of transmission sub-tasks corresponding to each DCU by taking a stripe as a unit according to the maximum thread concurrency number of each DCU; s3, setting a calculation task of a single thread in the DCU; s4, setting a kernel function, and enabling each thread of the DCU to complete identification calculation by executing the kernel function; s5, performing identification calculation on celestial bodies in the star catalogue A and the star catalogue B by adopting the method in the step S4; according to the method, the memory access performance of astronomical gridding calculation on the DCU is improved while the calculation precision and integrity are guaranteed, and the overall calculation performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of high performance computing technology in astronomy and computer science, and in particular to a method for optimizing memory access for astronomical authentication computing in a CPU-DCU architecture. Background Art

[0002] As the basis of a series of astronomical research, cross-verification of astronomical star catalogs requires large-scale computing resources to achieve an efficient verification process.

[0003] The existing astronomical cross-verification system maps the data to the grids divided on the celestial sphere according to the right ascension and declination of the astronomical data, and limits the verification calculation to the inside of the grid, avoiding the circular verification of the entire star catalog and accelerating the cross-verification process on homogeneous or heterogeneous computing clusters. Among them, one problem caused by grid division is that the data at the grid boundary may be cross-grid verified. In the existing system, either the data redundancy is used to make the data that may be cross-grid verified redundant to the corresponding grid, or verification between grids is introduced.

[0004] Currently, the data generated by astronomical telescopes and sky survey projects are becoming increasingly large, and the amount of celestial body data constructed is gradually increasing. The entries in star catalogs can often reach the billion level. The memory and computing power required for cross-verification of star catalogs of this scale exceed the limitations of the existing astronomical cross-verification system. To achieve cross-verification within the specified time, it is necessary to use high-performance computing technology to make improvements in algorithms and computing power.

[0005] Heterogeneous computing nodes usually include CPUs and coprocessors. As a coprocessor, DCU has excellent computing capabilities and can efficiently process computing-intensive tasks.

[0006] On heterogeneous computing clusters using DCU as coprocessors, by designing corresponding data processing strategies, it is possible to better utilize the multi-core performance of the CPU and improve the efficiency of cross-authentication. However, through the performance analysis of the authentication calculation process on the DCU, it is found that there is still a bottleneck in the memory access process between the global memory of the DCU and the computing components. Therefore, how to further improve the data access efficiency of the authentication calculation on the DCU, and then improve the performance of the astronomical cross-authentication algorithm, is a technical problem that needs to be solved urgently. Summary of the invention

[0007] The purpose of the present invention is to provide a method for optimizing memory access for astronomical authentication computing in a CPU-DCU architecture that solves the above-mentioned technical problems.

[0008] To this end, the technical solution of the present invention is as follows:

[0009] A memory access optimization method for astronomical authentication computing based on CPU-DCU architecture, the steps are as follows:

[0010] S1. Grid the celestial body data of the star catalog A and the star catalog B to be verified, and vectorize them at the level of star catalog-strip-grid, and record the boundary information of each grid;

[0011] S2. According to the maximum concurrent number of threads of each DCU, the celestial body data in the star catalog A and the star catalog B are divided into multiple transmission subtasks corresponding to each DCU in stripes, and each transmission subtask is controlled by the CPU. The transmission mechanism from the host-side memory to the DCU global memory is as follows: when the DCU performs the authentication calculation of the celestial body data of the current transmission subtask, the CPU can control the transmission of the celestial body data corresponding to the next transmission subtask from the host-side memory to the DCU global memory;

[0012] S3, setting the computing task of a single thread in DCU as follows: each celestial body in star table A corresponds to one thread, so that the thread is responsible for the verification calculation of the celestial body in star table A and all celestial bodies in the same grid and all adjacent grids in star table B;

[0013] S4. Set the kernel function so that each thread of DCU completes the authentication calculation by executing the kernel function; the kernel function is set to process the celestial body data as follows:

[0014] 1) Create a shared memory for storing celestial body data in catalog B, so that threads within the thread bundle reuse the same data in the shared memory;

[0015] 2) According to the grid to which the celestial body in star table A belongs, which is assigned by the first thread in the thread warp, the left boundary of the grid to be called in star table B is determined, and according to the grid to which the celestial body in star table A belongs, which is assigned by the last thread in the thread warp, the right boundary of the grid to be called in star table B is determined;

[0016] 3) Setting up a double buffer mechanism, loading the celestial body data determined in step S402 in star catalog B from the global memory of the DCU into the shared memory in batches, and performing authentication calculation on the celestial body data already loaded into the shared memory;

[0017] S5. Use the authentication calculation mechanism set in step S4 to complete the authentication calculation between the celestial bodies in star catalog A and star catalog B.

[0018] Furthermore, in step S1, the gridding method for celestial body data in the star catalog is:

[0019] (1) Set the strip height h, and calculate the strip index zone of each celestial body according to the declination Dec of the celestial body id :zone id = Dec / h, to divide the celestial body into strips first;

[0020] (2) Set the error radius r and calculate whether the strips obtained when the declination of each celestial body is Dec+r and Dec-r are the same as the strips calculated from the declination Dec:

[0021] 1) If the stripe calculated based on Dec+r or Dec–r is the same as the original stripe, there is no need to supplement the drain source;

[0022] 2) If any of the strips calculated based on Dec+r or Dec–r are different, it is necessary to supplement the source. The method of supplementing the source is to add the original celestial body data to different strips at the same time.

[0023] (3) For the star catalog data in each strip obtained in step (2), calculate the grid to which each celestial body belongs according to the right ascension RA of each celestial body. id :Grid id =RA / h to divide each strip into a grid.

[0024] Furthermore, in step S1, the steps of vectorizing the celestial body data in each catalog in the catalog-strip-grid hierarchy are as follows:

[0025] (1) The position data of each celestial body is represented by a structure consisting of two double data types that store right ascension and declination in sequence, and the identity information of each celestial body is represented by an int64_t data type.

[0026] (2) The celestial body data in the star catalog are divided into strips and arranged in order of the divided strips; then the celestial body data in each strip are gridded according to the gridding method described in the above gridding method, and arranged in order of the divided grids; then the celestial body data in each grid are arranged in sequence, and each star catalog forms an array consisting of several double type data and an array consisting of several int64_t type data.

[0027] (3) Record the boundary information of each grid in the celestial body data array, that is, the array subscript corresponding to the first celestial body in each grid and the array subscript corresponding to the last celestial body. This array is an array storing identity information. For example, if the subscript corresponding to a celestial body in the array is i, then the subscript corresponding to the right ascension of the celestial body in the array storing the position information is 2i, and the subscript corresponding to the declination of the celestial body is 2i+1.

[0028] Furthermore, in step S2, the steps of dividing the multiple transmission subtasks of each DCU are as follows:

[0029] S201. Determine the maximum number of concurrent threads for each DCU max , the calculation formula is:

[0030] thread max =num CU ×num SIMD ×num wavefront ×X,

[0031] In the formula, num CU is the number of computing units, num SIMD The number of SIMDs in each computational unit, num wavefront is the number of vector computing units, X is the size of the vector computing unit;

[0032] S202, according to the number n of DCUs dcu and the maximum number of concurrent threads max , divide the data that needs to be input into DCU for calculation;

[0033] S203. For the multiple stripes allocated to each DCU, according to the set subtask scale, the multiple stripes are divided into multiple transmission subtasks in the arrangement order of the stripes, so as to be transmitted to the DCU in batches.

[0034] Furthermore, the specific implementation steps of step S202 are:

[0035] S2021. Determine the number of celestial bodies in each strip in the star catalog i 、The sum of the number of celestial bodies in all strips num sum and the number of stripes num c , and the maximum number of concurrent threads per DCU S j , the sum of the concurrent number of threads of all DCUs S sum , and the number of DCUs n dcu , where the maximum number of concurrent threads per DCU is S j Substitute the result thread calculated in step S301 max ;

[0036] S2022, according to the maximum number of concurrent threads of each DCU S j Allocate stripes from high to low until the condition is met for the first time:

[0037] 0≤start<end<num c , i=start,...,end,

[0038] Wherein, start and end are the sequence number of the first stripe and the sequence number of the last stripe among the multiple stripes allocated to the DCU, respectively.

[0039] Furthermore, in step S4, the double buffering mechanism is set as follows:

[0040] 1) Divide the shared memory into two memory areas, and use them alternately as the calculation buffer and the data loading buffer; the memory area used as the calculation buffer is used to store the celestial body data loaded into the shared memory, so that the thread can retrieve the celestial body data in the shared memory; the memory area used as the data loading buffer is used to load the next batch of data for authentication calculation from the global memory of the DCU;

[0041] 2) In each functional role iteration of the two memory areas, the thread reads the celestial body data from the current calculation buffer of the shared memory for authentication calculation, and loads the next batch of data in the global memory of the DCU into the current data loading buffer;

[0042] 3) Perform thread synchronization each time the functional roles of the two memory areas are alternating.

[0043] Furthermore, in step S5, the thread temporarily stores the single authentication result between the corresponding celestial body in star catalog A and a celestial body in star catalog B in the register. When the authentication calculation between the celestial body in star catalog A and all related celestial bodies in star catalog B is completed, the thread writes the authentication result from the register back to the DCU global memory.

[0044] Furthermore, the astronomical identification calculation memory access optimization method for the CPU-DCU architecture also includes step S6: after all celestial bodies in star catalog A have completed the identification calculation with the celestial bodies in star catalog B, the identification results are transferred from the global memory of the DCU back to the host memory, and the CPU controls the conversion of the identification results into the IDs of each pair of celestial bodies in star catalog A and star catalog B respectively. The conversion process is set as follows:

[0045] 1) DCU returns an array whose subscript corresponds to the subscript of the array storing identity information of star catalog A, and the value corresponding to the subscript is the subscript of the array storing identity information of star catalog B.

[0046] 2) Let the array returned by DCU be named cm_result, the array storing the identity information of star catalog A be a, the array storing the identity information of star catalog B be b, and a certain identification result information be cm_result[i]. When each celestial body records an identification result, the corresponding identity information of the celestial body in star catalog A is ID=a[i], and the identity information of the celestial body in star catalog B is ID=b[cm_result[i]]. Thus, one identification result is converted into an ID pair, corresponding to the celestial bodies identified in star catalog A and star catalog B.

[0047] Compared with the existing technology, this astronomical certification computing memory access optimization method for the CPU-DCU architecture can improve the memory access efficiency of certification computing on the DCU while ensuring the calculation accuracy and integrity, thereby improving the overall computing performance of astronomical cross-certification. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 It is a flow chart of the memory access optimization method for astronomical authentication calculation facing CPU-DCU architecture of the present invention;

[0049] Figure 2 This is a schematic diagram of the data structure after the celestial body data in the star catalog is gridded and vectorized in step S1 of the astronomical authentication calculation memory access optimization method for the CPU-DCU architecture of the present invention.

[0050] Figure 3 It is a schematic diagram of the data loading mode between a thread warp and the shared memory in step S402 of the astronomical authentication computing memory access optimization method for CPU-DCU architecture of the present invention.

[0051] Figure 4 It is a schematic diagram of data changes during the star catalog division process in steps S1 and S2 of the astronomical authentication computing memory access optimization method for CPU-DCU architecture of the present invention. DETAILED DESCRIPTION

[0052] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but the following embodiments are by no means intended to limit the present invention in any way.

[0053] See also Figure 1 The specific implementation steps of the astronomical grid computing memory access optimization strategy for the CPU-DCU architecture are as follows:

[0054] S1. Grid the celestial body data of the star catalog A and the star catalog B to be verified, and vectorize them at the level of star catalog-strip-grid, and record the boundary information of each grid;

[0055] Each star catalog to be verified contains several celestial bodies, and each celestial body corresponds to multiple celestial body data; in this application, the celestial body data involved in each celestial body are: celestial body identity information, ID, and celestial body position information, right ascension RA and declination Dec.

[0056] In step S1, the gridding method for the celestial body data in the star catalog to be authenticated is: firstly, the celestial body data in the star catalog is divided into strips according to declination and the source is supplemented, and then the strips are gridded in parallel according to right ascension.

[0057] In step S1, the steps of dividing the celestial body data into strips according to declination and supplementing the source are as follows:

[0058] (1) Set the strip height h and calculate the strip index zone of each celestial body id ,

[0059] Among them, strip zone id The specific calculation formula is:

[0060] zone id = Dec / h,

[0061] Where Dec is the declination of the celestial body, h is the strip height, and in this embodiment, h is set to 1 / 60;

[0062] (2) Setting the error radius r, calculating when the declination of each celestial body is Dec+r and Dec-r, using the same strip calculation method as above, respectively calculating the strip corresponding to the declination of Dec+r and the strip corresponding to the declination of Dec-r, and judging whether the strips calculated above are the same as the strips corresponding to the declination of Dec calculated in step S101:

[0063] 1) If the stripe calculated based on Dec+r or Dec-r is the same as the original stripe, there is no need to supplement the drain source;

[0064] 2) If there is a difference in any of the strips calculated based on Dec+r or Dec-r, it is necessary to supplement the source of leakage. The method of supplementing the source of leakage is to add the original celestial body data (ie, ID, Dec and RA) to different strips at the same time to solve the leakage problem in the declination direction.

[0065] Among them, the error radius r can be calculated according to the formula: It is calculated that, where R_A and R_B are the accuracy of star catalog A and star catalog B respectively, and their specific values ​​are: 0.001388889 / 5 (degrees in decimal form, this value represents 1 second of angle, 5 seconds of angle corresponds to the resolution of the observation equipment, here it represents the change of cross-certification accuracy relative to the observation accuracy).

[0066] In step S1, based on the pre-strip division, the steps of gridding the celestial body data in each strip are:

[0067] For the celestial body data in each strip, calculate the grid to which each celestial body belongs according to the right ascension RA of each celestial body id , and its calculation formula is:

[0068] Grid id =RA / h,

[0069] Where RA is the right ascension of the celestial body and h is the strip height.

[0070] In step S1, based on the above-mentioned grid processing method, the steps of vectorizing the celestial body data in each star catalog in the star catalog-strip-grid hierarchy are as follows:

[0071] (1) The declination and right ascension of a celestial body are stored using double type data, each of which occupies 8 bytes. Furthermore, the position data of each celestial body is composed of two double data, which store the right ascension and the declination in sequence, and can be expressed as "double N double N+1 ", N ≥ 0; the identity information ID of the celestial body is stored in int64_t type data, and each int64_t type data occupies 8 bytes.

[0072] (2) The celestial body data in the star catalog are divided into strips according to the strip division method described in the above gridding method, and the divided strips are divided into zones. id Arrange in order; then each strip zone id The celestial body data in the grid is divided into grids according to the grid division method described in the above grid division method, and the grids are divided into grids according to the grid division method. id Arrange in order; then each grid id The celestial body data in the table are arranged in sequence, and each star catalog forms an array consisting of several double type data and an array consisting of several int64_t type data.

[0073] by Figure 2 As shown in the figure, after the vectorization processing in step (2), the new celestial body data of all celestial bodies are firstly in the form of strips (e.g. Figure 2 zone0…zone l ) in order, and then the celestial bodies in the same strip are arranged according to the grid they belong to (e.g. Figure 2 Grid0…Grid in zone0 h ) are arranged in order, and finally the celestial data in each grid (for example Figure 2 In Grid0, double0, double1…double h ) to arrange them.

[0074] (3) Record the boundary information of each grid in turn, that is, the array subscript corresponding to the first celestial body in each grid and the array subscript corresponding to the last celestial body. This array is an array for storing identity information;

[0075] For example, if the corresponding subscript of a celestial body in the identity information array is i, then the corresponding subscript of the right ascension of the celestial body in the array storing the position information is 2i, and the corresponding subscript of the declination is 2i+1; the subscripts start from the number 0 and are assigned in sequence according to the order in which the data is arranged; then, when the data is subsequently called, the right ascension and declination of all celestial bodies in the specified strip and the specified grid can be quickly retrieved through the subscripts.

[0076] In step S1, by compactly storing the right ascension and declination of each celestial body and compactly vectorizing the above two types of data for all celestial bodies, the data can be strategically arranged in advance. The celestial body data layout is adjusted so that during continuous access, the compact data layout can avoid accessing different memory areas, thus reducing memory access transactions to a certain extent. At the same time, it can ensure memory alignment and improve the efficiency of memory merged access.

[0077] S2. According to the maximum concurrent number of threads of each DCU, the celestial body data of the two star catalogs obtained by processing in step S1 are divided into a plurality of transmission subtasks corresponding to each DCU in units of strips, and a transmission mechanism is set in which each transmission subtask is controlled by the CPU and transmitted from the host-side memory to the DCU global memory;

[0078] The specific processing steps of step S2 are:

[0079] S201. Determine the maximum number of concurrent threads for each DCU max , the calculation formula is:

[0080] thread max =num CU ×num SIMD ×num wavefront ×X,

[0081] In the formula, num CU is the number of computing units, num SIMD The number of SIMDs in each computational unit, num wavefront is the number of vector computing units, X is the size of the vector computing unit, similar to the warp_size of the thread bundle (warp) in the Nvidia GPU structure;

[0082] The Chinese name of DCU is depth computing unit. In this embodiment, DCU adopts a coprocessor produced by Haiguang Information Technology Co., Ltd. (Haiguang). DCU includes multiple computing units (CU), and the computing unit includes multiple single instruction multiple data processors (SIMD). The processor is divided into multiple vector computing units (wavefront); the size X of the vector computing unit is 64;

[0083] S202, according to the number n of DCUs dcu and the maximum number of concurrent threads max , the data that needs to be input to the DCU for calculation is divided into each DCU in stripes to balance the calculation time of each processor;

[0084] The specific steps of data division in step S202 are:

[0085] S2021. Determine the number of celestial bodies in each strip in the star catalog i 、The sum of the number of celestial bodies in all strips num sum and the number of stripes num c , and the maximum number of concurrent threads per DCU S j , the sum of the concurrent number of threads of all DCUs S sum , and the number of DCUs n dcu , where the maximum number of concurrent threads per DCU is S j Substitute the result thread calculated in step S301 max ;

[0086] S2022, according to the maximum number of threads S of each DCU j Allocate stripes from high to low until the condition is met for the first time:

[0087] 0≤start<end<num c , i=start,...,end,

[0088] Wherein, start and end are the sequence number of the first stripe and the sequence number of the last stripe among the multiple stripes allocated to the DCU respectively;

[0089] S203, for the multiple stripes allocated to each DCU, according to the set subtask scale, the multiple stripes are divided into multiple transmission subtasks in the order of arrangement of the stripes, so as to be transmitted to the DCU in batches, specifically to the DCU global memory;

[0090] Among them, the transmission mechanism of each transmission subtask is set as follows: after the CPU completes the vectorization of the celestial data in the current transmission subtask and the transmission from the host-side memory to the DCU global memory, when the DCU performs the authentication calculation of the celestial data of the current transmission subtask, the CPU can control the transmission of the celestial data of the next transmission subtask from the host-side memory to the DCU global memory.

[0091] In step S2, the celestial body data in star catalog A and star catalog B are assigned tasks according to the processing capabilities of each DCU. While allocating the celestial body data belonging to the same band in the two star catalogs to the same DCU, it can also effectively balance the computing time of each processor and maximize the data transmission efficiency by setting the transmission mechanism of the subtasks.

[0092] S3, setting the computing task of a single thread in the DCU as follows: each celestial body in the star table A corresponds to one thread, so that the thread is responsible for the verification calculation of the celestial body in the star table A and all celestial bodies in the same grid and all adjacent grids in the star table B;

[0093] Specifically, based on the maximum number of concurrent threads in step S2, max Calculation formula, each DCU has num CU computational units, each with num SIMD SIMDs, each with num wavefront A vector computing unit is a group of threads running on the vector computing unit, and a warp is called a thread warp. The size X of the vector computing unit is also the size of the thread warp. In this embodiment, the value of X is 64, that is, each thread warp contains 64 threads; therefore, each thread warp can be allocated with at most 64 celestial bodies arranged in sequence in the star catalog A.

[0094] For a single thread, a thread specifies a celestial body in the star table A and obtains the right ascension and declination of the celestial body, as well as the grid Grid to which the celestial body belongs. id ; Then, the thread is based on the grid to which the celestial body belongs id , get the grid Grid in star table B id , Grid id—1 (Grid id ) and Grid id+1 (Grid id The right ascension and declination information of all celestial bodies in the last grid of star catalog A is calculated to identify and calculate the celestial bodies in catalog A and all celestial bodies in the three grids of catalog B in turn.

[0095] In this step S3, the task allocation method of the computing task is different from the method commonly used in existing identification calculations. Specifically, compared with the existing methods, the computing tasks of the present application use the number of celestial bodies instead of the grid calculation amount as the basis for dividing the computing tasks, so that one thread is responsible for the identification calculation between a celestial body in star catalog A and all related celestial bodies in star catalog B, thereby reducing the computing task amount of each thread on the DCU and helping to improve the computing performance on the DCU.

[0096] S4. Set the kernel function so that each thread of the DCU completes the authentication calculation by executing the kernel function.

[0097] In step S4, the processing process implemented by the kernel function is set as follows.

[0098] S401. Create a shared memory for storing celestial body data in star catalog B, so that threads within a warp reuse the same data in the shared memory; specifically, the celestial body data in star catalog B is loaded from the DCU global memory into the shared memory.

[0099] In this embodiment, the shared memory applied for each block is a space capable of storing 512 double data, totaling 4KB, which can be used to store the right ascension and declination of up to 256 celestial bodies. The size of a block is usually an integer multiple of warp_size, which is set to 64 in this embodiment. All threads in a block use the same shared memory; wherein, the creation of shared memory in the DCU, the loading of data into the shared memory, and the reuse of data in the shared memory all adopt well-known methods.

[0100] In step S401, the created shared memory preloads data from the global memory. During loading, the memory access efficiency can be improved by merging memory accesses by multiple threads in the thread bundle. During calculation on the DCU, the thread directly obtains data from the shared memory, which has lower latency and faster speed than obtaining data from the global memory.

[0101] Specifically, using shared memory to store the celestial body data of star table B can ensure the reuse of data by multiple threads in the thread bundle. In the thread computing task corresponding to this application, multiple threads will simultaneously access all celestial body data in the same grid of star table B. When using shared memory, due to the existence of the broadcast mechanism, a single memory request can enable all threads to obtain data. When directly obtaining data from the global memory, if it cannot be guaranteed that all threads in the thread bundle initiate access to the same address at the same time, multiple memory access requests may be generated, and the addresses cannot be merged into one memory access transaction. Therefore, shared memory can improve the efficiency of thread access to celestial body data in star table B.

[0102] S402. Determine the left boundary of the grid to be called in star table B according to the grid to which the celestial body in star table A belongs which is allocated by the first thread in the thread bundle, and determine the right boundary of the grid to be called in star table B according to the grid to which the celestial body in star table A belongs which is allocated by the last thread in the thread bundle, thereby loading the required celestial body data in star table B into the shared memory according to the left boundary and right boundary of the grid to be called determined above.

[0103] by Figure 3The thread warp of the embodiment shown in the figure is used as an example for explanation. Since the thread warp size of the DCU is 64, each thread warp can process the authentication calculation of 64 celestial bodies in the star table A. The 64 celestial bodies are arranged in sequence and may come from the same grid or from multiple different grids. Based on this, the grid Grid to which the celestial body in the star table A belongs is allocated by the first thread in the thread warp. i , determine the left boundary of the grid to be called in star table B, that is, the grid Grid in star table B i-1 ; According to the Grid to which the celestial body in the star table A belongs, which is assigned by the last thread in the thread bundle j , determine the right boundary of the grid to be called in star table B, that is, Grid j+1 ; Then, according to the left and right boundaries of the grid to be called, the grid in the star table B is i-1 To Grid j+1 All celestial body data in the thread warp are loaded into the shared memory, so that all relevant celestial bodies in the star mark B required for the identification calculation of all star catalog A celestial bodies in the thread warp are loaded into the shared memory.

[0104] S403, setting a double buffer mechanism, loading the celestial body data determined in step S402 in star catalog B from the global memory of the DCU into the shared memory in batches, and synchronously performing authentication calculation on the celestial body data already loaded into the shared memory.

[0105] In step S403, the double buffering mechanism is set as follows:

[0106] S4031, dividing the shared memory created based on step S401 into two memory areas, and making the two alternately serve as a calculation buffer and a data loading buffer, that is, when the thread is running, the memory area used as the calculation buffer is used to store the celestial body data loaded into the shared memory, so that the thread can retrieve the celestial body data in the shared memory and perform authentication calculation, and the memory area used as the data loading buffer is used to store the next batch of data loaded from the global memory for authentication calculation;

[0107] S4032. In each iteration of the functional roles of the two memory areas, the thread reads the celestial body data from the current calculation buffer of the shared memory to perform the authentication calculation, and at the same time, loads the next batch of data in the global memory into the current data loading buffer; then, the roles of the two buffers are exchanged, that is, the alternating switching between calculation and data loading is continued in the next iteration;

[0108] S4033. Perform thread synchronization each time the functional roles of the two memory areas are switched to avoid data contention and erroneous access.

[0109] In step S403, the advantage of the dual buffer mechanism in which two memory areas are alternately used as a calculation buffer and a data loading buffer is that data access and calculation can be parallelized at the thread level. The overlapping of data access time and calculation time can hide the delay of memory access, allowing memory access operations and calculation operations to be performed in parallel, reducing the time the thread waits for data loading, thereby improving the overall computing efficiency. Among them, the specific implementation methods of the above two buffers and thread synchronization can all adopt known methods.

[0110] Furthermore, in step S4, during the process of performing celestial body authentication calculations on the DCU, multiple strategies of creating shared memory and setting a double buffer mechanism to overlap data access and calculations are used in turn to achieve the purpose of improving the efficiency of data memory access during thread calculations, thereby effectively improving the computing performance on the DCU.

[0111] S5, using the authentication calculation mechanism set in step S4, completing the authentication calculation between the celestial bodies in star catalog A and star catalog B;

[0112] During the authentication calculation process, the thread temporarily stores the single authentication result of the corresponding celestial body in star catalog A and a celestial body in star catalog B in the register. When the authentication calculation of the celestial body in star catalog A and all related monomers in star catalog B is completed, the thread writes the authentication result from the register back to the DCU global memory. This data transmission method can avoid multiple modifications of data in the global memory and improve the memory access efficiency of recording and modifying the authentication calculation results.

[0113] The specific authentication calculation method between two celestial bodies adopts a known calculation method; because there are cases where a single celestial body is authenticated by multiple celestial bodies, in this embodiment, three times the space is allocated for the authentication result of each celestial body during the authentication calculation, that is, a maximum of three authentication results can be recorded (the number can be changed, only three are used as an example here). In the authentication calculation process, the three calculation results corresponding to the spherical distance d ≤ error radius r and the smallest spherical distance d are selected as the authentication selection results, and the register is temporarily stored or the current temporary result of the register is updated (when the number of successfully authenticated celestial bodies is less than three, only the information of the successfully authenticated celestial bodies is recorded);

[0114] The calculation formula of the spherical distance d is:

[0115]

[0116] Where RA1 and RA2 are the right ascensions of the two celestial bodies, Dec1 and Dec2 are the declinations of the two celestial bodies;

[0117] S6. After all the celestial bodies in star catalog A have completed the identification calculation with the celestial bodies in star catalog B, the identification results are transferred from the global memory of the DCU back to the host memory, and the CPU controls the conversion of the identification results into the IDs of each pair of celestial bodies in star catalog A and star catalog B respectively. The conversion process is set as follows:

[0118] 1) DCU returns an array whose subscript corresponds to the subscript of the array storing identity information of star catalog A, and the value corresponding to the subscript is the subscript of the array storing identity information of star catalog B.

[0119] 2) Assume that the array returned by DCU is named cm_result, the array storing the identity information of star catalog A is a, the array storing the identity information of star catalog B is b, and a certain identification result information is cm_result[i]. Since in this embodiment, each celestial body corresponds to a maximum of three identification results, the corresponding identity information of the celestial body in star catalog A is ID=a[i / 3], and the identity information of the celestial body in star catalog B is ID=b[cm_result[i]] unchanged. Therefore, one identification result is converted into an ID pair, corresponding to the celestial body identified in star catalog A and star catalog B.

[0120] In order to further demonstrate the superiority of the astronomical authentication computing memory access optimization method for the CPU-DCU architecture of the present application over the existing authentication algorithms, the following comparative experiments are used to demonstrate it.

[0121] Specifically, the comparative experiment was conducted on a server with two 8-core CPUs and two Z100L DCU computing cards. The experiment cross-verified one-eighth of the data in the SDSS dataset and compared the running results.

[0122] like Figure 1 As shown, kernel_v2 corresponds to the authentication algorithm of the prior art, and kernel_v3 corresponds to the astronomical authentication calculation memory access optimization method of this application; the difference in the algorithm between the two is as follows Figure 1 The part indicated by the blue box in the middle specifically includes: 1) in the kernel_v2 experiment, the right ascension and declination of the celestial body data in each star catalog are stored separately and called separately in the subsequent authentication; while in the kernel_v3 experiment, the celestial body data in each star catalog are stored in a compactly stored vectorized manner through continuous gridding processing; 2) in the kernel_v2 experiment, the threads on the DCU computing card correspond to the authentication of a single sky area and a single sky area, and do not use shared memory and double buffering mechanism; while the kernel_v3 experiment threads corresponding to the present application correspond to the authentication of a single celestial body and a single sky area, and use shared memory and double buffering mechanism to optimize the memory access process of grid computing.

[0123] In addition, the cross-validation results of the CPU version are added to prove the acceleration effect of using DCU calculation for the process. The parameters of the grid division in the CPU version code are consistent with the two versions of the DCU code, and multi-threaded acceleration calculation is used. Since there is no data rearrangement process in the CPU version, only the validation time is used to compare with the above two experiments.

[0124] The specific experimental results of the three experiments are shown in Table 1 below.

[0125] Table 1:

[0126]

[0127] In Table 1, the data re-arrangement time refers to the time it takes for the star catalog data to be gridded and vectorized in the host memory under the control of the CPU.

[0128] The data transfer time from host memory to device memory refers to the time it takes for the quantized catalog data to be transferred from the host memory to the global memory of the DCU under the control of the CPU.

[0129] The identification calculation time refers to the time to complete the identification calculation of the celestial bodies inside the grid. kernel_v2 and kernel_v3 perform the calculation of this step in DCU, and the CPU version code uses CPU multi-threading to perform the calculation of this step in parallel.

[0130] From the comparison results in Table 1, it can be seen that under similar calculation processes, the method corresponding to the present application uses DCU, which is more than 3 times more efficient than simply using the CPU for cross-authentication. In the authentication process, the astronomical authentication calculation memory access optimization method for the CPU-DCU architecture of the present application uses a slightly longer data reordering time than the prior art except that the data reordering time in the data reordering stage is slightly longer than the data reordering time in the prior art. However, the data reordering details of the present application are related to the subsequent authentication calculation. Based on the new data reordering of the present application, the subsequent authentication calculation process is significantly lower than the authentication calculation process of the prior art. When the authentication task volume remains unchanged, the kernel calculation time corresponding to the method of the present application is significantly reduced, which proves the effectiveness of shared memory and double buffering mechanisms. The astronomical grid computing memory access optimization strategy for the CPU-DCU architecture of the present application is superior to the existing authentication schemes.

[0131] In summary, the astronomical authentication computing memory access optimization method for the CPU-DCU architecture of the present application can improve the memory access performance of astronomical grid computing on the DCU compared to the existing authentication schemes, thereby achieving an improvement in the overall computing performance.

Claims

1. A method for optimizing memory access for astronomical authentication computing based on CPU-DCU architecture, characterized in that: Here are the steps: S1. Grid the celestial body data of the star catalog A and the star catalog B to be verified, and vectorize them at the level of star catalog-strip-grid, and record the boundary information of each grid; S2. According to the maximum concurrent number of threads of each DCU, the celestial body data in the star catalog A and the star catalog B are divided into multiple transmission subtasks corresponding to each DCU in stripes, and each transmission subtask is controlled by the CPU. The transmission mechanism from the host-side memory to the DCU global memory is as follows: when the DCU performs the authentication calculation of the celestial body data of the current transmission subtask, the CPU can control the transmission of the celestial body data corresponding to the next transmission subtask from the host-side memory to the DCU global memory; S3, setting the computing task of a single thread in DCU as follows: each celestial body in star table A corresponds to one thread, so that the thread is responsible for the verification calculation of the celestial body in star table A and all celestial bodies in the same grid and all adjacent grids in star table B; S4. Set the kernel function so that each thread of DCU completes the authentication calculation by executing the kernel function; the kernel function is set to process the celestial body data as follows: 1) Create a shared memory for storing celestial body data in catalog B, so that threads within the thread bundle reuse the same data in the shared memory; 2) According to the grid to which the celestial body in star table A belongs, which is assigned by the first thread in the thread warp, the left boundary of the grid to be called in star table B is determined, and according to the grid to which the celestial body in star table A belongs, which is assigned by the last thread in the thread warp, the right boundary of the grid to be called in star table B is determined; 3) Setting up a double buffer mechanism, loading the celestial body data determined in step S402 in star catalog B from the global memory of the DCU into the shared memory in batches, and performing authentication calculation on the celestial body data already loaded into the shared memory; S5. Use the authentication calculation mechanism set in step S4 to complete the authentication calculation between the celestial bodies in star catalog A and star catalog B.

2. The method for optimizing memory access for astronomical authentication calculation based on CPU-DCU architecture according to claim 1, characterized in that: In step S1, the gridding processing method for celestial body data in the star catalog is: (1) Set the strip height h, and calculate the strip index zone of each celestial body according to the declination Dec of the celestial body id :zone id = Dec / h, to divide the celestial body into strips first; (2) Set the error radius r, and calculate whether the calculated band is the same as the band calculated by the declination Dec when the declination of each celestial body is Dec+r and Dec-r: 1) If the band calculated based on Dec+r or Dec-r is the same as the original band, there is no need to supplement the source; 2) If any of the bands calculated based on Dec+r or Dec-r is different, it is necessary to supplement the source; the method of supplementing the source is: adding the original celestial body data to different bands at the same time; (3) For the star catalog data in each strip obtained in step (2), calculate the grid to which each celestial body belongs according to the right ascension RA of each celestial body. id :Grid id =RA / h to divide each strip into a grid.

3. The method for optimizing memory access for astronomical authentication calculation based on CPU-DCU architecture according to claim 2, characterized in that: In step S1, the steps of vectorizing the celestial body data in each catalog in the catalog-strip-grid hierarchy are as follows: (1) The position data of each celestial body is represented by a structure consisting of two double data types that store right ascension and declination in sequence, and the identity information of each celestial body is represented by an int64_t data type. (2) The celestial body data in the star catalog are divided into strips and arranged in order of the divided strips; then the celestial body data in each strip are gridded according to the gridding method described in the above gridding method, and arranged in order of the divided grids; then the celestial body data in each grid are arranged in sequence, and each star catalog forms an array consisting of several double type data and an array consisting of several int64_t type data. (3) Record the boundary information of each grid in the celestial body data array, that is, the array subscript corresponding to the first celestial body in each grid and the array subscript corresponding to the last celestial body. This array is an array for storing identity information.

4. The DCU-oriented astronomical grid computing memory access optimization strategy according to claim 3, characterized in that: In step S2, the steps of dividing multiple transmission subtasks of each DCU are as follows: S201. Determine the maximum number of concurrent threads for each DCU max , the calculation formula is: thread max =num CU ×num SIMD ×num wav∈front ×X, In the formula, num CU is the number of computing units, num SIMD The number of SIMDs in each computational unit, num wavefront is the number of vector computing units, X is the vector computing unit size, that is, the number of threads running on the vector computing unit; S202, according to the number n of DCUs dcu and the maximum number of concurrent threads max , divide the data that needs to be input into DCU for calculation; S203. For the multiple stripes allocated to each DCU, according to the set subtask scale, the multiple stripes are divided into multiple transmission subtasks in the arrangement order of the stripes, so as to be transmitted to the DCU in batches.

5. The method for optimizing memory access for astronomical authentication computing based on CPU-DCU architecture according to claim 4 is characterized in that: The specific implementation steps of step S202 are: S2021. Determine the number of celestial bodies in each strip in the star catalog i 、The sum of the number of celestial bodies in all strips num sum and the number of stripes num c , and the maximum number of concurrent threads per DCU S j , the sum of the concurrent number of threads of all DCUs S sum , and the number of DCUs n dcu , where the maximum number of concurrent threads per DCU is S j Substitute the result thread calculated in step S301 max ; S2022, according to the maximum number of concurrent threads of each DCU S j Allocate stripes from high to low until the condition is met for the first time: Wherein, start and end are the sequence number of the first stripe and the sequence number of the last stripe among the multiple stripes allocated to the DCU, respectively.

6. The method for optimizing memory access for astronomical authentication calculations based on CPU-DCU architecture according to claim 1, characterized in that: In step S4, the double buffering mechanism is set as follows: 1) Divide the shared memory into two memory areas, and use them alternately as the calculation buffer and the data loading buffer; the memory area used as the calculation buffer is used to store the celestial body data loaded into the shared memory, so that the thread can retrieve the celestial body data in the shared memory; the memory area used as the data loading buffer is used to load the next batch of data for authentication calculation from the global memory of the DCU; 2) In each functional role iteration of the two memory areas, the thread reads the celestial body data from the current calculation buffer of the shared memory for authentication calculation, and loads the next batch of data in the global memory of the DCU into the current data loading buffer; 3) Perform thread synchronization each time the functional roles of the two memory areas are alternating.

7. The method for optimizing memory access for astronomical authentication computing based on CPU-DCU architecture according to claim 1, characterized in that: In step S5, the thread temporarily stores the single authentication result between the corresponding celestial body in star catalog A and a celestial body in star catalog B in the register. When the authentication calculation between the celestial body in star catalog A and all related celestial bodies in star catalog B is completed, the thread writes the authentication result from the register back to the DCU global memory.

8. The method for optimizing memory access for astronomical authentication computing based on CPU-DCU architecture according to claim 1, characterized in that: The system further includes step S6: after all celestial bodies in star catalog A have completed the authentication calculation with the celestial bodies in star catalog B, the authentication results are transmitted from the global memory of the DCU back to the host memory, and the CPU controls the conversion of the authentication results into the IDs of each pair of celestial bodies in star catalog A and star catalog B respectively. The conversion process is set as follows: 1) For an array returned by DCU, the subscript of the array corresponds to the subscript of the array storing identity information of star catalog A, and the value corresponding to the subscript is the subscript of the array storing identity information of star catalog B; 2) Let the array returned by DCU be named cm_result, the array storing the identity information of star catalog A be a, the array storing the identity information of star catalog B be b, and a certain identification result information be cm_result[i]. When each celestial body records an identification result, the corresponding identity information of the celestial body in star catalog A is ID=a[i], and the identity information of the celestial body in star catalog B is ID=b[cm_result[i]]. Thus, one identification result is converted into an ID pair, corresponding to the celestial bodies identified in star catalog A and star catalog B.

Citation Information

Patent Citations

  • Astronomical star catalogue cross identification method and system

    CN117762972A

  • Heterogeneous many-core processor-oriented astronomical cross identification method

    CN118672772A

  • Position space identication method, position space identifier imparting device, and computer program

    US20220236062A1