A three-dimensional Fourier transform acceleration method, device, equipment and medium
By adopting the three-dimensional Fourier transform acceleration method of CPU parallelism and GPU concurrency in industrial software, the problem of high computational complexity of Fourier transform in the prior art is solved, and the independent controllability and computing efficiency of industrial fluid software are achieved.
Patent Information
- Application Number
- CN202411768895.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-12-04
AI Technical Summary
Existing industrial software has high computational complexity when solving Fourier transforms, making it difficult to apply to the industrial field, and there is an independent and controllable risk of relying on open source mathematical libraries or commercial code.
Through CPU parallelism and GPU concurrency, the three-dimensional Fourier transform acceleration method is used to divide the three-dimensional data set to be processed into sub-data sets, and one-dimensional Fourier transform is performed sequentially on the sub-processor, and the concurrent execution is used by the graphics processor to reduce the computational complexity.
It realizes independent control over industrial fluid software, significantly reduces the computational complexity of Fourier transform, and improves the efficiency of the data set to perform Fourier transform.
Smart Images

Figure CN119249048B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial fluids, and in particular to a three-dimensional Fourier transform acceleration method, device, equipment and medium. Background Art
[0002] With the development of GPU (Graphics Processing Unit) hardware technology (100-1000 times faster than CPU (Central Processing Unit) hardware), the corresponding industrial fluid software and other industrial software based on solving partial differential equations are also in urgent need of upgrading. Most industrial software needs to solve the Fourier mathematical transformation problem, but most of the existing industrial software relies on open source mathematical libraries or commercial codes, which is a great risk for autonomous and controllable industrial software. In addition, the Fourier solver is widely used in various industrial software, and its basic principle is not complicated. However, the Fourier solver written directly using the principles of textbooks cannot be applied to the industrial field at all due to its astronomical computational complexity. How to reduce the computational complexity of Fourier transform is also a problem that needs to be solved. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a three-dimensional Fourier transform acceleration method, device, equipment and medium, which can reduce the computational complexity of Fourier transform through CPU parallelism and GPU concurrency, and realize the autonomous control of industrial fluid software. The specific scheme is as follows:
[0004] In a first aspect, the present application provides a three-dimensional Fourier transform acceleration method, which is applied to a central processing unit, comprising:
[0005] Dividing the three-dimensional data set to be processed into a plurality of sub-data sets, and respectively allocating each of the sub-data sets to a sub-processor; the sub-processor is located in the central processing unit;
[0006] When each of the sub-processors sequentially performs one-dimensional Fourier transform on the corresponding sub-datasets in three directions, each of the sub-processors sends a general task of performing one-dimensional Fourier transform on the corresponding sub-datasets in any direction to the graphics processor, so that the graphics processor divides each of the general tasks into a plurality of sub-tasks, and uses its own plurality of stream processors to concurrently execute the plurality of sub-tasks, merges the concurrent execution results of the plurality of sub-tasks belonging to the same general task, and returns the merged results to the sub-processors corresponding to each of the general tasks to update the sub-datasets in the sub-processors;
[0007] If the one-dimensional Fourier transforms in the three directions are all completed, the current sub-data sets in the sub-processors are merged to obtain a target three-dimensional data set.
[0008] Optionally, dividing the three-dimensional data set to be processed into a plurality of sub-data sets includes:
[0009] Obtaining the preset number of grid points of the three-dimensional data set to be processed in three directions, and the preset number of parallel operations of the central processing unit in three directions;
[0010] Determine the number of target divisions corresponding to the same direction based on the preset number of grid points and the preset parallel quantity in the same direction;
[0011] The three-dimensional data set to be processed is divided into the plurality of sub-data sets using the target division quantities corresponding to the three directions respectively.
[0012] Optionally, the process of each of the sub-processors sequentially performing one-dimensional Fourier transform on the corresponding sub-data set in three directions includes:
[0013] Performing a one-dimensional Fourier transform on the corresponding sub-data set in a first direction by each of the sub-processors;
[0014] After the one-dimensional Fourier transform in the first direction is completed and the sub-data sets in each of the sub-processors are updated, one-dimensional Fourier transform is performed on the corresponding sub-data sets in the second direction by each of the sub-processors;
[0015] After the one-dimensional Fourier transform in the second direction is completed and the sub-data sets in each of the sub-processors are updated, each of the sub-processors performs a one-dimensional Fourier transform on the corresponding sub-data sets in a third direction;
[0016] The first direction, the second direction and the third direction are different directions.
[0017] Optionally, performing a one-dimensional Fourier transform on the corresponding sub-data set in the first direction by each of the sub-processors respectively includes:
[0018] Assembling the sub-data sets having the same position in the first target direction in each of the sub-processors to generate a corresponding first temporary global array, and updating the boundary data of the corresponding sub-processors based on each of the first temporary global arrays; the first target direction includes the second direction and the third direction;
[0019] By each of the sub-processors, based on the respective updated boundary data, respectively performing a one-dimensional Fourier transform on the corresponding sub-data set in the corresponding first temporary global array in the first direction;
[0020] The corresponding sub-data set in the first temporary global array is the sub-data set in the first temporary global array corresponding to the sub-processor.
[0021] Optionally, performing a one-dimensional Fourier transform on the corresponding sub-data set in the second direction by each of the sub-processors respectively includes:
[0022] Assembling the sub-data sets in each of the sub-processors that have the same position in the second target direction to generate a corresponding second temporary global array, and updating the boundary data of the corresponding sub-processors based on each of the second temporary global arrays; the second target direction includes the first direction and the third direction;
[0023] By each of the sub-processors, based on the respective updated boundary data, respectively performing a one-dimensional Fourier transform on the corresponding sub-data set in the corresponding second temporary global array in the second direction;
[0024] The corresponding sub-data set in the second temporary global array is the sub-data set in the second temporary global array corresponding to the sub-processor.
[0025] Optionally, performing one-dimensional Fourier transform on the corresponding sub-data set in the third direction by each of the sub-processors respectively includes:
[0026] Assembling the sub-data sets in the sub-processors that have the same position in a third target direction to generate a corresponding third temporary global array, and updating the boundary data of the corresponding sub-processors based on each of the third temporary global arrays; the third target direction includes the first direction and the second direction;
[0027] By each of the sub-processors, based on the respective updated boundary data, respectively performing a one-dimensional Fourier transform on the corresponding sub-data set in the corresponding third temporary global array in the third direction;
[0028] The corresponding sub-data set in the third temporary global array is the sub-data set in the third temporary global array corresponding to the sub-processor.
[0029] Optionally, the process of generating the temporary global array includes:
[0030] Based on the global data communication between the sub-processors, the sub-data sets in the sub-processors having the same position in the target direction are assembled to generate a corresponding temporary global array;
[0031] Among them, the global data communication is realized by calling a global reduction function; the global reduction function generates a corresponding temporary global array by assembling the sub-data sets with the same position in the target direction in each sub-processor based on a preset operation, and returns each temporary global array to each sub-processor.
[0032] In a second aspect, the present application provides a three-dimensional Fourier transform acceleration device, applied to a central processing unit, comprising:
[0033] A data set division module, used for dividing the three-dimensional data set to be processed into a plurality of sub-data sets, and respectively allocating each of the sub-data sets to each sub-processor; the sub-processor is located in the central processing unit;
[0034] A Fourier transform module, configured to send a general task of performing one-dimensional Fourier transform on the corresponding sub-dataset in any direction to a graphics processor through each of the sub-processors when each of the sub-processors sequentially performs one-dimensional Fourier transform on the corresponding sub-dataset in three directions, so that the graphics processor divides each of the general tasks into a plurality of sub-tasks, and uses its own plurality of stream processors to perform concurrent execution on the plurality of sub-tasks, and merges the concurrent execution results of the plurality of sub-tasks belonging to the same general task, and returns the merged results to the sub-processors corresponding to each of the general tasks to update the sub-datasets in the sub-processors;
[0035] The data set merging module is used to merge the current sub-data sets in each of the sub-processors to obtain a target three-dimensional data set if the one-dimensional Fourier transforms in the three directions are all completed.
[0036] In a third aspect, the present application provides an electronic device, including:
[0037] Memory, used to store computer programs;
[0038] A processor is used to execute the computer program to implement the aforementioned three-dimensional Fourier transform acceleration method.
[0039] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, which implements the aforementioned three-dimensional Fourier transform acceleration method when executed by a processor.
[0040] In the present application, the central processing unit divides the three-dimensional data set to be processed into several sub-data sets, and allocates each of the sub-data sets to each sub-processor; the sub-processor is located in the central processing unit; when each of the sub-processors performs one-dimensional Fourier transform on the corresponding sub-data set in three directions in sequence, the total task of performing one-dimensional Fourier transform on the corresponding sub-data set in any direction is sent to the graphics processor through each of the sub-processors, so that the graphics processor divides each of the total tasks into several sub-tasks, and uses its own several stream processors to execute the several sub-tasks concurrently, and merges the concurrent execution results of the several sub-tasks belonging to the same total task, and returns each merged result to the sub-processor corresponding to each of the total tasks to update the sub-data sets in the sub-processor; if the one-dimensional Fourier transform in the three directions is completed, the current sub-data sets in each of the sub-processors are merged to obtain the target three-dimensional data set. It can be seen that the present application uses a central processing unit to divide the three-dimensional data set to be processed into several sub-data sets, and performs one-dimensional Fourier transform on several sub-data sets in three directions in parallel through several sub-processors, thereby improving the efficiency of executing Fourier transform on the data set through the characteristics of parallel processing of the central processing unit; wherein, when a sub-processor performs a one-dimensional Fourier transform on a sub-data set, the total task of the one-dimensional Fourier transform can be divided into several sub-tasks, so as to be executed concurrently by several stream processors in the graphics processor, thereby further improving the efficiency of executing Fourier transform on the data set through the characteristics of concurrent execution of the graphics processor. Further, the present application combines data set division, sequential execution of one-dimensional Fourier transform in three directions, one-dimensional Fourier transform total task division, and central processing unit parallel processing and graphics processor concurrent execution, relative to directly executing three-dimensional Fourier transform on the data set, can greatly reduce the computational complexity of Fourier transform, and improve the efficiency of executing Fourier transform on the data set, and at the same time, the self-developed Fourier solution method can realize the autonomous control of industrial fluid software. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0042] Figure 1 A flow chart of a three-dimensional Fourier transform acceleration method disclosed in this application;
[0043] Figure 2A schematic diagram of data set division disclosed in this application;
[0044] Figure 3 A task division diagram disclosed in this application;
[0045] Figure 4 A schematic diagram of a one-dimensional Fourier transform disclosed in this application;
[0046] Figure 5 This is a schematic diagram of the structure of a three-dimensional Fourier transform acceleration device disclosed in this application;
[0047] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] Most existing industrial software relies on open source mathematical libraries or commercial codes, which is a great risk for autonomous and controllable industrial software. In addition, Fourier solvers are widely used in various industrial software. Their basic principles are not complicated, but Fourier solvers written directly using textbook principles cannot be applied to the industrial field at all due to their astronomical computational complexity. To this end, this application provides a three-dimensional Fourier transform acceleration method, which reduces the computational complexity of Fourier transform through CPU parallelism and GPU concurrency, and realizes autonomous control of industrial fluid software.
[0050] ;
[0051] The above formula is expressed in The mathematical expressions of the internal standard Fourier transform (FFT, Fast Fourier Transform) and the inverse Fourier transform (IFFT, Inverse Fast Fourier Transform), where, The directions are perpendicular to each other. And, represents an arbitrary function; represents Fourier transform; represents inverse Fourier transform; express In Fourier space projection; They are The real and imaginary parts of In Corresponding to Cartesian coordinates in physical space Under The Fourier spectrum wave number in the direction, Respectively in Unit vector in direction.
[0052] ; This formula is a supplementary Euler formula, in which is the imaginary number symbol, Represents the phase angle in the Euler formula. The complex exponential function and the trigonometric function are connected through the Euler formula, so that the Fourier transform and inverse Fourier transform of the above formula can be solved. However, in practical problems, it is usually necessary to perform Fourier transform and inverse Fourier transform operations on a large amount of three-dimensional data sets, and the calculation complexity of Fourier transform and inverse Fourier transform is relatively large.
[0053] See also Figure 1 As shown, the embodiment of the present invention discloses a three-dimensional Fourier transform acceleration method, which is applied to a central processing unit, including:
[0054] Step S11, dividing the three-dimensional data set to be processed into a plurality of sub-data sets, and respectively allocating each of the sub-data sets to a sub-processor; the sub-processor is located in the central processing unit.
[0055] In this embodiment, the three-dimensional data set to be processed is first divided by the central processing unit to obtain a number of sub-data sets, and the central processing unit includes a number of sub-processors, and the number of sub-processors is not less than the number of sub-data sets. Then, the central processing unit distributes the sub-data sets to the sub-processors respectively, that is, one sub-processor corresponds to one sub-data set.
[0056] In order to divide the three-dimensional data set to be processed into a plurality of sub-data sets, the preset number of grid points of the three-dimensional data set to be processed in three directions and the preset number of parallel operations of the central processing unit in three directions can be obtained first; wherein the three directions are mutually perpendicular directions. Then, based on the preset number of grid points and the preset number of parallel operations in the same direction, the target number of divisions corresponding to the same direction is determined. After the target number of divisions corresponding to the three directions is determined, the three-dimensional data set to be processed is divided into a plurality of sub-data sets using the target number of divisions corresponding to the three directions.
[0057] It should be noted that the preset number of grid points can be set according to the Fourier solution effect. If you want a better Fourier solution effect, you can set more preset grid points. The setting of the preset parallel number needs to consider the performance requirements of the central processing unit and the number of processor cores.
[0058] by Figure 2 For example, the three-dimensional data set to be processed can be regarded as a cube, wherein the preset number of grid points of the three-dimensional data set to be processed in the three directions (x, y, z) is Nx, Ny, Nz, and the preset number of parallel operations of the central processor in the three directions (x, y, z) is npx, npy, npz; then the target number of divisions corresponding to the same direction is determined based on the ratio between the preset number of grid points and the preset number of parallel operations in the same direction. Taking the x direction as an example, the target number of divisions is Nx / npx. Therefore, after determining the target number of divisions Nx / npx, Ny / npy, Nz / npz corresponding to the three directions (x, y, z), the three-dimensional data set to be processed is divided into several sub-data sets using the target number of divisions corresponding to the three directions; it should be noted that the number of several sub-data sets is the product of the target number of divisions corresponding to the three directions.
[0059] Step S12: When each of the sub-processors sequentially performs one-dimensional Fourier transform on the corresponding sub-datasets in three directions, each of the sub-processors sends a total task of performing one-dimensional Fourier transform on the corresponding sub-datasets in any direction to the graphics processor, so that the graphics processor divides each of the total tasks into a plurality of sub-tasks, and uses its own plurality of stream processors to concurrently execute the plurality of sub-tasks, merges the concurrent execution results of the plurality of sub-tasks belonging to the same total task, and returns the merged results to the sub-processors corresponding to each of the total tasks to update the sub-datasets in the sub-processors.
[0060] In this embodiment, after the central processing unit allocates each sub-data set to each sub-processor, the central processing unit performs one-dimensional Fourier transform on the corresponding sub-data set in three directions in sequence through each sub-processor, wherein each sub-processor sends the total task of performing one-dimensional Fourier transform on the corresponding sub-data set in any direction to the graphics processor, so that the graphics processor divides each total task into a plurality of sub-tasks, and uses its own plurality of stream processors to concurrently execute the plurality of sub-tasks to obtain the concurrent execution results corresponding to the plurality of sub-tasks, and then merges the concurrent execution results of the plurality of sub-tasks belonging to the same total task to obtain the merged results corresponding to each total task, and then returns the merged results to the sub-processors corresponding to each total task, so as to update the sub-data set in the sub-processor based on the merged results. It should be noted that the number of the plurality of stream processors in the graphics processor is not less than the number of the plurality of sub-tasks.
[0061] like Figure 3As shown, for any one of the sub-processors, when any one of the sub-processors performs one-dimensional Fourier transform on the corresponding sub-data set in any direction, any one of the sub-processors can send a total task of performing one-dimensional Fourier transform on the corresponding sub-data set in any direction to the graphics processor; wherein any one direction is any one of the three directions. After receiving the total task sent by any one of the sub-processors, the graphics processor divides the total task into several sub-tasks, that is, divides the large cube into several small cubes, and executes the several sub-tasks concurrently through its own several stream processors, thereby improving the efficiency of Fourier transform on the data set.
[0062] Specifically, the process of each subprocessor sequentially performing one-dimensional Fourier transform on the corresponding sub-data set in three directions may include: performing one-dimensional Fourier transform on the corresponding sub-data set in the first direction by each subprocessor, and after the one-dimensional Fourier transform in the first direction is completed and the sub-data sets in each subprocessor are updated, performing one-dimensional Fourier transform on the corresponding sub-data set in the second direction by each subprocessor; correspondingly, after the one-dimensional Fourier transform in the second direction is completed and the sub-data sets in each subprocessor are updated, performing one-dimensional Fourier transform on the corresponding sub-data set in the third direction by each subprocessor. The first direction, the second direction and the third direction are three different directions.
[0063] Among them, for performing a one-dimensional Fourier transform on the corresponding sub-datasets in the first direction through each sub-processor, it is necessary to first assemble the sub-datasets with the same position in the first target direction in each sub-processor to generate a corresponding first temporary global array, and update the boundary data of the corresponding sub-processors based on each first temporary global array, so as to ensure the continuity of the data in the first direction; wherein, the first target direction includes the second direction and the third direction, that is, the first target direction is the remaining two directions of the three directions except the first direction. Afterwards, each sub-processor performs a one-dimensional Fourier transform on the corresponding sub-datasets in the corresponding first temporary global array based on the updated boundary data; wherein, the corresponding sub-datasets in the first temporary global array are the sub-datasets corresponding to the sub-processors in the first temporary global array.
[0064] Among them, for performing a one-dimensional Fourier transform on the corresponding sub-datasets in the second direction through each sub-processor, it is necessary to first assemble the sub-datasets with the same position in the second target direction in each sub-processor to generate a corresponding second temporary global array, and update the boundary data of the corresponding sub-processors based on each second temporary global array, so as to ensure the continuity of the data in the second direction; wherein, the second target direction includes the first direction and the third direction, that is, the second target direction is the remaining two directions of the three directions except the second direction. Afterwards, each sub-processor performs a one-dimensional Fourier transform on the corresponding sub-datasets in the corresponding second temporary global array based on the updated boundary data; wherein, the corresponding sub-datasets in the second temporary global array are the sub-datasets corresponding to the sub-processors in the second temporary global array.
[0065] Among them, for performing one-dimensional Fourier transform on the corresponding sub-datasets in the third direction through each sub-processor, it is necessary to first assemble the sub-datasets with the same position in the third target direction in each sub-processor to generate a corresponding third temporary global array, and update the boundary data of the corresponding sub-processors based on each third temporary global array, so as to ensure the continuity of the data in the third direction; wherein, the third target direction includes the first direction and the second direction, that is, the third target direction is the remaining two directions of the three directions except the third direction. Afterwards, each sub-processor performs one-dimensional Fourier transform on the corresponding sub-datasets in the corresponding third temporary global array based on the updated boundary data; wherein, the corresponding sub-datasets in the third temporary global array are the sub-datasets corresponding to the sub-processors in the third temporary global array.
[0066] It should be noted that, for the generation of the temporary global array, the sub-data sets in each sub-processor having the same position in the target direction can be assembled to generate the corresponding temporary global array based on the global data communication between the sub-processors. Wherein, if the temporary global array is the first temporary global array, the target direction is the first target direction; if the temporary global array is the second temporary global array, the target direction is the second target direction; if the temporary global array is the third temporary global array, the target direction is the third target direction.
[0067] It should also be noted that global data communication between sub-processors can be achieved by calling a global reduction function, wherein the global reduction function generates a corresponding temporary global array by assembling the sub-data sets with the same position in the target direction in each sub-processor based on a preset operation, and returns each temporary global array to each sub-processor. For example, the global reduction function can use the MPI_Allreduce function in the MPI (Message Passing Interface) library; the preset operation includes but is not limited to the splicing operation.
[0068] by Figure 4 For example, the central processor assembles the sub-data sets with the same position in the y direction and the z direction in each sub-processor to generate a corresponding first temporary global array by calling the global reduction function, and returns each first temporary global array to each sub-processor, so that each sub-processor updates its own boundary data based on the received first temporary global array. Then, each sub-processor performs a one-dimensional Fourier transform on the sub-data set corresponding to the sub-processor in the corresponding first temporary global array based on the updated boundary data. Among them, in each sub-processor, the total task of performing a one-dimensional Fourier transform on the corresponding sub-data set in the x direction is sent to the graphics processor, so that the graphics processor divides each total task into several sub-tasks, and uses its own several stream processors to execute several sub-tasks concurrently, and merges the concurrent execution results of several sub-tasks belonging to the same total task, and returns each merged result to the sub-processor corresponding to each total task, thereby realizing the update of the data set in the sub-processor.
[0069] Step S13: if the one-dimensional Fourier transforms in the three directions are all completed, the current sub-data sets in the sub-processors are merged to obtain a target three-dimensional data set.
[0070] In this embodiment, if each sub-processor has completed the one-dimensional Fourier transform of the corresponding sub-data set in three directions, the current sub-data sets in each sub-processor are merged to obtain a target three-dimensional data set; wherein the target three-dimensional data set is the data set obtained after the three-dimensional Fourier transform is completed on the three-dimensional data set to be processed. In this way, this embodiment, by combining the characteristics of parallel processing of the central processing unit and concurrent execution of the graphics processor, can complete the three-dimensional Fourier transform of the data set through three global data communications and three one-dimensional Fourier transforms, and obtain the solution of the three-dimensional Fourier transform.
[0071] It should be noted that Fourier transform is widely used in signal processing, image processing, sound processing, communication systems, numerical calculations, etc. Taking the three-dimensional data set to be processed as an example, the three-dimensional Fourier transform can convert the signal from the time domain to the frequency domain, thereby quickly obtaining the signal's spectrum information to achieve various signal processing operations.
[0072] It can be seen that the present application uses a central processing unit to divide the three-dimensional data set to be processed into several sub-data sets, and performs one-dimensional Fourier transform on several sub-data sets in three directions in parallel through several sub-processors, thereby improving the efficiency of executing Fourier transform on the data set through the characteristics of parallel processing of the central processing unit; wherein, when a sub-processor performs a one-dimensional Fourier transform on a sub-data set, the total task of the one-dimensional Fourier transform can be divided into several sub-tasks, so as to be executed concurrently by several stream processors in the graphics processor, thereby further improving the efficiency of executing Fourier transform on the data set through the characteristics of concurrent execution of the graphics processor. Further, the present application combines data set division, sequential execution of one-dimensional Fourier transform in three directions, one-dimensional Fourier transform total task division, and central processing unit parallel processing and graphics processor concurrent execution, relative to directly executing three-dimensional Fourier transform on the data set, can greatly reduce the computational complexity of Fourier transform, and improve the efficiency of executing Fourier transform on the data set, and at the same time, the self-developed Fourier solution method can realize the autonomous control of industrial fluid software.
[0073] See also Figure 5 As shown, the embodiment of the present invention discloses a three-dimensional Fourier transform acceleration device, which is applied to a central processing unit, including:
[0074] The data set division module 11 is used to divide the three-dimensional data set to be processed into a plurality of sub-data sets, and respectively distribute each of the sub-data sets to each sub-processor; the sub-processor is located in the central processing unit;
[0075] The Fourier transform module 12 is used for sending the overall task of performing one-dimensional Fourier transform on the corresponding sub-dataset in any direction to the graphics processor through each sub-processor when each sub-processor performs one-dimensional Fourier transform on the corresponding sub-dataset in three directions in sequence, so that the graphics processor divides each overall task into a plurality of sub-tasks, and uses its own plurality of stream processors to perform concurrent execution on the plurality of sub-tasks, and merges the concurrent execution results of the plurality of sub-tasks belonging to the same overall task, and returns the merged results to the sub-processors corresponding to each overall task to update the sub-datasets in the sub-processors;
[0076] The data set merging module 13 is used to merge the current sub-data sets in each of the sub-processors to obtain a target three-dimensional data set if the one-dimensional Fourier transforms in the three directions are all completed.
[0077] It can be seen that the present application uses a central processing unit to divide the three-dimensional data set to be processed into several sub-data sets, and performs one-dimensional Fourier transform on several sub-data sets in three directions in parallel through several sub-processors, thereby improving the efficiency of executing Fourier transform on the data set through the characteristics of parallel processing of the central processing unit; wherein, when a sub-processor performs a one-dimensional Fourier transform on a sub-data set, the total task of the one-dimensional Fourier transform can be divided into several sub-tasks, so as to be executed concurrently by several stream processors in the graphics processor, thereby further improving the efficiency of executing Fourier transform on the data set through the characteristics of concurrent execution of the graphics processor. Further, the present application combines data set division, sequential execution of one-dimensional Fourier transform in three directions, one-dimensional Fourier transform total task division, and central processing unit parallel processing and graphics processor concurrent execution, relative to directly executing three-dimensional Fourier transform on the data set, can greatly reduce the computational complexity of Fourier transform, and improve the efficiency of executing Fourier transform on the data set, and at the same time, the self-developed Fourier solution method can realize the autonomous control of industrial fluid software.
[0078] In some specific embodiments, the data set partitioning module 11 includes:
[0079] A preset information acquisition unit, used to acquire the preset number of grid points of the three-dimensional data set to be processed in three directions, and the preset number of parallel operations of the central processing unit in three directions;
[0080] A division number determination unit, configured to determine a target division number corresponding to the same direction based on the preset number of grid points and the preset parallel number in the same direction;
[0081] The data set division unit is used to divide the three-dimensional data set to be processed into the plurality of sub-data sets using the target division quantities corresponding to the three directions respectively.
[0082] In some specific embodiments, the process in which each of the sub-processors in the Fourier transform module 12 sequentially performs one-dimensional Fourier transform on the corresponding sub-data set in three directions includes:
[0083] A first transformation submodule, configured to perform a one-dimensional Fourier transform on the corresponding sub-data set in a first direction through each of the sub-processors;
[0084] A second transformation submodule, configured to, after the one-dimensional Fourier transform in the first direction is completed and the sub-data sets in each of the sub-processors are updated, perform one-dimensional Fourier transform on the corresponding sub-data sets in the second direction through each of the sub-processors;
[0085] A third transformation submodule, configured to, after the one-dimensional Fourier transform in the second direction is completed and the sub-data sets in each of the sub-processors are updated, perform one-dimensional Fourier transform on the corresponding sub-data sets in a third direction through each of the sub-processors;
[0086] The first direction, the second direction and the third direction are different directions.
[0087] In some specific embodiments, the first transformation submodule includes:
[0088] A first updating unit, configured to assemble sub-data sets having the same position in a first target direction in each of the sub-processors to generate a corresponding first temporary global array, and to update boundary data of the corresponding sub-processors based on each of the first temporary global arrays; the first target direction includes the second direction and the third direction;
[0089] A first execution unit, configured to perform a one-dimensional Fourier transform on a corresponding sub-data set in a corresponding first temporary global array in the first direction based on the respective updated boundary data through each of the sub-processors;
[0090] The corresponding sub-data set in the first temporary global array is the sub-data set in the first temporary global array corresponding to the sub-processor.
[0091] In some specific embodiments, the second transformation submodule includes:
[0092] A second updating unit, configured to assemble the sub-data sets in the sub-processors that have the same position in a second target direction to generate a corresponding second temporary global array, and update the boundary data of the corresponding sub-processors based on each of the second temporary global arrays; the second target direction includes the first direction and the third direction;
[0093] A second execution unit, configured to perform a one-dimensional Fourier transform on a corresponding sub-data set in a corresponding second temporary global array in the second direction based on the respective updated boundary data through each of the sub-processors;
[0094] The corresponding sub-data set in the second temporary global array is the sub-data set in the second temporary global array corresponding to the sub-processor.
[0095] In some specific embodiments, the third transformation submodule includes:
[0096] a third updating unit, configured to assemble the sub-data sets in the sub-processors that have the same position in a third target direction to generate a corresponding third temporary global array, and to update the boundary data of the corresponding sub-processors based on the third temporary global arrays; the third target direction includes the first direction and the second direction;
[0097] A third execution unit, configured to perform a one-dimensional Fourier transform on a corresponding sub-data set in a corresponding third temporary global array in the third direction based on the respective updated boundary data through each of the sub-processors;
[0098] The corresponding sub-data set in the third temporary global array is the sub-data set in the third temporary global array corresponding to the sub-processor.
[0099] In some specific embodiments, the process of generating the temporary global array in the Fourier transform module 12 includes:
[0100] An array generation unit, configured to assemble sub-data sets having the same position in a target direction in each of the sub-processors to generate a corresponding temporary global array based on global data communication between the sub-processors;
[0101] Among them, the global data communication is realized by calling a global reduction function; the global reduction function generates a corresponding temporary global array by assembling the sub-data sets with the same position in the target direction in each sub-processor based on a preset operation, and returns each temporary global array to each sub-processor.
[0102] Furthermore, the present application also discloses an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0103] Figure 6 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the three-dimensional Fourier transform acceleration method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0104] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0105] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0106] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, and can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the three-dimensional Fourier transform acceleration method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0107] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed three-dimensional Fourier transform acceleration method is implemented. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.
[0108] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0109] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0110] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0111] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0112] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A three-dimensional Fourier transform acceleration method, characterized in that: Applicable to CPU, including: Dividing the three-dimensional data set to be processed into a plurality of sub-data sets, and respectively allocating each of the sub-data sets to a sub-processor; the sub-processor is located in the central processing unit; When each of the sub-processors sequentially performs one-dimensional Fourier transform on the corresponding sub-datasets in three directions, each of the sub-processors sends a general task of performing one-dimensional Fourier transform on the corresponding sub-datasets in any direction to the graphics processor, so that the graphics processor divides each of the general tasks into a plurality of sub-tasks, and uses its own plurality of stream processors to concurrently execute the plurality of sub-tasks, merges the concurrent execution results of the plurality of sub-tasks belonging to the same general task, and returns the merged results to the sub-processors corresponding to each of the general tasks to update the sub-datasets in the sub-processors; If the one-dimensional Fourier transforms in the three directions are all completed, the current sub-data sets in the sub-processors are merged to obtain a target three-dimensional data set; The process in which each of the sub-processors sequentially performs one-dimensional Fourier transform on the corresponding sub-data set in three directions includes: Performing a one-dimensional Fourier transform on the corresponding sub-data set in a first direction by each of the sub-processors; After the one-dimensional Fourier transform in the first direction is completed and the sub-data sets in each of the sub-processors are updated, one-dimensional Fourier transform is performed on the corresponding sub-data sets in the second direction by each of the sub-processors; After the one-dimensional Fourier transform in the second direction is completed and the sub-data sets in each of the sub-processors are updated, each of the sub-processors performs a one-dimensional Fourier transform on the corresponding sub-data sets in a third direction; wherein the first direction, the second direction and the third direction are different directions; The performing of a one-dimensional Fourier transform on the corresponding sub-data set in the first direction by each of the sub-processors respectively includes: Assemble the sub-data sets in the sub-processors that have the same position in the first target direction to generate a corresponding first temporary global array, and update the boundary data of the corresponding sub-processors based on the first temporary global arrays; the first target direction includes the second direction and the third direction; perform a one-dimensional Fourier transform on the corresponding sub-data sets in the corresponding first temporary global array in the first direction based on the updated boundary data of each sub-processor; wherein the corresponding sub-data sets in the first temporary global array are the sub-data sets in the first temporary global array that correspond to the sub-processors; The performing of a one-dimensional Fourier transform on the corresponding sub-data set in the second direction by each of the sub-processors respectively includes: Assemble the sub-data sets in the sub-processors that have the same position in the second target direction to generate a corresponding second temporary global array, and update the boundary data of the corresponding sub-processors based on the second temporary global arrays; the second target direction includes the first direction and the third direction; perform a one-dimensional Fourier transform on the corresponding sub-data sets in the corresponding second temporary global array in the second direction based on the updated boundary data of each sub-processor; wherein the corresponding sub-data sets in the second temporary global array are the sub-data sets in the second temporary global array that correspond to the sub-processors; The performing of one-dimensional Fourier transform on the corresponding sub-data set in the third direction by each of the sub-processors respectively includes: The sub-data sets in each sub-processor having the same position in the third target direction are assembled to generate a corresponding third temporary global array, and the boundary data of the corresponding sub-processor is updated based on each third temporary global array; the third target direction includes the first direction and the second direction; each sub-processor performs a one-dimensional Fourier transform on the corresponding sub-data set in the corresponding third temporary global array in the third direction based on the respective updated boundary data; wherein the corresponding sub-data set in the third temporary global array is the sub-data set in the third temporary global array corresponding to the sub-processor.
2. The three-dimensional Fourier transform acceleration method according to claim 1, characterized in that: The step of dividing the three-dimensional data set to be processed into a plurality of sub-data sets includes: Obtaining the preset number of grid points of the three-dimensional data set to be processed in three directions, and the preset number of parallel operations of the central processing unit in three directions; Determine the number of target divisions corresponding to the same direction based on the preset number of grid points and the preset parallel quantity in the same direction; The three-dimensional data set to be processed is divided into the plurality of sub-data sets using the target division quantities corresponding to the three directions respectively.
3. The three-dimensional Fourier transform acceleration method according to claim 1, characterized in that: The generation process of the temporary global array includes: Based on the global data communication between the sub-processors, the sub-data sets in the sub-processors having the same position in the target direction are assembled to generate a corresponding temporary global array; Among them, the global data communication is realized by calling a global reduction function; the global reduction function generates a corresponding temporary global array by assembling the sub-data sets with the same position in the target direction in each sub-processor based on a preset operation, and returns each temporary global array to each sub-processor.
4. A three-dimensional Fourier transform acceleration device, characterized in that: Applicable to CPU, including: A data set division module, used for dividing the three-dimensional data set to be processed into a plurality of sub-data sets, and respectively allocating each of the sub-data sets to each sub-processor; the sub-processor is located in the central processing unit; A Fourier transform module, configured to send a general task of performing one-dimensional Fourier transform on the corresponding sub-dataset in any direction to a graphics processor through each of the sub-processors when each of the sub-processors sequentially performs one-dimensional Fourier transform on the corresponding sub-dataset in three directions, so that the graphics processor divides each of the general tasks into a plurality of sub-tasks, and uses its own plurality of stream processors to perform concurrent execution on the plurality of sub-tasks, and merges the concurrent execution results of the plurality of sub-tasks belonging to the same general task, and returns the merged results to the sub-processors corresponding to each of the general tasks to update the sub-datasets in the sub-processors; A data set merging module, configured to merge the current sub-data sets in each of the sub-processors to obtain a target three-dimensional data set if the one-dimensional Fourier transforms in the three directions are all completed; Wherein, the Fourier transform module comprises: A first transformation submodule, configured to perform a one-dimensional Fourier transform on the corresponding sub-data set in a first direction through each of the sub-processors; A second transformation submodule, configured to, after the one-dimensional Fourier transform in the first direction is completed and the sub-data sets in each of the sub-processors are updated, perform one-dimensional Fourier transform on the corresponding sub-data sets in the second direction through each of the sub-processors; A third transformation submodule, configured to perform a one-dimensional Fourier transform on the corresponding sub-data set in a third direction through each sub-processor after the one-dimensional Fourier transform in the second direction is completed and the sub-data sets in each sub-processor are updated; wherein the first direction, the second direction and the third direction are different directions; The first transformation submodule is specifically used to: assemble the sub-data sets having the same position in the first target direction in each of the sub-processors to generate a corresponding first temporary global array, and update the boundary data of the corresponding sub-processors based on each of the first temporary global arrays; the first target direction includes the second direction and the third direction; and perform a one-dimensional Fourier transform on the corresponding sub-data sets in the corresponding first temporary global array in the first direction based on the updated boundary data of each sub-processor; wherein the corresponding sub-data sets in the first temporary global array are the sub-data sets in the first temporary global array corresponding to the sub-processors; The second transformation submodule is specifically used to: assemble the sub-data sets having the same position in the second target direction in each of the sub-processors to generate a corresponding second temporary global array, and update the boundary data of the corresponding sub-processors based on each of the second temporary global arrays; the second target direction includes the first direction and the third direction; and perform a one-dimensional Fourier transform on the corresponding sub-data sets in the corresponding second temporary global array in the second direction based on the updated boundary data of each of the sub-processors; wherein the corresponding sub-data sets in the second temporary global array are the sub-data sets in the second temporary global array corresponding to the sub-processors; Among them, the third transformation sub-module is specifically used to: assemble the sub-data sets in each of the sub-processors that have the same position in the third target direction to generate a corresponding third temporary global array, and update the boundary data of the corresponding sub-processors based on each of the third temporary global arrays; the third target direction includes the first direction and the second direction; through each of the sub-processors based on the respective updated boundary data, perform a one-dimensional Fourier transform on the corresponding sub-data sets in the corresponding third temporary global array in the third direction; wherein the corresponding sub-data sets in the third temporary global array are the sub-data sets in the third temporary global array corresponding to the sub-processors.
5. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the three-dimensional Fourier transform acceleration method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the three-dimensional Fourier transform acceleration method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Multi-dimensional fast Fourier transform system based on field-programmable gate array
CN117493746A