Adaptive block parallel optimization method for Advanced Encryption Standard (AES) encryption algorithm on multi-GPU platform

By adjusting the parallel granularity and adopting an adaptive blocking strategy on a multi-GPU platform, the problem of low efficiency of the AES encryption algorithm when the parallel granularity is 16 bytes per thread on a multi-GPU platform is solved, achieving more efficient encryption processing, and is applicable for various data sizes.

CN118779901APending Publication Date: 2024-10-15SOUTHWEAT UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410926285.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

On a multi-GPU platform, when the parallel granularity of the AES encryption algorithm is 16 bytes per thread, the operating efficiency is not high when processing large-scale data, the throughput is low, and the encryption time is long. Existing optimization methods mainly focus on single GPU or On the CPU, the potential of multiple GPUs is not fully utilized.

Method used

By determining the data scale and number of GPUs, setting parallel granularity options, establishing the relationship between data scale and parallel granularity, adopting appropriate blocking strategies to achieve adaptive block encryption, and adjusting the data block size processed by each thread to optimize encryption efficiency. .

Benefits of technology

It improves the overall encryption efficiency, reduces resource waste, achieves efficient encryption under various data scales, and has better versatility and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779901A_ABST
    Figure CN118779901A_ABST
Patent Text Reader

Abstract

The invention discloses a self-adaptive block parallel optimization method for an Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU (Graphics Processing Unit) platform. The method comprises the following steps of: determining a data scale F and a GPU number G; setting parallel granularity options; establishing a relationship between the data scale and the parallel granularity; adopting a proper partitioning strategy to calculate the parallel granularity; and adaptive block encryption is realized. The invention aims to solve the current situation that the current AES encryption algorithm is low in operation efficiency, low in throughput and long in encryption time when processing large-scale data on a CPU (Central Processing Unit) or a single GPU (Graphics Processing Unit) platform, particularly under the parallel granularity of 16 bytes per thread, and more computing resources and storage capacity of a multi-GPU structure are utilized to realize encryption and decryption of the large-scale data. The invention provides an AES encryption algorithm parallel optimization method for adaptive partitioning on a multi-GPU (Graphics Processing Unit) platform. According to the method, the parallel granularity (namely the number of bytes to be processed by each thread) of each thread is set through a self-adaptive strategy, and then each thread loads a corresponding number of data from a global memory to a private memory for encryption according to the parallel granularity, so that data of different scales can be flexibly adapted, and the performance of an AES (Advanced Encryption Standard) encryption algorithm is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention mainly relates to the field of multi-GPU architecture, and in particular to an adaptive block parallel optimization method for an AES encryption algorithm on a multi-GPU platform. Background Art

[0002] GPU hardware is composed of a large number of small processing units that can handle multiple tasks simultaneously, with the characteristics of high parallelism, low energy consumption and low cost. This parallel processing capability gives GPUs a significant advantage over traditional CPU platforms when processing graphics and computing-intensive tasks (such as image rendering, scientific computing, machine learning, etc.). Driven by Moore's Law, advances in manufacturing processes have brought a large number of transistor resources, which have driven the rapid improvement of GPU performance. The computer industry has further developed from the single-GPU era to the multi-GPU era.

[0003] The AES encryption algorithm, or Advanced Encryption Standard, is a symmetric key encryption algorithm that is widely used in data encryption and communication security. Its main idea is to use a key to perform multiple rounds of substitution and replacement operations on data to achieve data encryption and decryption. The AES encryption algorithm supports 128-bit, 192-bit, and 256-bit key lengths, and divides the data into 16-byte data blocks for processing. When processing large-scale data, GPU-based parallel encryption has obvious advantages over traditional methods. There have been many studies at home and abroad to port the AES encryption algorithm to the GPU platform. By dividing the data into multiple parts and assigning them to different GPUs for parallel processing, the speed of encryption and decryption can be significantly improved. This parallel processing method makes full use of the high concurrent processing capabilities of the GPU to improve the efficiency and performance of data encryption.

[0004] In the era of multi-GPU, how to simply and efficiently develop parallel programs with excellent scalability and execution efficiency on the growing number of computing units, and how to strike a balance between the ease of parallel programming and the execution efficiency of parallel programs, are major issues facing the current multi-GPU architecture. To solve this problem, it is necessary to use a reasonable parallel programming model to ensure simple and efficient programming and the optimal use of various computing and memory resources. Advanced parallel programming models such as CUDA, OpenCL, and the new SYCL and Kokkos simplify the development and porting of parallel programs through high-level programming interfaces. Therefore, how to achieve efficient expansion of the parallelism of mainstream application software on a multi-GPU structure is a hot issue in current research.

[0005] Currently, in the application of AES encryption algorithm, many leading technology companies are developing dedicated hardware to accelerate its calculation. Intel provides AES instruction set (AES New Instructions, AES-NI), which is a hardware instruction set specifically used to accelerate AES encryption and decryption operations. Similar to Intel's AES-NI, AMD's Secure Processor also includes hardware-accelerated AES encryption functions. ARM's processor architecture includes TrustZone technology, which provides hardware-level security and integrates CryptoCell modules to accelerate encryption algorithms such as AES. NXP's i.MX series processors integrate hardware-accelerated AES engines and are widely used in embedded systems to improve the efficiency of data encryption and decryption. Xilinx's FPGA (field programmable gate array) can achieve efficient AES encryption acceleration and achieve high-performance encryption operations through customized hardware logic. Huawei's NPU chip also adds hardware acceleration of the AES encryption algorithm, which can provide high-performance computing of the AES encryption algorithm. NVIDIA has also added hardware acceleration of the AES encryption algorithm to its GPU, supporting efficient processing of AES through CUDA programming. In addition, many companies provide hardware acceleration solutions, which are widely used in various scenarios from personal computing devices to enterprise-level data centers, significantly improving the performance and efficiency of AES encryption and decryption.

[0006] In the AES algorithm method based on GPU parallelism, some people proposed the T-box method, which merges the Substitute Byte and MixColumn stages of AES encryption to replace the S-box lookup table used in the Substitute Byte stage; some people reduce the size of the 8-bit Galois field S-box to a smaller 4-bit and 2-bit calculation; some people use subfield arithmetic and logic gate optimization methods to reduce the required instructions. Ghaznavi et al. proposed a technology for efficiently designing the MixColumn stage on FPGA, which reduces the multiplication of each element by 3 to a multiplication of 2 and addition in the Galois field, instead of calculating multiplication of 3 separately for each element in the state array; Omid Hajihassani et al. based on this, expressed the multiplication of 2 as a left shift operation and the addition operation as an exclusive OR operation; Nishikawad et al. proposed an AES optimization method based on bit slicing, which puts the same index bits of different plaintext blocks in the same register, so that multiple data blocks can be processed at one time.

[0007] However, many optimization methods for the AES encryption algorithm currently have one thing in common: they all focus on optimization on a single GPU or CPU and ignore the potential of multiple GPUs. In addition, the parallel granularity of processing 16 bytes of data with one thread results in large thread management and memory access overhead when processing large-scale data, resulting in low encryption efficiency. Summary of the invention

[0008] The purpose of the present invention is to provide an adaptive block parallel optimization method for the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform, aiming to solve the current situation that the AES encryption algorithm has low operating efficiency, low throughput and long encryption time when processing large-scale data on a CPU or single GPU platform, especially at a parallel granularity of 16 bytes per thread.

[0009] The present invention is implemented in such a way that an adaptive block parallel optimization method of the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform comprises the following steps: Step 1: Determine the data size F and the number of GPUs G; Step 2: Set the parallel granularity option; Step 3: Establish the relationship between data scale and parallel granularity; Step 4: Take appropriate block strategy to calculate parallel granularity; Step 5: Implement adaptive block encryption.

[0010] Furthermore, the step 1 needs to determine the size F of the encrypted data and the number G of GPUs.

[0011] Furthermore, the step 2 determines the range of options for parallel granularity, which refers to the amount of data processed by each thread. The encryption process is performed on a matrix of 4 rows and 4 columns with a total of 16 bytes, so the parallel granularity must be a multiple of 16. In addition, the maximum parallel granularity MPG needs to be determined according to the characteristics of different platforms.

[0012] Furthermore, the step 3 establishes the relationship between data scale and parallel granularity:

[0013] Step 1: Based on the set parallel granularity options, record the performance indicators such as throughput and encryption time under different data scales;

[0014] Step 2: Based on the performance indicators recorded in step 1, analyze and summarize the relationship between data scale and parallel granularity.

[0015] Furthermore, the step 4 adopts a suitable block strategy to calculate the parallel granularity:

[0016] Step 1: According to the relationship between the obtained data scale and parallel granularity, formulate a corresponding block strategy;

[0017] Step 2: Substitute the determined data size F and the number of GPUs G into the block strategy obtained in step 1 to calculate the parallel granularity P.

[0018] Furthermore, the step 5 implements adaptive block encryption:

[0019] Step 1: According to the obtained parallel granularity P, each thread loads P bytes from the global memory to the private memory;

[0020] Step 2: Encrypt the data in the private memory;

[0021] Step 3: After all data encryption is completed, write it back to the global memory at one time.

[0022] The beneficial effects of the present invention are as follows: (1) The present invention can adjust the parallel granularity according to the data scale and the number of GPUs, so that the data block size processed by each thread is optimal, reducing unnecessary overhead, thereby improving the overall encryption efficiency; (2) The present invention reduces resource waste by adjusting the parallel granularity, and can better utilize the computing and memory resources of the GPU; (3) The present invention can select the appropriate parallel granularity regardless of the size of the data, which enables the AES encryption algorithm to maintain high efficiency in data processing of various sizes and has better versatility and flexibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 It is a flow chart of an adaptive block parallel optimization method of an AES encryption algorithm on a multi-GPU platform provided by an embodiment of the present invention;

[0024] Figure 2 It is a flow chart of the parallel implementation of the AES encryption algorithm provided by an embodiment of the present invention on the multi-GPU platform MGPUSim;

[0025] Figure 3 is an example of an adaptive block strategy provided by an embodiment of the present invention;

[0026] Figure 4 This is an example of the throughput of the parallel granularity option provided by the embodiment of the present invention under different data scales. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0028] Figure 1 The process of the adaptive block parallel optimization method of the AES encryption algorithm on a multi-GPU platform of the present invention is shown. As shown in the figure, the present invention is implemented in this way. An adaptive block parallel optimization method of the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform includes the following steps: S101: determining the data scale F and the number of GPUs G; S102: Setting parallel granularity options; S103: Establishing the relationship between data scale and parallel granularity; S104: adopting an appropriate block strategy to calculate the parallel granularity; S105: Implement adaptive block encryption.

[0029] Furthermore, the step S101 determines the size F of the encrypted data and the number G of GPUs.

[0030] Furthermore, the step S102 determines the range of options for parallel granularity. These options refer to the amount of data processed by each thread. The encryption process is performed on a matrix of 4 rows and 4 columns with a total of 16 bytes, so the parallel granularity must be a multiple of 16. In addition, the maximum parallel granularity MPG needs to be determined according to the characteristics of different platforms.

[0031] Furthermore, the step S103 establishes the relationship between the data scale and the parallel granularity.

[0032] Step 1: Based on the set parallel granularity options, record the performance indicators such as throughput and encryption time under different data scales;

[0033] Step 2: Based on the performance indicators recorded in step 1, analyze and summarize the relationship between data scale and parallel granularity.

[0034] Furthermore, the step S104 adopts a suitable block strategy to calculate the parallel granularity.

[0035] Step 1: According to the relationship between the obtained data scale and parallel granularity, formulate a corresponding block strategy;

[0036] Step 2: Substitute the determined data size F and the number of GPUs G into the block strategy obtained in step 1 to calculate the parallel granularity P.

[0037] Furthermore, the step S105 implements adaptive block encryption.

[0038] Step 1: According to the obtained parallel granularity P, each thread loads P bytes from the global memory to the private memory;

[0039] Step 2: Encrypt the data in the private memory;

[0040] Step 3: After all data encryption is completed, write it back to the global memory at one time.

[0041] Embodiment: MGPUSim is a highly configurable multi-GPU simulator that is open source under the terms of the MIT license. Developed using the Golang programming language. The Golang language was chosen because it provides both reasonable performance and is easy to program and maintain. Users can set various parameters of the simulator, including the number of GPU cores, memory hierarchy, scheduling strategy, and more. These parameters can be changed dynamically during simulation, allowing users to evaluate different scenarios and configurations for optimal performance and energy efficiency. The AES encryption algorithm is widely used in information security, finance, cloud computing, wireless communications, the Internet of Things, blockchain and other fields. When the scale of data to be encrypted is large, there are problems of long encryption time and low throughput. However, the advantages of the multi-GPU platform MGPUSim include improved computing performance, good scalability, low energy consumption, and applicability to large-scale data. Therefore, using a multi-GPU platform to accelerate the AES algorithm will have better performance. The steps for implementing the adaptive block parallel optimization method of the AES encryption algorithm based on MGPUSim are as follows:

[0042] Step 1: Determine the data size F and the number of GPUs G; We implement the AES encryption algorithm on MGPUSim. The plaintext data is randomly generated with a fixed size. Here, we randomly generate plaintext data with a data size F of 2048MB. The number of GPUs is given as a parameter at runtime. Here, we set the number of GPUs G to 4.

[0043] Step 2: Set the parallel granularity option; The AES encryption algorithm processes a minimum of 16 bytes of data at a time. Combining the characteristics of the multi-GPU platform MGPUSim, we set four parallel granularity options, namely 16 bytes, 32 bytes, 64 bytes and MPG128 bytes.

[0044] Step 3: Establish the relationship between data scale and parallel granularity; According to the set parallel granularity options, record their throughput, encryption time and other performance indicators under different data scales. The specific data are as follows: Figure 4 shown.

[0045] By analyzing the performance indicators and combining the characteristics of MGPUSim, the following relationship between data size and parallel granularity is established: when the data size is less than 4MB, it is more efficient to use a smaller 16-byte granularity; when the data size is between 4MB and 16MB, it is more efficient to use a 64-byte granularity; when the data size is greater than 16MB, it is more efficient to use a 128-byte granularity.

[0046] Step 4: Take appropriate block strategy to calculate parallel granularity; Based on the relationship established in step 3, take Figure 3 The block strategy shown. By bringing the data size F equal to 2048MB and the number of GPUs G equal to 4 determined in step 1, and the maximum parallel granularity MPG equal to 128 determined in step 2 into the block strategy, it can be calculated that the parallel granularity P is equal to 128 bytes.

[0047] Step 5: Implement adaptive block encryption; According to the parallel granularity P calculated in step 4, which is equal to 128 bytes, each thread reads 128 bytes of data from the global memory and loads it into the private memory. The 128 bytes of data in the private memory are then encrypted and written back to the global memory at once after all the data is encrypted.

[0048] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative labor are still within the scope of protection of the present invention.

Claims

1. An adaptive block parallel optimization method for the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform, characterized in that: The method for adaptive block parallel optimization of the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform comprises the following steps: Step 1: Determine the data scale F and the number of GPUs G; Step 2: Set the parallel granularity option; Step 3: Establish the relationship between data scale and parallel granularity; Step 4: Take appropriate block strategy to calculate parallel granularity; Step 5: Implement adaptive block encryption.

2. The method for adaptive block parallel optimization of the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform as claimed in claim 1, characterized in that: The step 1 needs to determine the size F of the encrypted data and the number G of GPUs.

3. The method for adaptive block parallel optimization of the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform as claimed in claim 1, characterized in that: The step 2 determines the range of options for parallel granularity. These options refer to the amount of data processed by each thread. The encryption process is performed on a matrix of 4 rows and 4 columns with a total of 16 bytes, so the parallel granularity must be a multiple of 16. In addition, the maximum parallel granularity MPG needs to be determined according to the characteristics of different platforms.

4. The method for adaptive block parallel optimization of the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform as claimed in claim 1, characterized in that: The step three needs to establish the relationship between data scale and parallel granularity, and the specific steps are as follows: Step 1: Based on the set parallel granularity options, record the performance indicators such as throughput and encryption time under different data scales; Step 2: According to the recorded performance indicators, analyze and summarize the mapping relationship between data scale and parallel granularity. Specifically, when the data scale is X, the parallel granularity of Y should be adopted.

5. The method for adaptive block parallel optimization of the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform as claimed in claim 1, characterized in that: The step 4 adopts a suitable block strategy to calculate the parallel granularity, and the specific steps are as follows: Step 1: According to the relationship between the data scale and the parallel granularity, formulate a corresponding block strategy. First, calculate the amount of data that each GPU needs to process. Then take the logarithm of the data scale of each GPU with base 2 and map it to the logarithmic space to facilitate the processing of data of different orders of magnitude. Then, round up the logarithmic result to ensure that the data is valid. Next, use the rounded result as the exponent and add an offset of 4 to perform an exponential operation of 2. The offset is added to ensure that the granularity is not too small. Finally, it needs to be compared with the maximum parallel granularity MPG to ensure that it does not exceed the maximum supported value of the system. Step 2: Substitute the determined data size F and the number of GPUs G into the block strategy obtained in the previous step to calculate the parallel granularity P.

6. The method for adaptive block parallel optimization of the Advanced Encryption Standard (AES) encryption algorithm on a multi-GPU platform as claimed in claim 1, characterized in that: The step 5 implements adaptive block encryption, and the specific steps are as follows: Step 1: According to the obtained parallel granularity P, each thread loads P bytes from the global memory to the private memory; Step 2: Encrypt the data in the private memory; Step 3: After all data encryption is completed, write it back to the global memory at one time.