Iterative perception-based mpi communication trace data compression method and system

By using instrumentation techniques and iterative sensing methods to divide the iteration intervals of parallel programs, the problem of massive communication trace data in large-scale parallel programs is solved, achieving efficient data compression and performance analysis.

CN121455807BActive Publication Date: 2026-04-07NAT UNIV OF DEFENSE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-07
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing technologies cannot effectively utilize iterative semantic features in large-scale parallel programs, resulting in massive communication trace data, excessive storage and analysis overhead, and difficulty in identifying performance bottlenecks.

Method used

By instrumenting techniques to identify iterative variables in parallel programs and dividing iterative intervals, and by combining the PMPI interface to obtain communication trace data, an iterative awareness method is used to perform interval division and lightweight comparison to achieve efficient compression of communication trace data.

Benefits of technology

It significantly reduces the storage size and transmission overhead of communication trace data, improves the efficiency of performance analysis, and can compress data volume by a multiplier, reducing the overhead of collection, storage and analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121455807B_ABST
    Figure CN121455807B_ABST
Patent Text Reader

Abstract

This invention discloses an iteratively aware method and system for compressing MPI communication trace data. The method includes generating an instrumented binary file for a target parallel program, wherein the instrumentation includes iterative variables used to control iteration within the loop body of the target parallel program; running the instrumented binary file; dividing iteration intervals based on the extracted iterative variables during MPI communication within the binary file of the target parallel program; collecting communication trace data for the current iteration interval; and compressing the communication trace data for the iteration interval using a compression technique that senses the program's iteration context. This invention aims to efficiently extract and record representative communication trace data, achieving data compression between cyclically executed MPI communication intervals, thereby significantly reducing the storage size and transmission overhead of communication trace data for large-scale MPI programs while preserving the core information required for analysis to the greatest extent possible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of large-scale parallel program communication analysis technology, specifically to an iteratively aware MPI communication trace data compression method and system. Background Technology

[0002] With the continuous expansion of modern computing systems and the increasing complexity of applications, performance analysis and optimization have become indispensable key aspects of software engineering. In high-performance computing (HPC), the efficiency of inter-process communication directly determines the overall performance of parallel programs. Inappropriate communication patterns, such as late sending, late receiving, late broadcasting, and early reduction, are common bottlenecks leading to performance degradation in parallel programs. The collection of communication trace data is crucial for a deep understanding and diagnosis of these communication behaviors. These traces record key information about inter-process communication events and are the foundation for debugging and optimizing inter-process interaction logic. In large-scale parallel applications, especially in iterative algorithms involving intensive computation and communication (such as scientific simulations and data analysis), the communication trace data grows dramatically because programs repeatedly execute the same communication code paths in millions or even billions of iterations, becoming a huge burden for storage, transmission, and analysis. The challenges posed by massive amounts of communication trace data extend far beyond simple storage and transmission, also creating difficulties for performance analysis. This scale of data means that the causes of performance bottlenecks are overwhelmed by a large number of redundant or low-impact communication events, greatly increasing the difficulty of fault location and pushing the analysis process into the predicament of "finding a needle in a haystack".

[0003] Current mainstream performance analysis tools include HPCtoolkit and Score-P. HPCtoolkit samples hardware PMU counter events (such as cache misses) or system performance events to obtain performance data and sampling point stack information for the entire program, indirectly inferring the impact of communication on performance, rather than directly recording MPI communication traces. While this reduces the generation of communication data, it can lead to important, atypical communication events (such as extreme latency or abnormal communication patterns) being completely missed due to sampling, preventing analysts from discovering problems. Score-P combines multiple strategies when collecting data from massively parallel programs, aiming to balance data detail, acquisition overhead, and storage management. Its core lies in using OTF2 (OpenTrace Format 2) as a low-overhead trace recording format. OTF2 uses event IDs, metadata ID references, and typed parameter encoding to reduce duplication and redundancy. However, even with OTF2 optimizations, the amount of trace data for massively parallel programs can still be enormous when precise event recording is enabled, and OTF2 format parsing and data reconstruction are more complex than simple text formats. The common shortcoming of the above tools is that they do not fully utilize the semantic features of iterative loop execution in MPI parallel programs to guide the information and data compression of MPI communication traces. To realize an iteratively aware communication trace data compression method and system, the following three challenges need to be addressed: (1) Identify the iterative semantic features in large-scale parallel applications and complete the partitioning of loop-executed MPI communication intervals based on these features. (2) In order to maintain the accuracy and sufficiency of information in the communication trace data of large-scale parallel programs during the compression process, and to maintain the low overhead of the compression process, a lightweight and efficient MPI communication interval trace data comparison mechanism is needed. (3) MPI communication interval trace compressed data needs to be efficiently organized and stored so that important performance features during the execution of MPI programs can be restored in subsequent full-program MPI communication analysis. Summary of the Invention

[0004] The technical problem to be solved by this invention is to provide an iteratively perceptive MPI communication trace data compression method and system to address the above-mentioned problems in the prior art. This invention aims to efficiently extract and record representative communication trace data, realize the cyclic execution of trace data compression between MPI communication intervals, thereby significantly reducing the storage scale and transmission overhead of large-scale MPI program communication trace data, while retaining the core information required for analysis to the greatest extent.

[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0006] An iteratively sensing MPI communication trace data compression method, characterized by comprising the following steps:

[0007] S101 is the binary file after instrumentation of the target parallel program. The instrumentation code inserted by the instrumentation is used to extract the iteration variables used to control the iteration in the loop body of the target parallel program.

[0008] S102, when performing MPI communication in the binary file of the target parallel program, divide the iteration interval according to the iteration variables extracted by the instrumentation code being run;

[0009] S103, Collect communication trace data for this iteration interval;

[0010] S104. Determine whether the current iteration is the first iteration based on the current iteration sequence number. If it is the first iteration, do not compress and jump to step S108; otherwise, jump to step S105.

[0011] S105, determine whether the order sequence of the global call stack IDs of each communication trace data in the current iteration interval is consistent with the iteration interval of the previous iteration. If they are inconsistent, do not compress and jump to step S108; otherwise, jump to step S106.

[0012] S106, calculate the ratio of the difference in iteration duration between the current iteration and the previous iteration;

[0013] S107, Determine whether the ratio of iteration duration difference exceeds the threshold. If it exceeds the threshold, do not compress the jump step S108; otherwise, compress the jump step S109.

[0014] S108, save the complete trace data for this iteration interval;

[0015] S109, Save the iteration context;

[0016] S110: Determine whether it is the last transmission based on the MPI function of MPI communication. If it is not the last transmission, jump to step S103; otherwise, write the saved communication trace data and iteration context to the file, end and exit.

[0017] Optionally, before step S101, the process includes generating an instrumented binary file for the target parallel program: inserting instrumentation code into the source code of the target parallel program, the instrumentation code being used to initialize the maximum nesting depth, the context array, the current context nesting depth, and the global counter, and defining an entry function and an exit function; the entry function is used to store a new context identifier in the context array, increment the current context nesting depth by 1, and update the global counter to point to the new context identifier in the context array when the current context nesting depth does not exceed the maximum nesting depth; the exit function is used to decrement the current context nesting depth by 1 and update the global counter to point to the previous context identifier in the context array when the current context nesting depth is greater than 0; identifying the loop body of the target parallel program and its iteration variable used to control the iteration, using the iteration variable as the context identifier for the new context function and the exit function, inserting an entry function before each loop body, and inserting an exit function after each loop body; and compiling the source code of the target parallel program and the inserted instrumentation code to generate an instrumented binary file.

[0018] Optionally, before step S101, the process includes generating an instrumented binary file for the target parallel program: extracting the control flow graph of the target parallel program's binary file, where nodes in the control flow graph are structural elements in the binary file, including basic blocks, functions, and loops, and edges in the control flow graph represent data dependencies between structural elements; locating function entry points and loop bodies in the target parallel program's binary file based on the control flow graph as instrumentation points; inserting instrumentation code at the instrumentation points of function entry points, where the instrumentation code initializes the maximum nesting depth, the context array, the current context nesting depth, and a global counter, and defines functions for entering and exiting the new context; the function for entering the new context is used to initialize the current context nesting depth... When the maximum nesting depth is not exceeded, the new context identifier is stored in the context array, the current context nesting depth is incremented by 1, and the global counter is updated to point to the new context identifier in the context array. The exit context function is used to decrement the current context nesting depth by 1 and update the global counter to point to the previous context identifier in the context array when the current context nesting depth is greater than 0. The iteration variable used to control the iteration in the loop body is identified, and the iteration variable is used as the context identifier of the new context function and the exit context function. The new context function is inserted at the instrumentation point before each loop body, and the exit context function is inserted at the instrumentation point after each loop body. The binary file of the target parallel program and the inserted instrumented code are combined to generate the instrumented binary file.

[0019] Optionally, before dividing the iteration interval according to the iteration variables extracted by the instrumentation code in step S102, the process includes dynamically searching and obtaining the memory address of the iteration variable set by the environment variable MPIP_ITER_NAME during initialization using the dlsym function, and forcibly converting this address to an integer pointer. When dividing the iteration interval according to the iteration variables extracted by the instrumentation code in step S102, the process includes checking whether the current iteration variable extracted by the instrumentation code is consistent with the previously extracted iteration variable stored in the environment variable MPIP_ITER_NAME. If they are consistent, it means that the current iteration is still within the original iteration interval; otherwise, it means that the current iteration has entered a new iteration interval.

[0020] Optionally, the functional expression for calculating the ratio of the iteration duration difference between the current iteration and the previous iteration in step S106 is:

[0021] ;

[0022] in, The ratio of the difference in iteration duration between the current iteration and the previous iteration. It is an absolute value function. and These represent the iteration durations of the current iteration and the previous iteration, respectively.

[0023] Optionally, determining whether the iteration duration difference ratio exceeds the threshold in step S107 includes reading the value of the environment variable MPIP_ITER_THRES in the system. If the environment variable MPIP_ITER_THRES is configured, then determine whether the iteration duration difference ratio exceeds the value of the environment variable MPIP_ITER_THRES; otherwise, determine whether the iteration duration difference ratio exceeds the default threshold.

[0024] Optionally, the fields in the communication trace data include: global call ID, global call stack ID, start time of this MPI call, duration of this MPI call, calculation time between the current MPI call and the previous MPI call, label number of this MPI function call, and a flag indicating whether this MPI call is the last one in the caller's function; when saving the iteration context in step S109, the fields for saving the iteration context include: iteration counter, iteration variable value, iteration interval start time and iteration interval duration, wherein the iteration counter is a monotonically increasing integer used to uniquely identify the order of each communication trace iteration and directly serves as a key index for accessing the offset list; the iteration variable value is used to combine with the iteration counter to form a composite identifier to determine the corresponding step inside the loop body; the iteration interval start time and iteration interval duration are used as dimensions of auxiliary indexes to realize the location of communication trace data based on time attributes.

[0025] The present invention also provides an iteratively aware MPI communication trace data compression system, including an interconnected microprocessor and a memory, wherein the microprocessor is programmed or configured to execute the iteratively aware MPI communication trace data compression method.

[0026] The present invention also provides a computer-readable storage medium storing a computer program or instructions that are programmed or configured to execute the iteratively sensed MPI communication trace data compression method by a processor.

[0027] The present invention also provides a computer program product, including a computer program or instructions that are programmed or configured to execute the iteratively sensed MPI communication trace data compression method via a processor.

[0028] Compared with existing technologies, this invention mainly achieves the following beneficial effects: Existing mainstream performance analysis tools (such as HPCtoolKit, TAU, Score-P, etc.) typically adopt data compression methods that only focus on data. They use strategies such as simple sampling or full recording of MPI communication trace data, maintain binary format, and then perform offline repeated trace data analysis to complete MPI communication trace data compression. However, this invention abandons the traditional data-only compression method. Instead, it acquires communication trace data based on the PMPI interface and uses compression technology that senses the program iteration context to accurately capture representative iterative communication traces. The core of this invention's method lies in introducing iteratively sensed MPI communication interval partitioning, threshold-based lightweight trace comparison, and efficient trace data organization. This achieves efficient online compression of MPI communication trace data, significantly reducing the data size of communication traces while maintaining key analysis accuracy, and significantly improving the compression ratio. By using multiple global counters to perform nested compression of multiple loop identifications, the data volume can be compressed by a multiplier, greatly reducing the overhead of MPI trace data acquisition, storage, and analysis. This provides an implementation method for performance analysis of large-scale MPI parallel programs that run for a long time. Attached Figure Description

[0029] Figure 1 This is a schematic diagram of the basic process of the method in an embodiment of the present invention.

[0030] Figure 2 Figure (a) shows the communication trace data before and after compression in an embodiment of the present invention, and Figure (b) shows the communication trace data after compression.

[0031] Figure 3This is a partial trace data of the BT program when MPIP_ITER_THRES=0.02 in an embodiment of the present invention. Detailed Implementation

[0032] To enable those skilled in the art to better understand the technical solutions of the present invention, the technical solutions of the present invention will be further described in detail below with reference to the accompanying drawings in the embodiments of the present invention.

[0033] like Figure 1 As shown, the iterative sensing MPI communication trace data compression method in this embodiment includes the following steps:

[0034] S101 is the binary file after instrumentation of the target parallel program. The instrumentation code inserted by the instrumentation is used to extract the iteration variables used to control the iteration in the loop body of the target parallel program.

[0035] S102, when performing MPI communication in the binary file of the target parallel program, divide the iteration interval according to the iteration variables extracted by the instrumentation code being run;

[0036] S103, Collect communication trace data for this iteration interval;

[0037] S104. Determine whether the current iteration is the first iteration based on the current iteration sequence number. If it is the first iteration, do not compress and jump to step S108; otherwise, jump to step S105.

[0038] S105, determine whether the order sequence of the global call stack IDs of each communication trace data in the current iteration interval is consistent with the iteration interval of the previous iteration. If they are inconsistent, do not compress and jump to step S108; otherwise, jump to step S106.

[0039] S106, calculate the ratio of the difference in iteration duration between the current iteration and the previous iteration;

[0040] S107, Determine whether the ratio of iteration duration difference exceeds the threshold. If it exceeds the threshold, do not compress the jump step S108; otherwise, compress the jump step S109.

[0041] S108, save the complete trace data for this iteration interval;

[0042] S109, Save the iteration context;

[0043] S110: Determine whether it is the last transmission based on the MPI function of MPI communication. If it is not the last transmission, jump to step S103; otherwise, write the saved communication trace data and iteration context to the file, end and exit.

[0044] The iteratively-aware MPI communication trace data compression method in this embodiment can efficiently extract and record representative communication trace data, achieving trace data compression between cyclically executed MPI communication intervals. This significantly reduces the storage scale and transmission overhead of communication trace data for large-scale MPI programs, while preserving the core information required for analysis to the maximum extent. It accelerates the user's ability to locate and diagnose communication bottlenecks in large-scale parallel programs and significantly reduces the burden on system storage I / O. The working principle of the iteratively-aware MPI communication trace data compression method in this embodiment is as follows: Before the target parallel program is executed, static or dynamic analysis is performed on the user-provided source code or binary file, and instrumentation is used to generate an instrumented binary file. The instrumented code includes identifying one or more key iterative variables and creating corresponding global variables as global counters for those iterative variables to track them. The MPI function is overloaded through the PMPI mechanism, and the global counter is used in the injected code to perceive the current key iterative variables. Based on the values ​​of the key iterative variables, the cyclically executed MPI communication intervals are divided, and for each MPI communication interval, communication trace data with iteratively-aware characteristics is recorded. During program execution, communication trace data with iterative awareness is used to perform lightweight and efficient comparisons of communication trace data between iteratively executed MPI communication intervals. First, the MPI call sequence of the communication interval is compared. For intervals identical to the previous one, other performance characteristics can be further compared, including but not limited to: the total duration of the communication interval, the distribution of the start time or duration of each MPI call within the interval, etc. Taking the total duration of the communication interval as an example, based on the system default or user-defined fluctuation range, MPI communication interval trace data within the fluctuation range that is completely consistent with existing trace data is determined to be iterative behavior. The communication trace data for this iteration is not recorded; only the existing trace data pointing to the previous interval that meets the fluctuation range is recorded. This achieves efficient lossy compression of highly repetitive communication metadata based on the program iteration context. In subsequent analysis of iterative MPI communication interval trace data, the MPI communication interval trace data pointed to by each iteration context is recovered, realizing the presentation of the entire process of MPI communication trace data. For loops containing MPI calls, multiple global counters are used to identify different loop structures, including nested and tiling loops, to guide the division of MPI communication intervals and the comparison and compression of trace data between them. Ideally, this achieves data compression effects on the order of multipliers for multiple nested loop iterations. During program execution or before execution ends, the compressed trace data of the MPI communication intervals is written to several log files for storage. These log files primarily include the MPI communication trace data and the iteration context.MPI communication interval trace compressed data is organized and divided by iteration context. The iteration context records the iteration counter, iteration variable values, iteration interval start time, and iteration interval duration. If the trace data for an MPI communication interval has already been compressed, it does not need to be written; otherwise, the call context index number and other communication metadata will be recorded. Using these log files, important communication performance characteristics of a specific iteration interval or the entire MPI program execution process can be reconstructed during subsequent analysis.

[0045] Before program execution, this embodiment allows users to effectively identify one or more key variables used to control iteration without needing a deep understanding of the source code. Traditional analysis focuses on changes in local variables, making it difficult to directly track communication behavior across functions or modules. Globalizing the control variables of loops helps to dynamically monitor the execution status of different loops at runtime, facilitating the analysis of communication redundancy. To this end, this embodiment designs two targeted analysis schemes for user-provided source code or binary files, creating corresponding global variables for the identified loop structures to track and globalize iteration variables.

[0046] As an optional implementation manner, before step S101, it includes generating a binary file with stubs inserted for the target parallel program: inserting stub code into the source code of the target parallel program, where the stub code is used to initialize the maximum nesting depth, context array, current context nesting depth, and global counter, and to define functions for entering a new context and exiting a context; the function for entering a new context is used to store a new context identifier into the context array when the current context nesting depth does not exceed the maximum nesting depth, increment the current context nesting depth by 1, and update the global counter to point to the new context identifier in the context array; the function for exiting a context is used to decrement the current context nesting depth by 1 when the current context nesting depth is greater than 0, and update the global counter to point to the previous context identifier in the context array; identify the loop body of the target parallel program and its iteration variable for controlling iteration, use the iteration variable as the context identifier of the functions for entering a new context and exiting a context, insert the function for entering a new context before each loop body, and insert the function for exiting a context after each loop body; generate a binary file with stubs inserted by compiling the source code of the target parallel program and the inserted stub code. When inserting stub code into the source code of the target parallel program in this embodiment, it includes: a) For the source code provided by the user, traverse the source code using a static analysis tool (such as LLVM / Clang AST). b) According to the characteristics of the loop structure, for a for loop: identify the control variable in the initialization part (such as i in for "i = 0; i < N; ++i"). For while and do - while: analyze the variables in the conditional expression, and confirm the key variable for controlling iteration in combination with the source code context (such as the control variable being declared externally and assigned a value before the loop). c) In the global scope of the source code file, define one or more global variables global_counter of string type. At the same time, according to the call situation of MPI functions in the source code, insert stub code for each loop structure that may affect the redundancy of communication trace data, and assign the variable name of the corresponding iteration control variable to the global variable global_counter. d) For multiple loops and nested situations, preferentially insert the corresponding control variable name at the entry position of the outermost loop. The names of all control variables are assigned to the corresponding global variable global_counter.

[0047] For compiled binary files whose source code cannot be directly accessed, dynamic binary instrumentation techniques are employed. For example, tools such as Dyninst can be used to capture the runtime structure and specific events of the program, and then instructions are inserted at the entry points of loop structures based on the control flow graph (CFG). As an alternative implementation, before step S101, the following steps are included: generating an instrumented binary file for the target parallel program: extracting the control flow graph (CFG) of the target parallel program's binary file using tools such as Dyninst. The nodes in the control flow graph are structural elements in the target parallel program's binary file, including basic blocks, functions, and loops. The edges in the control flow graph represent data dependencies between structural elements. Based on the control flow graph, the function entry points and each loop body of the target parallel program's binary file are located as instrumentation points. Instrumentation code is inserted at the instrumentation points of the function entry points. This instrumentation code is used to initialize the maximum nesting depth, the context array, the current context nesting depth, and the global counter, as well as to define the entry and exit functions for the new context. The entry function is used to ensure that the current context nesting depth is within the maximum nesting depth. When the maximum nesting depth is reached, a new context identifier is stored in the context array, the current context nesting depth is incremented by 1, and the global counter is updated to point to the new context identifier in the context array. The exit context function is used to decrement the current context nesting depth by 1 and update the global counter to point to the previous context identifier in the context array when the current context nesting depth is greater than 0. The iteration variable used to control iteration in the loop body is identified, and the iteration variable is used as the context identifier for the new context function and the exit context function. The new context function is inserted at the instrumentation point before each loop body, and the exit context function is inserted at the instrumentation point after each loop body. The binary file of the target parallel program and the inserted instrumented code are combined to generate the instrumented binary file to ensure that the integrated code does not change the normal execution flow and functional integrity of the original program.

[0048] The performance analysis tool mpiP utilizes the PMPI mechanism, running pre-defined data collection code before the execution of MPI functions and finally using profiling to collect statistical data. While this method collects accurate data, it is not comprehensive enough. Building on this, mpiPtrace acquires communication trace data based on the existing performance analysis tool mpiP, providing low-overhead data support for users analyzing bottlenecks related to communication in large-scale parallel programs. mpiPtrace adds trace data acquisition to this data collector, creating a structure for each call to record its data, ensuring that function information is not simply stored cumulatively. Compared to mpiP, mpiPtrace additionally collects information such as communication direction, single communication execution time, and tag number. mpiPtrace re-formats the acquired communication trace data based on parallel program characteristics and uses the formatted communication trace data header as the key, compressing the communication trace data using a hash method. Furthermore, mpiPtrace proposes a storage method that stores the compressed communication trace data to the file system opportunistically based on runtime communication characteristics and the amount of trace data. mpiPtrace significantly reduces the data size by using efficient communication trace data compression and storage methods, while ensuring the integrity and richness of the trace data.

[0049] To more accurately acquire traces of MPI communication behavior, this embodiment improves the data collection method by proposing mpiPtrace2.0. This method divides the cyclically executed MPI communication intervals based on the values ​​of key iteration variables and records communication trace data with iterative awareness for each MPI communication interval. By setting the environment variable MPIP_ITER_NAME, mpiPtrace2.0 in this embodiment can configure key iteration variables. During MPI program execution, the values ​​of these key iteration variables can be read. Utilizing the PMPI mechanism, mpiPtrace2.0 can run preset data collection code before and after MPI function execution to acquire communication metadata. By combining the acquired key iteration variable values ​​with the segmentation, mpiPtrace2.0 ultimately collects communication trace data with iterative awareness. In this embodiment, mpiPtrace2.0 collects iteratively aware communication trace data for iterative algorithms with intensive computation and communication intertwined in large-scale parallel applications. During initialization, mpiPtrace 2.0 uses the dlsym function to dynamically locate and obtain the memory address of the iteration variable set by MPIP_ITER_NAME. It then casts this address to an integer pointer for subsequent access and manipulation. Afterward, each time an MPI function is called, the value of the corresponding iteration variable is read through this integer pointer. By comparing the changes in the iteration variable's value, the MPI communication interval is divided; each change in the iteration variable's value indicates a change in the iteration context and also signifies the creation of a new communication interval.

[0050] like Figure 1As shown, in step S102 of this embodiment, before dividing the iteration interval based on the iteration variables extracted by the instrumentation code, the process includes dynamically searching and obtaining the memory address of the iteration variable set by the environment variable MPIP_ITER_NAME during initialization using the dlsym function, and forcibly converting this address to an integer pointer. When dividing the iteration interval based on the iteration variables extracted by the instrumentation code in step S102, the process includes checking whether the current iteration variable extracted by the instrumentation code is consistent with the previously extracted iteration variable stored in the environment variable MPIP_ITER_NAME. If they are consistent, it indicates that the current iteration is still within the original iteration interval; otherwise, it indicates that the current iteration has entered a new iteration interval. For MPI parallel programs with simple communication structures, a typical communication interval sequence can usually be obtained: the initialization interval before iteration, the iteration 1 interval, the iteration 2 interval, ..., the iteration N interval, and the end interval after iteration. For MPI parallel programs with complex communication structures, including nested loops and loop tiling, multiple key iteration variable value vectors can be constructed. The changes in these value vectors can be used to divide the MPI communication interval, obtaining an iteration interval sequence containing loop structure characteristics.

[0051] During program execution, the mpiPtrace2.0 method in this embodiment utilizes communication trace data with iterative awareness to perform lightweight and efficient comparison of communication trace data between cyclically executed MPI communication intervals. First, the MPI call sequence of the communication interval is compared. For intervals identical to the previous one, other performance characteristics of the communication interval can be further compared, including but not limited to: the total time of the communication interval, the distribution of the start time or duration of each MPI call within the interval, etc. Taking the total time of the communication interval as an example, based on the system default or user-defined fluctuation range, MPI communication interval trace data within the fluctuation range that is completely consistent with existing trace data is determined to be iterative behavior. The communication trace data for this iteration is not recorded; only existing trace data pointing to the previous interval that meets the fluctuation range is recorded. This completes efficient lossy compression of highly repetitive communication metadata based on the program iteration context.

[0052] In step S106 of this embodiment, the functional expression for calculating the ratio of the iteration duration difference between the current iteration and the previous iteration is as follows:

[0053] ;

[0054] in, The ratio of the difference in iteration duration between the current iteration and the previous iteration. It is an absolute value function. and These represent the iteration durations of the current iteration and the previous iteration, respectively.

[0055] In this embodiment, step S108, determining whether the iteration duration difference ratio exceeds the threshold, includes reading the value of the environment variable MPIP_ITER_THRES in the system. If the environment variable MPIP_ITER_THRES is configured, then it is determined whether the iteration duration difference ratio exceeds the value of the environment variable MPIP_ITER_THRES; otherwise, it is determined whether the iteration duration difference ratio exceeds the default threshold. In this embodiment, the fields in the communication trace data include: global call ID, global call stack ID, start time of this MPI call, duration of this MPI call, calculation time between the current MPI call and the previous MPI call, label number of this MPI function call, and a flag indicating whether this MPI call is the last one in the caller's function. When saving the iteration context, the communication trace data of an iteration interval is compressed into one iteration context. In step S109, when saving the iteration context, the fields of the iteration context include: iteration counter, iteration variable value, iteration interval start time and iteration interval duration. The iteration counter is a monotonically increasing integer used to uniquely identify the order of each communication trace iteration and directly serves as a key index for accessing the offset list. The iteration variable value is used to combine with the iteration counter to form a composite identifier to determine the corresponding step inside the loop body. The iteration interval start time and iteration interval duration are used as dimensions of auxiliary indexes to realize the location of communication trace data based on time attributes.

[0056] Taking the NPB (NAS Parallel Benchmark) benchmark program NPB-BT as an example, based on the iteration-aware analysis of the method in this embodiment, the key iteration variable is identified as `step`. This variable loops 250 times in a program of size D (one of the larger sizes under NPB testing), and a large number of MPI communication and computation operations are performed in each iteration. The environment variable `MPIP_ITER_NAME` is set to the symbolic name corresponding to the key iteration variable `step`. Taking the data of process 0 of the BT program as an example, Figure 2 shows two storage states: Figure 2(a) shows uncompressed data, and Figure 2(b) shows data fully compressed with the key iteration variable. Under the strategy of fully compressing iteration intervals with the same MPI call sequence without considering fluctuations, the communication trace of the first iteration is completely recorded, including the iteration context (iteration counter, value of iteration variable `step`, iteration interval start time, iteration interval duration) and communication trace data. When the value of the `step` variable changes (marking the end of the first iteration), the subsequent compressed records are simplified to only contain the iteration context (iteration counter, value of iteration variable `step`, iteration interval start time, iteration interval duration).

[0057] The aforementioned strategy of completely compressing data without considering fluctuations leads to significant data loss. Therefore, in this embodiment, mpiPtrace2.0 provides a default threshold and allows users to customize the threshold for the iteration fluctuation range based on the already set MPIP_ITER_NAME via the MPIP_ITER_THRES option. This further enhances the fine-grained control of communication data compression. Specifically, if MPIP_ITER_THRES is set to a percentage value (e.g., 0.02), it means that mpiPtrace2.0 will selectively compress based on the time fluctuation range of the iteration interval of the same MPI communication call sequence (2% in this example). When MPIP_ITER_THRES is not set, the system will default to processing based on a percentage value (i.e., 0.05). Specifically, regardless of whether a threshold is set, the system compares the time consumption of two identical iteration intervals. If the time fluctuation is less than or equal to the set threshold or the default threshold, the call sequence within the current iteration interval will be considered the same as the previous one and compressed; if the fluctuation is greater than the threshold, it will be considered "different" and processed accordingly (i.e., no compression, retaining the complete record).

[0058] The core criterion for determining whether a communication call is compressed is the relative fluctuation of its duration. The system will calculate the ratio of the difference in iteration duration between the current iteration and the previous iteration. This quantifies the fluctuation in time consumption between two consecutive iterations (a and b). The resulting change is compared with a set threshold or a default threshold to determine whether compression should be performed. With MPIP_ITER_THRES set to 0.02, as shown in Figure 3, it can be observed that from the 2nd to the 16th iteration, the time consumption fluctuation between consecutive iterations remains below the threshold of 0.02. Therefore, for this portion of the iterations, the system only records representative, brief data. However, when the iterations reach the 17th and 18th iterations, we detect that the time consumption fluctuation between these two iterations increases to 0.022, exceeding the preset threshold. Therefore, the communication trace data for the 17th and 18th iterations are recorded in full to provide more detailed information.

[0059] The iteratively-aware MPI communication trace data compression method of this embodiment can significantly reduce storage space and data volume by performing lossy compression on the communication trace data. To verify the performance of the iteratively-aware MPI communication trace data compression method of this embodiment, the iteratively-aware MPI communication trace data compression method (mpiPtrace2.0) of this embodiment was compared with the existing mpiPtrace and Score-P methods. Among them, mpiPtrace is the method of this embodiment before the addition of iterative awareness function. It was combined with seven NPB (NAS parallel benchmark) benchmark programs, namely IS program (iteration variable is iteration), LU program (istep variable is iteration variable), EP program (k iteration variable is iteration variable), MG program (iteration variable is iteration variable), BT program (step iteration variable), CG program (iteration variable is iteration variable) and SP program (step iteration variable), and NPB test was performed under the configuration of D scale (one of the larger scales under NPB test) and 256 processes. The results are shown in Table 1 and Table 2. Table 1 compares the compressed data file sizes of seven NPB benchmark programs using the mpiPtrace, mpiPtrace2.0, and Score-P methods under the D-scale, 256-process NPB test. The Score-P data excludes functions without MPI calls. Table 2 compares the time overhead of the seven NPB benchmark programs using the mpiPtrace, mpiPtrace2.0, and Score-P methods under the D-scale, 256-process NPB test.

[0060] Table 1: Comparison of data size between the original program, mpiPtrace, mpiPtrace 2.0, and Score-P

[0061]

[0062] Table 2: Comparison of time overhead between the original program, mpiPtrace, mpiPtrace 2.0, and Score-P

[0063]

[0064] The experimental results in Tables 1 and 2 show that for programs with complex communication patterns and long execution times, mpiPtrace2.0 exhibits significant compression advantages, with a compression ratio reaching up to 98.28% compared to mpiPtrace and up to 99.92% compared to Score-P. Although the iteration-aware mechanism introduced in this embodiment may cause the data file size to increase slightly after compression in NPB benchmark programs with low computational complexity and few iterations (such as IS and EP programs), overall, this increase will not significantly cause excessive memory or time overhead.

[0065] For complex loop structures containing MPI calls, such as nested loops and tiling loops, the approach can be further extended by using multiple global counters to identify different loop structures and form value variables for key iteration variables. These variables are used to guide the division of MPI communication intervals and the comparison and compression of trace data between them. In the best case, this can achieve a data compression effect that is multiplied by the iteration amount of multiple nested loops.

[0066] In this embodiment, during or before the program execution ends, mpiPtrace2.0 writes the compressed MPI communication interval trace data to several log files for storage. Each MPI process only needs to manage and record its own compressed MPI communication interval trace data, avoiding file write contention and conflicts. The log files mainly include MPI communication trace data and iteration context. The compressed MPI communication interval trace data is organized and divided according to the iteration context, which records the iteration counter, iteration variable values, iteration interval start time, and iteration interval duration. If the trace data of the MPI communication interval has been compressed, it does not need to be written; otherwise, the call context index number and other communication metadata will be recorded. Using these log files, important communication performance characteristics of a certain iteration interval or the entire MPI program execution process can be restored during subsequent analysis. In the decompression and restoration stage, a method called "offset-based restoration iteration" is implemented based on the organization structure of the MPI communication interval trace compressed data log files. Its basic principle is that during the decompression process, the system only needs to use the pre-calculated and accurately stored iteration start offset to quickly locate the compressed data unit of the target iteration. Subsequently, the decompression algorithm associated with that unit can be directly applied to restore it to the original data. The core advantage of this mechanism lies in its iteration independence. This means that the decompression operation for a specific iteration only requires accessing the compressed data block of that iteration itself and the data block of the previous iteration that stored complete data, without having to completely decompress the entire record file. This selective decompression capability greatly improves the flexibility and efficiency of data access, especially when it is necessary to analyze specific time windows or iteration intervals, significantly reducing unnecessary I / O and computational overhead.

[0067] To achieve rapid location and accurate decompression of the target iterative compressed data block, the iteratively aware MPI communication trace data compression method in this embodiment utilizes the iteration counter, current iteration variable value, iteration start time, and duration as iteration context data. These data are collected and stored during the compression process and play a key role in the decompression stage: (1) Iteration counter: This is a monotonically increasing integer used to uniquely identify the order of each communication trace iteration (e.g., 0, 1, 2, ... N). It directly serves as the key index for accessing the offset list. Through the iteration counter, we can achieve O(1) time complexity retrieval of the offset list, thereby quickly obtaining the starting offset of a specific iteration. (2) Current iteration variable value: In some complex calculation or simulation scenarios, a macroscopic "iteration" may contain multiple internal, staged "steps". The current iteration variable value attribute is used to indicate the internal processing stage of the current iteration. When finer-grained data restoration is required, it can be combined with the iteration counter to form a composite identifier. This allows us to independently compress and restore the data of each internal step, thereby supporting finer data access and analysis. Furthermore, for complex cases involving multiple key iteration variables, the process can be expanded to a vector of current iteration variable values. (3) Iteration start time and duration: Iteration start time and duration are primarily used as dimensions for auxiliary indexing. They allow us to locate and infer data based on time attributes. When it is necessary to analyze data within a specific time window, the system can use the start time to filter out relevant iterations. Furthermore, based on the information from the first iteration (shown in (b) of Figure 2) or the most recent iteration that unfolded due to time fluctuations (Figure 3), we can combine its start time and duration to infer the trace data of the compressed iterations through time series data, thereby assisting in locating compressed data blocks that may be contained within a specific time period. This time-based inference method is particularly suitable for scenarios where there is no strict continuous iteration order or where it is desirable to dynamically adjust the analysis window according to data changes.

[0068] In summary, the core of the decompression and restoration phase lies in building an efficient metadata index. By using the iteration start offset, we achieve fast access to any compression iteration. Metadata such as the iteration counter, current iteration variable value, iteration start time, and duration collectively constitute a multi-dimensional, scalable query mechanism, enabling users to flexibly and efficiently extract the required communication trace data according to different needs (such as by iteration order, by internal steps, or by time range).

[0069] Furthermore, this embodiment also provides an iteratively aware MPI communication trace data compression system, including a microprocessor and a memory interconnected, wherein the microprocessor is programmed or configured to execute the iteratively aware MPI communication trace data compression method. This embodiment also provides a computer-readable storage medium storing a computer program or instructions programmed or configured to execute the iteratively aware MPI communication trace data compression method via a processor. This embodiment also provides a computer program product, including a computer program or instructions programmed or configured to execute the iteratively aware MPI communication trace data compression method via a processor.

[0070] Those skilled in the art will understand that the technical solutions provided by this invention may take the form of a method, system, or computer program product. Therefore, this invention may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this invention may take the form of a computer program product embodied on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, produce an implementation of the flowchart... Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0071] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.

Claims

1. An iterative sensing method for compressing MPI communication trace data, characterized in that, Includes the following steps: S101 is the binary file after instrumentation of the target parallel program. The instrumentation code inserted by the instrumentation is used to extract the iteration variables used to control the iteration in the loop body of the target parallel program. S102, when performing MPI communication in the binary file of the target parallel program, divide the iteration interval according to the iteration variables extracted by the instrumentation code being run; S103, Collect communication trace data for this iteration interval; S104. Determine whether the current iteration is the first iteration based on the current iteration sequence number. If it is the first iteration, do not compress and jump to step S108; otherwise, jump to step S105. S105, determine whether the order sequence of the global call stack IDs of each communication trace data in the current iteration interval is consistent with the iteration interval of the previous iteration. If they are inconsistent, do not compress and jump to step S108; otherwise, jump to step S106. S106, calculate the ratio of the difference in iteration duration between the current iteration and the previous iteration; S107, Determine whether the ratio of iteration duration difference exceeds the threshold. If it exceeds the threshold, do not compress the jump step S108; otherwise, compress the jump step S109. S108, save the complete trace data for this iteration interval; S109, Save the iteration context; S110, determine whether it is the last transmission based on the MPI function of MPI communication. If it is not the last transmission, jump to step S103. Otherwise, write the saved communication trace data and iteration context to a file, then end and exit.

2. The iterative sensing MPI communication trace data compression method according to claim 1, characterized in that, Before step S101, the process includes generating an instrumented binary file for the target parallel program: inserting instrumentation code into the source code of the target parallel program, the instrumentation code being used to initialize the maximum nesting depth, the context array, the current context nesting depth, and the global counter, as well as defining the entry and exit context functions; The "Enter New Context" function is used to store a new context identifier in the context array, increment the current context nesting depth by 1, and update the global counter to point to the new context identifier in the context array when the current context nesting depth does not exceed the maximum nesting depth; the "Exit Context" function is used to decrement the current context nesting depth by 1 and update the global counter to point to the previous context identifier in the context array when the current context nesting depth is greater than 0. Identify the loop bodies of the target parallel program and the iteration variables used to control the iteration. Use the iteration variables as context identifiers for the new context function and the exit context function. Insert an entry context function before each loop body and an exit context function after each loop body. Compile the source code of the target parallel program and the inserted instrumentation code to generate an instrumented binary file.

3. The iterative sensing MPI communication trace data compression method according to claim 1, characterized in that, Before step S101, the process includes generating an instrumented binary file for the target parallel program: extracting the control flow graph of the target parallel program's binary file, where the nodes in the control flow graph are structural elements in the target parallel program's binary file, and the structural elements include basic blocks, functions, and loops, and the edges in the control flow graph are data dependencies between structural elements; locating the function entry points and each loop body of the target parallel program's binary file based on the control flow graph as instrumentation points; inserting instrumentation code at the instrumentation points of the function entry points, where the instrumentation code is used to initialize the maximum nesting depth, the context array, the current context nesting depth, and the global counter, as well as defining the functions for entering and exiting the new context; The "Enter New Context" function is used to store a new context identifier in the context array, increment the current context nesting depth by 1, and update the global counter to point to the new context identifier in the context array when the current context nesting depth does not exceed the maximum nesting depth; the "Exit Context" function is used to decrement the current context nesting depth by 1 and update the global counter to point to the previous context identifier in the context array when the current context nesting depth is greater than 0. Identify the iteration variables used to control iteration within the loop body, use the iteration variables as context identifiers for the new context function and the exit context function, insert the new context function at the instrumentation point before each loop body, and insert the exit context function at the instrumentation point after each loop body; combine the binary file of the target parallel program and the inserted instrumentation code to generate the instrumented binary file.

4. The iterative sensing MPI communication trace data compression method according to claim 1, characterized in that, Before dividing the iteration interval based on the iteration variables extracted by the instrumentation code in step S102, the process includes dynamically searching and obtaining the memory address of the iteration variable set by the environment variable MPIP_ITER_NAME during initialization using the dlsym function, and forcibly casting this address to an integer pointer. When dividing the iteration interval based on the iteration variables extracted by the instrumentation code in step S102, the process includes checking whether the current iteration variable extracted by the instrumentation code is consistent with the previously extracted iteration variable stored in the environment variable MPIP_ITER_NAME. If they are consistent, it means that the current iteration is still within the original iteration interval; otherwise, it means that the current iteration has entered a new iteration interval.

5. The iterative sensing MPI communication trace data compression method according to claim 1, characterized in that, The functional expression for calculating the ratio of the iteration duration difference between the current iteration and the previous iteration in step S106 is as follows: ; in, The ratio of the difference in iteration duration between the current iteration and the previous iteration. It is an absolute value function. and These represent the iteration durations of the current iteration and the previous iteration, respectively.

6. The iterative sensing MPI communication trace data compression method according to claim 1, characterized in that, Step S107 determines whether the iteration duration difference ratio exceeds the threshold by reading the value of the environment variable MPIP_ITER_THRES in the system. If the environment variable MPIP_ITER_THRES is configured, it determines whether the iteration duration difference ratio exceeds the value of the environment variable MPIP_ITER_THRES; otherwise, it determines whether the iteration duration difference ratio exceeds the default threshold.

7. The iterative sensing MPI communication trace data compression method according to claim 1, characterized in that, The fields in the communication trace data include: global call ID, global call stack ID, start time of this MPI call, duration of this MPI call, calculation time between the current MPI call and the previous MPI call, label number of this MPI function call, and a flag indicating whether this MPI call is the last one in the caller's function. When saving the iteration context in step S109, the fields of the iteration context include: iteration counter, iteration variable value, iteration interval start time and iteration interval duration. The iteration counter is a monotonically increasing integer used to uniquely identify the order of each communication trace iteration and directly serves as a key index for accessing the offset list. The iteration variable value is used in combination with the iteration counter to form a composite identifier to determine the corresponding step inside the loop body. The iteration interval start time and iteration interval duration are used as dimensions of auxiliary indexes to locate the communication trace data based on time attributes.

8. An iteratively sensing MPI communication trace data compression system, comprising a microprocessor and a memory interconnected, characterized in that, The microprocessor is programmed or configured to execute the iteratively sensed MPI communication trace data compression method according to any one of claims 1 to 7.

9. A computer-readable storage medium storing a computer program or instructions, characterized in that, The computer program or instructions are programmed or configured to execute the iteratively sensed MPI communication trace data compression method of any one of claims 1 to 7 via a processor.

10. A computer program product, comprising a computer program or instructions, characterized in that, The computer program or instructions are programmed or configured to execute the iteratively sensed MPI communication trace data compression method of any one of claims 1 to 7 via a processor.

Citation Information

Patent Citations

  • Apparatus and methods for generating dynamic trace data on a GPU

    CN110457033A

  • Communication trace data compression and storage method and system based on parallel program characteristics

    CN119988339A