A method for initializing a communication support environment
By using environment variables or configuration files to mark the processes of communication requirements in a high-performance computing environment, and adjusting the initialization method of the communication support environment, the problem of memory and resource waste in inter-process communication is solved, and more efficient process scale management and performance improvement is achieved.
Patent Information
- Application Number
- CN202110398330.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-14
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2041-04-14
AI Technical Summary
In the field of high-performance computing, the prior art has memory waste and resource waste when initializing inter-process communication, especially in a shared memory architecture, where each process does not have communication requirements, resulting in the expansion of the process scale and the waste of memory and physical resources.
By setting the environment variable cg_per_process or mapping_file to mark the list of processes with communication needs, adjust the initialization method of the communication support environment, and only processes with communication needs are initialized, other processes skip or map on demand, and use memory management function pointers to balance memory space, reducing process scale and memory overhead.
It effectively reduces process scale and memory waste, improves the scalability of the communication support environment, supports larger problem-scale solutions and higher performance, and is simple to implement without affecting message performance.
Smart Images

Figure CN114217943B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an initialization method for a communication support environment, belonging to the technical field of high-performance computing. Background Art
[0002] In a large-scale cluster environment, a job management system is usually used to complete the scheduling, allocation, and management of system resources. Users call the job management interface according to the resource requirements of parallel programs. The job system applies for resources as needed and submits the resource list and necessary information to the communication support environment in a predefined data structure. The communication support environment completes the initialization based on the information provided by the job system to prepare for inter-process communication.
[0003] Inter-process communication needs to be based on a communication context composed of a series of hardware resources and software resources. The hardware resources refer to communication queue resources, including physical resources such as send queues, receive queues, and completion queues. Each type of physical resource needs to occupy corresponding memory space. At the same time, the upper-layer communication interface and the underlying message library both need to maintain a series of data structures to implement resource management services and achieve efficient management and utilization of the above physical resources. In addition, some buffers need to be applied to store user message requests and implement pre-delivery of short messages. Therefore, a certain amount of memory space is required for the communication path between any two processes, and this part of the space increases with the expansion of the process scale.
[0004] Currently, many processors for the high-performance computing field support a certain range of shared memory. Based on the shared memory, different computing resources within the processor can achieve data interaction. The reasonable use of shared memory can effectively improve the data reuse degree within the processor, reduce the communication requirements of the entire chip, and thus improve performance. Based on the above considerations, in some practical applications, not every process needs to participate in message passing. Instead, several processes, based on the requirements of actual task division, use shared memory to achieve collaborative computing, and then a small number of processes complete data interaction.
[0005] As a common support environment on large clusters, the communication support environment needs to meet the requirements of different users and support various possible and compliant communication requirements. Therefore, it is usually required that each process of a parallel program must call the initialization interface to make software and hardware preparations for possible message passing. During the initialization process, the upper-layer communication interface and the underlying message library need to create and maintain many data structures and buffer spaces to implement and meet the communication requirements of the parallel program. This part of the memory overhead is very considerable, and some of the overhead will continue to increase as the number of processes expands. However, not every process in a parallel program has communication requirements. Especially for architectures with shared memory, only individual processes on each processor need to send and receive messages. The initialization of the remaining processes only causes waste of memory and expansion of the process scale, without practical significance. This will cause processes with no actual communication requirements in the application to be forced to apply for physical resources, occupy memory, and manage data structures, expanding the process scale and causing waste of memory space and physical resources. Some applications have large memory capacity requirements, and a larger memory space can help the application solve larger problem scales or improve performance. Summary of the Invention
[0006] The purpose of the present invention is to provide an initialization method for a communication support environment, which helps to support users in solving larger problem scales, pursuing higher performance, is easy to implement, does not affect message performance, and has no additional overhead when users call the message interface.
[0007] To achieve the above object, the technical solution adopted by the present invention is: to provide an initialization method for a communication support environment, which sets cg_per_process or mapping_file through an environment variable to mark the list of processes with communication requirements: the former indicates that the process with (process number % cg_per_process) being 0 has communication requirements, and the remaining processes have no communication requirements; the latter indicates the process mapping file, and the file content is the resource serial number Sid with communication requirements.
[0008] It includes the following steps:
[0009] S1. Call the job management interface to parse the total number of resources tasksize of this job, the initial resource serial number Sid of each process in the job, the resource name list nodeidlist, the unique identifier mpeidlist within the resource slice, the pid list pidlist, and the network device identifier list guidlist, and arrange them in the natural order of the resource list. The i-th element of each list is the information of the i-th resource.
[0010] S2. For the scenario of setting cg_per_process, calculate Sid % cg_per_process based on the initial resource serial number Sid of each process, and extract the relevant information of the processes that satisfy the modulo cg_per_process being 0 from the information returned by the job system. The specific operations are as follows:
[0011] S21. If the resource serial number Sid % cg_per_process is not 0, skip the initialization and directly return the initialization completion flag;
[0012] S22. Reduce the total number of resources tasksize to 1 / cg_per_process, and set Sid to Sid / cg_per_process;
[0013] S23. The nodeidlist, mpeidlist, pidlist, and guidlist structures adopt an in-place merging method to reuse the array space. Extract a valid element every cg_per_process - 1 elements and store it in the position where the first tasksize elements of the original structure are located;
[0014] S3. For the scenario of setting mapping_file, calculate the process number after logical mapping based on the initial resource serial number Sid of each process. Each process reads the mapping file and stores the mapping file in the memory file system through the file system and operating system interfaces. The specific operations are as follows:
[0015] S31. If the resource serial number Sid is not in the mapping_file, skip the initialization and directly return the initialization completion flag;
[0016] S32. Modify the total number of processes after mapping tasksize according to the number of entries in the mapping_file, and set the natural serial number of the entry of the process with the initial resource serial number Sid in the mapping_file to the Sid value after logical mapping;
[0017] S33. Extract the elements of the nodeidlist, mpeidlist, pidlist, and guidlist structures in sequence according to the content of the entries in the mapping_file;
[0018] S34. Overwrite the first tasksize elements of the original information lists with the extracted information list;
[0019] S4. Set the environment variable memory_balance, and set the memory management function pointer according to the variable value, which is used to specify that the memory space mapped during the initialization of the communication support environment is mapped to the private memory space of the process or the shared memory space of the processor. When mapped to the shared memory, the memory overhead of each resource within the processor can be balanced;
[0020] S5. Use the specified memory management function pointer, the updated tasksize, and each information list to complete the subsequent initialization of the communication support environment. The process logical numbers used in the communication are the sequence numbers of each resource in the updated information list.
[0021] Due to the application of the above technical solutions, the present invention has the following advantages compared with the prior art:
[0022] The present invention can effectively reduce the process scale and memory waste, which is beneficial to improving the scalability of the communication support environment, and is also helpful for supporting users to solve larger problem scales and pursue higher performance; moreover, it is simple to implement, does not affect the message performance, and there is no additional overhead when users call the message interface. Description of the Drawings
[0023] Appendix Figure 1 is the flowchart of the present invention. Detailed Embodiment
[0024] Embodiment: The present invention provides an initialization method for a communication support environment. By setting cg_per_process or mapping_file through environment variables, it is used to mark the process list with communication requirements: the former indicates that the process with (process number % cg_per_process) being 0 has communication requirements, and the remaining processes have no communication requirements; the latter indicates the process mapping file, and the file content is the resource serial number Sid with communication requirements;
[0025] It includes the following steps:
[0026] S1. Call the job management interface to parse the total number of resources tasksize of this job, the initial resource serial number Sid of each process in the job, the resource name list nodeidlist, the unique identifier mpeidlist within the resource slice, the pid list pidlist, and the network device identifier list guidlist, and arrange them in the natural order of the resource list. The i-th element of each list is the information of the i-th resource;
[0027] S2. For the scenario of setting cg_per_process, calculate Sid % cg_per_process according to the initial resource serial number Sid of each process, and extract the relevant information of the process that satisfies the modulo cg_per_process being 0 from the information returned by the job system. The specific operations are as follows:
[0028] If the resource serial number Sid%cg_per_process of S21 is not 0, skip the initialization and directly return the initialization completion flag;
[0029] In S22, reduce the total number of resources tasksize to 1 / cg_per_process, and set Sid to Sid / cg_per_process;
[0030] In S23, the nodeidlist, mpeidlist, pidlist, and guidlist structures adopt an in-place merging method, reuse the array space, extract a valid element every cg_per_process - 1 elements, and store it in the position of the first tasksize elements of the original structure;
[0031] In S3, for the scenario of setting the mapping_file, calculate the process number after logical mapping according to the initial resource serial number Sid of each process. Each process reads the mapping file. To reduce the pressure on the global file system caused by large-scale concurrent reading, the mapping file can be stored in the memory file system through the file system and operating system interfaces. The specific operations are as follows:
[0032] If the resource serial number Sid is not in the mapping_file in S31, skip the initialization and directly return the initialization completion flag;
[0033] In S32, modify the total number of processes tasksize after mapping according to the number of entries in the mapping_file, and set the natural serial number of the entry of the process with the initial resource serial number Sid in the mapping_file to the Sid value after logical mapping;
[0034] In S33, extract the elements of the nodeidlist, mpeidlist, pidlist, and guidlist structures in sequence according to the content of the mapping_file entries;
[0035] In S34, overwrite the first tasksize elements of the original information lists with the extracted information lists;
[0036] In S4, set the environment variable memory_balance, and set the memory management function pointer according to the variable value, which is used to specify that the memory space mapped during the initialization of the communication support environment is mapped to the process private memory space or the processor shared memory space. When mapped to the shared memory, the memory overhead of each resource in the processor can be balanced;
[0037] S5. Use the specified memory management function pointer, the updated tasksize, and each information list to complete the initialization of the subsequent communication support environment. The process logical number used in communication is the sequence number of each resource in the updated information list.
[0038] The further explanation of the above embodiments is as follows:
[0039] The present invention modifies the structure array submitted by the job system to the message support environment, and tries to follow the initialization process of the standard message support environment as much as possible, so as to achieve the balance of initialization on demand and memory overhead with as small a change as possible.
[0040] The present invention starts from modifying the initialization process of the communication support environment, adjusts the resource information submitted by the job system to the communication support environment according to the environment variables and configuration files, and completes the initialization of the communication support environment on demand, which can not only ensure the communication requirements of user programs, but also effectively reduce the memory overhead; in terms of use, users only need to specify the environment variables and configuration files; when the number of entries in the configuration file is the same as the total number of resources, the present invention can realize the process mapping customized by users.
[0041] The present invention still realizes the initialization of each process under the default conditions. When users make it clear that some processes have no communication requirements during the whole process of program operation, the communication support environment can complete the message initialization customized by users on demand to reduce the process scale and memory overhead; it can also map the memory space occupied by initialization to the private memory space or shared memory space of the default specified process according to the user's specification to balance the memory overhead of each process.
[0042] The specific steps are as follows:
[0043] 1. Set cg_per_process or mapping_file through environment variables to mark the list of processes with communication requirements: the former means that the processes with (process number % cg_per_process) being 0 have communication requirements, and the rest of the processes have no communication requirements; the latter means the process mapping file, and the file content is the resource serial number Sid with communication requirements.
[0044] 2. Call the job management interface to parse the total number of resources tasksize, the resource name list nodeidlist, the unique identifier mpeidlist within the resource slice, the pid list pidlist, the network device identifier list guidlist, etc. of this job. These contents are arranged in the natural order of the resource list, and the i-th element of each list is the information of the i-th resource.
[0045] 3. For the scenario of setting cg_per_process, calculate Sid % cg_per_process based on the initial resource serial number Sid of each process, and extract the relevant information of the process that satisfies the modulo cg_per_process being 0 from the information returned by the job system. The specific operations are as follows:
[0046] a) If the initial resource serial number Sid % cg_per_process is not 0, skip the initialization and directly return the initialization completion flag.
[0047] b) Reduce the total number of resources tasksize to 1 / cg_per_process.
[0048] c) For structures such as nodeidlist, mpeidlist, pidlist, and guidlist, use the in-place merging method to reuse the array space. Extract a valid element every cg_per_process - 1 elements and store it in the position of the first tasksize elements of the original structure.
[0049] 4. For the scenario of setting mapping_file, calculate the process number after logical mapping based on the initial resource serial number Sid of each process. Each process reads the mapping file. To reduce the pressure on the global file system caused by large-scale concurrent reads, the mapping file can be stored in the memory file system through the file system and operating system interfaces. The specific operations are as follows:
[0050] a) If the initial resource serial number Sid is not in mapping_file, skip the initialization and directly return the initialization completion flag.
[0051] b) Modify the total number of processes tasksize after mapping according to the number of entries in the mapping_file file, and set the natural serial number of the entry of the process with the initial resource serial number Sid in the mapping_file file to the Sid value after logical mapping.
[0052] c) Extract the elements of the nodeidlist, mpeidlist, pidlist, and guidlist structures in order according to the content of the mapping_file file entries.
[0053] d) Overwrite the first tasksize elements of the original information lists with the extracted information list.
[0054] 5. Set the environment variable memory_balance, and set the memory management function pointer according to the variable value, which is used to specify that the memory space mapped during the initialization of the communication support environment is mapped to the process-private memory space or the processor-shared memory space. When mapped to the shared memory, the memory overhead of each resource within the processor can be balanced.
[0055] 6. Initialize the subsequent communication support environment by using the specified memory management function pointer, the updated tasksize, and each information list. The process logical number used in communication is the sequence number of each resource in the updated information list.
[0056] It can be found through the above initialization process that in addition to adjusting the total number of resources and the information list according to requirements, the present invention does not modify other steps of the initialization. The amount of change is small and it is easy to implement. When cg_per_process = 1 or the mapping_file is the natural sequence number table of resources, the initialization result is the same as the original message support environment, which is compatible with the standard initialization mode. Processes specified by the user that do not participate in communication will not participate in the specific initialization steps, so there is no need to apply for various hardware resources and memory buffers. The process scale is effectively compressed, and the buffer space overhead related to the process scale is also reduced accordingly. In addition, when using the mapping_file, if the given content of the mapping_file is any permutation of the resource sequence number table Sid, this patent can achieve process mapping, that is, any specified correspondence relationship between the process logical number and the resource number.
[0057] When adopting the above initialization method for a communication support environment, it can effectively reduce the process scale and memory waste, which is beneficial to improving the scalability of the communication support environment and helps support users to solve larger problem scales and pursue higher performance. Moreover, it is easy to implement and does not affect the message performance. There is no additional overhead when users call the message interface.
[0058] To facilitate a better understanding of the present invention, the following terms used in this article will be briefly explained:
[0059] Job management system: used to schedule and allocate system resources in a large cluster environment. Specifically, it is to divide sufficient resources from the cluster system according to the requirements of the program to be run and submit the application program to the divided resources for running.
[0060] The above embodiments are only used to illustrate the technical concept and characteristics of the present invention, and their purpose is to enable those who are familiar with this technology to understand the content of the present invention and implement it accordingly, and cannot be used to limit the protection scope of the present invention. All equivalent changes or modifications made according to the spirit and essence of the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for initializing a communication support environment, characterized in that Based on the following configuration: Set cg_per_process or mapping_file through environment variables to mark the list of processes with communication requirements: the former indicates that the process with process number %cg_per_process equal to 0 has communication requirements, and the remaining processes have no communication requirements; the latter indicates the process mapping file, and the file content is the resource serial number Sid with communication requirements; Include the following steps: S1. Call the job management interface to parse the total number of resources tasksize of this job, the initial resource serial number Sid of each process in the job, the resource name list nodeidlist, the unique identifier mpeidlist within the resource slice, the pid list pidlist, and the network device identifier list guidlist, and arrange them in the natural order of the resource list. The i-th element of each list is the information of the i-th resource; S2. For the scenario of setting cg_per_process, calculate Sid%cg_per_process based on the initial resource serial number Sid of each process, and extract the relevant information of the processes that satisfy the modulo cg_per_process equal to 0 from the information returned by the job system. The specific operations are as follows: S21. If Sid%cg_per_process of the resource serial number is not 0, skip the initialization and directly return the initialization completion flag; S22. Reduce the total number of resources tasksize to 1 / cg_per_process, and set Sid to Sid / cg_per_process; S23. The nodeidlist, mpeidlist, pidlist, and guidlist structures adopt an in-place merging method to reuse the array space. Extract a valid element every cg_per_process - 1 elements and store it in the position where the first tasksize elements of the original structure are located; S3. For the scenario of setting mapping_file, calculate the process number after logical mapping based on the initial resource serial number Sid of each process. Each process reads the mapping file and stores the mapping file in the memory file system through the file system and operating system interfaces. The specific operations are as follows: S31. If the resource serial number Sid is not in the mapping_file, skip the initialization and directly return the initialization completion flag; S32. Modify the total number of processes after mapping tasksize according to the number of entries in the mapping_file, and set the natural serial number of the entry of the process with the initial resource serial number Sid in the mapping_file to the Sid value after logical mapping; S33. Extract the elements of the nodeidlist, mpeidlist, pidlist, and guidlist structures in order according to the content of the mapping_file entries; S34. Overwrite the first tasksize elements of the original information lists with the extracted information list; S4. Set the environment variable memory_balance, and set the memory management function pointer according to the variable value, which is used to specify that the memory space mapped during the initialization of the communication support environment is mapped to the process private memory space or the processor shared memory space. When mapped to the shared memory, the memory overhead of each resource within the processor can be balanced; S5. Use the specified memory management function pointer, the updated tasksize, and each information list to complete the subsequent initialization of the communication support environment. The process logical number used in the communication is the sequence number of each resource in the updated information list.
Citation Information
Patent Citations
Cross-process resource sharing method and equipment
CN103605577A
Method and system for power distribution master station to automatically identify terminal device
CN107069950A