NCCL test method and apparatus, and electronic device
By providing an NCCL test method to test the NCCL high-performance communication library, the shortcomings in the communication efficiency, scalability and other aspects of the prior art are solved, and more efficient testing performance is achieved.
Patent Information
- Application Number
- CN202411875934.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art has obvious shortcomings in multi-GPU communication efficiency, scalability, code complexity, compatibility, optimization and maintenance costs, resulting in limited scale and efficiency of distributed training.
It provides a NCCL test method, which uses function definition parameters, defines the number of tests and the number of graphics cards, calls test functions to test the NCCL high-performance communication library, and performs data processing and output based on the test results.
By testing the NCCL high-performance communication library, the shortcomings in communication efficiency, scalability, code complexity, compatibility, optimization and maintenance costs in the prior art are alleviated, and the testing performance is improved.
Smart Images

Figure CN119807056A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of testing technology, and in particular to a testing method, apparatus, and electronic device for NCCL. Background Technology
[0002] Currently, communication between multiple GPUs may rely on inefficient general-purpose communication mechanisms, leading to increased latency and reduced bandwidth utilization, thus impacting overall performance. Furthermore, as the number of GPUs increases, communication complexity rises sharply, making it difficult to scale the system to large-scale clusters. This limits the scale and efficiency of distributed training. Moreover, developers need to manually implement complex collective communication operations, such as AllReduce and Broadcast, which not only increases code complexity but also increases the risk of errors.
[0003] Overall, existing technologies have significant shortcomings in terms of communication efficiency, scalability, code complexity, compatibility, optimization, and maintenance costs. Summary of the Invention
[0004] The purpose of this invention is to provide a testing method, apparatus, and electronic device for NCCL, so as to alleviate the technical problems of existing technologies that have obvious shortcomings in terms of communication efficiency, scalability, code complexity, compatibility, optimization, and maintenance costs, and thus improve testing performance.
[0005] In a first aspect, embodiments of the present invention provide a testing method for NCCL, comprising: obtaining function definition parameters; defining the number of tests and the number of graphics cards in the main function according to the function definition parameters; calling a test function, wherein the test function is used to test the NCCL high-performance communication library; and performing test operations based on the test function to obtain test results.
[0006] In a preferred embodiment of the present invention, after the step of performing a test operation and obtaining a test result through the above-mentioned test function, the above method includes: performing data processing on the above-mentioned test result based on the above-mentioned test function to obtain a processed test result; and outputting the processed test result.
[0007] In a preferred embodiment of the present invention, after the step of performing test operations based on the above-described test function and obtaining test results, the method further includes: writing the test results into a preset log file.
[0008] In a preferred embodiment of the present invention, the step of processing the test results based on the test function to obtain the processed test results includes: filtering bus bandwidth information from the test results in the log file; calculating the average value of the bus bandwidth information; and determining the average value and the bus bandwidth information as the processed test results.
[0009] In a preferred embodiment of the present invention, the step of filtering bus bandwidth information from the test results in the log file includes: filtering target data containing the bus bandwidth information in the test results from the log file; and extracting the bus bandwidth information from the bus bandwidth information based on a preset extraction instruction.
[0010] In a preferred embodiment of the present invention, after calculating the average value of the bus bandwidth information and determining the average value and the bus bandwidth information as the processed test result, the method includes: saving the processed test result to the log file and displaying it on the screen.
[0011] In a preferred embodiment of the present invention, the number of tests is 5; the number of graphics cards is 8.
[0012] Secondly, embodiments of the present invention also provide a testing device for NCCL, comprising: a parameter acquisition module for acquiring function definition parameters; a definition module for defining the number of tests and the number of graphics cards in the main function according to the function definition parameters; a calling module for calling a test function, wherein the test function is used to test the NCCL high-performance communication library; and a testing module for performing test operations based on the test function to obtain test results.
[0013] Thirdly, embodiments of the present invention also provide an electronic device, which includes a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the NCCL testing method.
[0014] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the NCCL testing method described above.
[0015] The embodiments of the present invention have the following beneficial technical effects:
[0016] This invention provides a testing method, apparatus, and electronic device for NCCL, comprising: obtaining function definition parameters; defining the number of tests and the number of graphics cards for the main function based on the function definition parameters; calling a test function, which is used to test the NCCL high-performance communication library; and performing test operations based on the test function to obtain test results. This method tests the NCCL high-performance communication library through a test function, thereby alleviating the significant shortcomings of existing technologies in terms of communication efficiency, scalability, code complexity, compatibility, optimization, and maintenance costs, and improving testing performance. Attached Figure Description
[0017] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 A flowchart illustrating a testing method for NCCL provided in an embodiment of the present invention;
[0019] Figure 2 A flowchart illustrating another NCCL testing method provided in an embodiment of the present invention;
[0020] Figure 3 This is a schematic diagram of the structure of a testing device for NCCL provided in an embodiment of the present invention;
[0021] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0022] Icons: 31-Parameter acquisition module; 32-Definition module; 33-Calling module; 34-Test module; 35-Configuration module; 41-Memory; 42-Processor; 43-Bus; 44-Communication interface. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0024] Existing technologies have significant shortcomings in terms of communication efficiency, scalability, code complexity, compatibility, optimization, and maintenance costs.
[0025] Based on this, embodiments of the present invention provide a testing method, apparatus, and electronic device for NCCL. This method tests the NCCL high-performance communication library through test functions, thereby alleviating the significant shortcomings of existing technologies in terms of communication efficiency, scalability, code complexity, compatibility, optimization, and maintenance costs, and improving testing performance. To facilitate understanding of the present invention, a testing method for NCCL is first introduced.
[0026] Example 1
[0027] In this embodiment, Figure 1 This is a flowchart illustrating a test method for NCCL provided in an embodiment of the present invention.
[0028] Depend on Figure 1 As seen, the method includes:
[0029] Step S101: Obtain the function definition parameters.
[0030] This invention operates on the Linux operating system and utilizes the function functionality of the Linux bash script compiler to define the `main` and `nccl_test` functions. The `main` function allows the tester to select the number of tests and the number of graphics cards used; if not specified, it defaults to 5 tests, each using 8 graphics cards. The `nccl_test` function automatically filters out key result values and calculates their average. Ultimately, this enables the server to automatically perform NCCL testing after the tester sets the number of tests and the number of graphics cards used.
[0031] Step S102: Based on the function definition parameters above, define the number of tests and the number of graphics cards in the main function.
[0032] Step S103: Call the test function, which is used to test the NCCL high-performance communication library.
[0033] Step S104: Based on the above test function, perform the test operation and obtain the test results.
[0034] This invention provides a testing method for NCCL, comprising: obtaining function definition parameters; defining the number of tests and the number of graphics cards in the main function based on the function definition parameters; calling a test function, which is used to test the NCCL high-performance communication library; and performing test operations based on the test function to obtain test results. This method tests the NCCL high-performance communication library through a test function, thereby alleviating the significant shortcomings of existing technologies in terms of communication efficiency, scalability, code complexity, compatibility, optimization, and maintenance costs, and improving testing performance.
[0035] Example 2
[0036] Based on the above embodiments, Figure 2 A flowchart illustrating another NCCL testing method provided in an embodiment of the present invention.
[0037] Depend on Figure 2 As seen, the method includes:
[0038] Step S201: Obtain the function definition parameters.
[0039] Step S202: Based on the function definition parameters above, define the number of tests and the number of graphics cards in the main function.
[0040] Step S203: Call the test function, which is used to test the NCCL high-performance communication library.
[0041] Step S204: Based on the above test function, perform the test operation and obtain the test results.
[0042] Step S205: Process the test results based on the above test function to obtain the processed test results.
[0043] Step S206: Output the test results after the above processing.
[0044] In this embodiment, after the step of performing test operations based on the above test function and obtaining test results, the method further includes: writing the test results into a preset log file.
[0045] Furthermore, the steps of processing the test results based on the above test function to obtain the processed test results include: filtering bus bandwidth information from the test results in the above log file; calculating the average value of the bus bandwidth information; and determining the average value and the bus bandwidth information as the processed test results.
[0046] Furthermore, the step of filtering bus bandwidth information from the test results in the log file includes: filtering target data containing the bus bandwidth information from the test results in the log file; and extracting the bus bandwidth information from the bus bandwidth information based on a preset extraction instruction.
[0047] Furthermore, after calculating the average value of the bus bandwidth information and determining the average value and the bus bandwidth information as the processed test result, the method includes: saving the processed test result to the log file and displaying it on the screen.
[0048] In this embodiment, lines containing bus bandwidth information are filtered from the log file, and then the bus bandwidth values are extracted using the awk command. The average bus bandwidth is then calculated, and finally, the average value is output to the screen and the log file.
[0049] The above tests were conducted 5 times; the number of graphics cards was 8.
[0050] In practice, the number of tests and the number of graphics cards mentioned above can also be set to any other arbitrary values.
[0051] This invention provides a testing method for NCCL, comprising: obtaining function definition parameters; defining the number of tests and the number of graphics cards in the main function based on the function definition parameters; calling a test function, which is used to test the NCCL high-performance communication library; performing test operations based on the test function to obtain test results; processing the test results based on the test function to obtain processed test results; and outputting the processed test results. This method tests the NCCL high-performance communication library through a test function and automatically outputs test results, which not only improves testing performance but also increases the convenience of testing.
[0052] Example 3
[0053] Based on the above embodiments, Figure 3 This is a schematic diagram of the structure of a test device for NCCL provided in an embodiment of the present invention.
[0054] Depend on Figure 3 As seen, the device includes:
[0055] Parameter acquisition module 31, retrieves function definition parameters.
[0056] Define module 32, which is used to define the number of tests and the number of graphics cards in the main function according to the parameters defined in the above function definition.
[0057] Module 33 is called to invoke the test function, which is used to test the NCCL high-performance communication library.
[0058] Test module 34 is used to perform test operations based on the above test functions and obtain test results.
[0059] The parameter acquisition module 31, definition module 32, calling module 33, and testing module 34 are connected in sequence.
[0060] In a preferred embodiment of the present invention, the test module 34 is further configured to perform data processing on the test results based on the above-mentioned test function to obtain the processed test results; and output the processed test results.
[0061] In a preferred embodiment of the present invention, the test module 34 is further configured to write the above test results into a preset log file.
[0062] In a preferred embodiment of the present invention, the test module 34 is further configured to filter bus bandwidth information from the test results in the log file; calculate the average value of the bus bandwidth information; and determine the average value and the bus bandwidth information as the processed test result.
[0063] In a preferred embodiment of the present invention, the test module 34 is further configured to filter target data containing the bus bandwidth information from the test results in the log file; and extract the bus bandwidth information from the bus bandwidth information based on a preset extraction instruction.
[0064] In a preferred embodiment of the present invention, the test module 34 is further configured to save the processed test results to the log file and display them on the screen.
[0065] The NCCL testing apparatus provided in this embodiment of the invention has the same technical features as the NCCL testing method provided in the above embodiments, and therefore can solve the same technical problems and achieve the same technical effects. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0066] Example 4
[0067] This embodiment provides an electronic device, including a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the steps of the NCCL test method.
[0068] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a test method for NCCL.
[0069] See Figure 4 The diagram shows the structure of an electronic device, which includes a memory 41 and a processor 42. The memory 41 stores a computer program that can run on the processor 42. When the processor executes the computer program, it implements the steps provided by the above-mentioned NCCL test method.
[0070] like Figure 4 As shown, the device also includes a bus 43 and a communication interface 44, with the processor 42, the communication interface 44 and the memory 41 connected via the bus 43; the processor 42 is used to execute executable modules, such as computer programs, stored in the memory 41.
[0071] The memory 41 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 44 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.
[0072] Bus 43 can be an ISA bus, PCI bus, or EISA bus, etc. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0073] The memory 41 stores the program, and the processor 42 executes the program after receiving the execution instruction. The method executed by the NCCL testing device disclosed in any of the foregoing embodiments of the present invention can be applied to the processor 42, or implemented by the processor 42. The processor 42 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor 42 or by instructions in the form of software. The processor 42 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this invention can be directly manifested as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 41, and processor 42 reads information from memory 41 and, in conjunction with its hardware, completes the steps of the above method.
[0074] Furthermore, this embodiment of the invention also provides a machine-readable storage medium storing machine-executable instructions. When these machine-executable instructions are invoked and executed by the processor 42, they cause the processor 42 to implement the aforementioned NCCL test method.
[0075] The electronic devices and computer-readable storage media provided in the embodiments of the present invention have the same technical features, so they can also solve the same technical problems and achieve the same technical effects.
[0076] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0077] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
Claims
1. A testing method of NCCL, characterized in that: include: Get function definition parameters; According to the function definition parameters, define the number of tests of the main function and the number of graphics cards; Calling a test function, wherein the test function is used to test the NCCL high-performance communication library; Based on the test function, a test operation is performed to obtain a test result.
2. The NCCL testing method according to claim 1, characterized in that: After the step of executing the test operation through the test function and obtaining the test result, the method includes: Performing data processing on the test result based on the test function to obtain a processed test result; The processed test results are output.
3. The NCCL testing method according to claim 2, characterized in that: After the step of performing a test operation based on the test function and obtaining a test result, the method further includes: The test results are written into a preset log file.
4. The NCCL testing method according to claim 3, characterized in that: The step of performing data processing on the test result based on the test function to obtain the processed test result includes: Filtering bus bandwidth information in the test result from the log file; Calculating an average value of the bus bandwidth information; The average value and the bus bandwidth information are determined as the processed test result.
5. The NCCL testing method according to claim 4, characterized in that: The step of filtering the bus bandwidth information in the test result from the log file comprises: Filtering the target data containing the bus bandwidth information in the test results from the log file; Based on a preset extraction instruction, the bus bandwidth information in the bus bandwidth information is extracted.
6. The NCCL testing method according to claim 4, characterized in that: After the steps of calculating the average value of the bus bandwidth information and determining the average value and the bus bandwidth information as the processed test result, the method includes: The processed test results are saved in the log file and displayed on the screen.
7. The NCCL testing method according to claim 1, characterized in that: The number of tests is 5; the number of graphics cards is 8.
8. A test device of NCCL, characterized in that: include: Parameter acquisition module, obtains function definition parameters; A definition module, used to define the number of tests of the main function and the number of graphics cards according to the function definition parameters; A calling module, used for calling a test function, wherein the test function is used for testing the NCCL high-performance communication library; The test module is used to perform test operations based on the test function and obtain test results.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the NCCL testing method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the NCCL testing method according to any one of claims 1 to 7 is implemented.