File access method and device

By implementing a process adapter in the user-mode process of the computing node and bypassing the system kernel call, the data storage and access links of large language models are optimized, the high overhead and latency problems of the storage system are solved, and access performance is improved.

CN118796772BActive Publication Date: 2025-09-26ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411276575.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2025-09-26
Estimated Expiration
2044-09-11

AI Technical Summary

Technical Problem

Existing storage systems suffer from high system overhead and access latency when storing and accessing large language model (LLM) models. Frequent system kernel calls lead to performance bottlenecks, especially in large-scale computing tasks.

Method used

By implementing a process adapter in the user-mode process of the computing node, the access request and result are intercepted and transmitted, bypassing the system kernel call, and completing the access interaction to the user-mode file system directly in the user mode.

Benefits of technology

It significantly reduces the number of calls to the system kernel, lowers system overhead, and improves the access performance of the user-mode file system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796772B_ABST
    Figure CN118796772B_ABST
Patent Text Reader

Abstract

A file access method is applied to a computing node that performs a computing task, wherein a user-mode file system running in user mode is mounted on the system kernel of the computing node; a first process adapter is implemented in a first user-mode process corresponding to the computing task; and a second process adapter is implemented in a second user-mode process corresponding to the user-mode file system. The method comprises: the first process adapter intercepts an access request of the first user-mode process to the user-mode file system; the first process adapter transmits the access request to the second process adapter in user mode, and the second process adapter submits the access request to the second user-mode process; the second process adapter intercepts an access result generated by the second user-mode process performing access processing on the user-mode file system, and transmits the access result to the first process adapter in user mode, and the first process adapter submits the access result to the first user-mode program.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification belong to the field of artificial intelligence technology, and more particularly, relate to a file access method and device. Background Art

[0002] With the rapid development of Large Language Models (LLMs), not only is the amount of data associated with LLMs rapidly expanding, but the requirements for storing, accessing, and writing this data are also constantly changing. For example, LLM models often contain billions or even tens of billions of parameters. Therefore, in addition to storing the data required for inference, significant storage resources are required to store these model parameters. Furthermore, LLM models often require high-speed data read and write operations during runtime to enable rapid data processing during the inference phase. This necessitates optimizing existing storage systems to ensure that LLM models can quickly access the required data.

[0003] On this basis, changes in data storage and reading and writing requirements are bound to pose new challenges to the IO performance of existing storage systems. Summary of the Invention

[0004] This specification provides a file access method, which is applied to a computing node that performs a computing task. A user-mode file system running in user mode is mounted on a system kernel of the computing node. The user-mode file system is used to store files related to the computing task. A first process adapter is implemented in a first user-mode process corresponding to the computing task. A second process adapter is implemented in a second user-mode process corresponding to the user-mode file system. The method comprises:

[0005] The first process adapter intercepts an access request for the user-mode file system triggered by the first user-mode process during operation;

[0006] In response to the intercepted access request, the first process adapter transmits the access request to the second process adapter in user mode, and the second process adapter further submits the access request to the second user mode process, so that the second user mode process executes the access request to access the user mode file system;

[0007] The second process adapter intercepts the access result generated by the second user-state process accessing the user-state file system, and transmits the access result to the first process adapter in the user state. The first process adapter further submits the access result to the first user-state program so that the first user-state program completes the computing task based on the access result.

[0008] Optionally, the execution code run by the first user-mode process includes a first function for initiating a system call to the system kernel to access the user-mode file system; correspondingly, the first process adapter includes a second function for accessing the user-mode file system in the user mode;

[0009] The first process adapter intercepts an access request for the user-mode file system triggered by the first user-mode process during operation, including:

[0010] In response to a call to the first function by the first user-mode process during execution, replacing the first function with the second function, so that the first user-mode process further initiates a call to the second function, and submits an access request for the user-mode file system triggered during execution as a call parameter to the first process adapter;

[0011] The first process adapter program transmits the access request to the second process adapter program in a user state, including:

[0012] The first process adapter executes the second function and transmits the access request to the second process adapter in user mode.

[0013] Optionally, the executable code run by the second user-mode process includes a third function for initiating a system call to the system kernel to return an access result to the user-mode file system to the first user-mode process; correspondingly, the second process adapter includes a fourth function for returning the access result to the user-mode file system to the first user-mode process in user mode;

[0014] The second process adapter intercepts an access result generated by the second user-mode process performing access processing on the user-mode file system, including:

[0015] In response to the second user-mode process calling the third function during execution, replacing the third function called by the second user-mode process with the fourth function, so that the second user-mode process further initiates a call to the fourth function, and submits an access result generated by performing access processing on the user-mode file system as a call parameter to the second process adapter;

[0016] The second process adapter program transmits the access result to the first process adapter program in a user state, including:

[0017] The second process adapter program executes the fourth function and transmits the access result to the first process adapter program in user mode.

[0018] Optionally, the first process adapter program transmitting the access request to the second process adapter program in user mode includes:

[0019] The first process adapter transmits the access request to the second process adapter in a user state in a memory sharing manner;

[0020] The second process adapter program transmits the access result to the first process adapter program in a user state, including:

[0021] The second process adapter transmits the access result to the first process adapter in a user state in a memory sharing manner.

[0022] Optionally, the access request includes a read request for a target file stored in the user-mode file system; accordingly, the access result includes the target file read from the user-mode file system; or

[0023] The access request includes a write request to write a target file into the user-mode file system; correspondingly, the access result includes a write result of writing the target file into the user-mode file system.

[0024] Optionally, the file stored in the user-mode file system is a file block composed of several files.

[0025] Optionally, the user-state file system is connected to a storage system for storing files related to the computing task; wherein an RDMA connection is established between the user-state file system and the storage system;

[0026] The method further comprises:

[0027] Before the computing node executes the computing task, files related to the computing task are synchronized from the storage system to the user-mode file system for storage based on the RDMA connection.

[0028] Optionally, the operating system used by the computing node is a Linux system; the process adapter is an Adaptor adapter implemented in a user-mode process based on the LD_PRELOAD mechanism supported by the Linux system.

[0029] Optionally, the user-state file system is a user-state file system created based on a libfuse library provided by a Linux system; the user-state file system is mounted to the Linux system through a Fuse kernel module of the Linux system.

[0030] Optionally, the computing task is a training task for training an LLM model; or, a reasoning task for performing logical reasoning based on an LLM model.

[0031] Optionally, the user-mode file system is a file system implemented based on a flash storage device carried by the computing node.

[0032] Optionally, the user-mode file system is a distributed file system implemented based on a flash storage device carried by each computing node in a computing node cluster that jointly executes the computing task.

[0033] This specification also provides a file access device, which is applied to a computing node that performs a computing task, wherein a user-mode file system running in user mode is mounted on a system kernel of the computing node; the user-mode file system is used to store files related to the computing task; a first process adapter is implemented in a first user-mode process corresponding to the computing task; and a second process adapter is implemented in a second user-mode process corresponding to the user-mode file system; the device comprises:

[0034] a first interception module, configured for the first process adapter to intercept access requests for the user-mode file system triggered by the first user-mode process during its execution;

[0035] a first transmission module, in response to the intercepted access request, transmitting the access request from the first process adapter to the second process adapter in user mode, and having the second process adapter further submit the access request to the second user mode process, so that the second user mode process executes the access request and performs access processing on the user mode file system;

[0036] a second interception module, wherein the second process adapter intercepts an access result generated by the second user-mode process performing access processing on the user-mode file system;

[0037] The second transmission module, the second process adapter transmits the access result to the first process adapter in the user state, and the first process adapter further submits the access result to the first user state program, so that the first user state program completes the computing task based on the access result.

[0038] In the above embodiment, by implementing process adapters on the user-state process corresponding to the computing task and the user-state process corresponding to the user-state file system mounted on the system kernel, when the user-state process corresponding to the computing task accesses the user-state file system, the access interaction with the user-state file system can be completed in the user state through the implemented process adapter, without the need to initiate a call to the system kernel. This can optimize the access link to the user-state file system, significantly reduce the number of calls to the system kernel, reduce system overhead, and thus improve the access performance when accessing the user-state file system. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0040] Figure 1 This is an interactive diagram showing an example of a computing node accessing a user-mode file system through a system kernel in one embodiment of this specification;

[0041] Figure 2 is a flow chart of a file access method shown in one embodiment of this specification;

[0042] Figure 3 This is an interactive diagram showing an example of a computing node accessing a user-mode file system in user mode in one embodiment of this specification;

[0043] Figure 4 is a schematic structural diagram of an electronic device shown in an embodiment of this specification;

[0044] Figure 5 It is a block diagram of a file access device shown in one embodiment of this specification. DETAILED DESCRIPTION

[0045] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. All other embodiments derived by those skilled in the art based on the embodiments in this specification without creative effort shall fall within the scope of protection of this specification.

[0046] In actual applications, when computing nodes perform computing tasks such as training tasks for LLM models or inference tasks based on LLM models, in order to achieve high-speed data access to files related to the computing tasks, a user-mode file system running in user mode is usually implemented on the computing node as a cache layer based on the storage resources carried by the computing node, and the user-mode file system is mounted on the system kernel of the computing node.

[0047] Before a compute node begins executing a computing task, it can cache task-related files in a user-mode file system. When the compute node begins executing a computing task, if the user-mode process corresponding to the task needs to access the user-mode file system, it can initiate access to the user-mode file system through the compute node's system kernel as a relay.

[0048] See Figure 1 , Figure 1 FIG2 is an interaction diagram showing a computing node accessing a user-mode file system through a system kernel.

[0049] like Figure 1 As shown, taking the Linux system as an example of the operating system used by the above-mentioned computing node, in the Linux system, the above-mentioned user-state file system can be a user-state file system created based on the libfuse library provided by the Linux system; the user-state file system can be mounted to the Linux system through the Fuse kernel module of the Linux system.

[0050] In the user state of a Linux system, a first user state process corresponding to a computing task can be run, and a second user state process corresponding to the user state file system can also be run. The first user state process can usually be used to perform the computing task, while the second user state process can usually be used to manage the user state file system.

[0051] The first user-mode process corresponding to the computing task, during the execution of the execution code related to the computing task, if it needs to access files stored in the user-mode file system, can usually access the user-mode file system by calling the system function in the system kernel.

[0052] For example, the access behavior of the first user-mode process to the user-mode file system may generally include the reading behavior of files stored in the user-mode file system and the writing behavior of files to the user-mode file system. The above-mentioned system functions may include the read function and the write function. When the first user-mode process needs to read a file stored in the user-mode file system, it can initiate the reading operation of the file stored in the user-mode file system by calling the read function in the system kernel; when the first user-mode process needs to write a file to the user-mode file system, it can initiate the writing operation of the file to the user-mode file system by calling the write function in the system kernel.

[0053] Please continue to see Figure 1 , taking the access scenario where the first user state process reads a file stored in the user state file system as an example, Figure 1 In the access link for the user-mode file system shown, when the first user-mode process calls the read function in the system kernel, it is usually necessary to transfer the read request (that is, the call request for the read function) through the VFS (Virtual Filesystem) layer in the system kernel to the kernel-mode FUSE module in the system kernel.

[0054] After receiving the read request, if the size of the read request exceeds the single request that the system kernel can handle, the Fuse module will usually split the read request into multiple read requests; for example, the default size of a single request that can be handled by the system kernel of the Linux system is usually 128K, so the Fuse module will further split the received read request into multiple read requests of 128K in size.

[0055] Then, the Fuse module can continue to send the split read request to the user-mode file system created based on the libfuse library running in user mode. After receiving the read request sent by the Fuse module, the second user-mode process corresponding to the user-mode file system can call the implementation logic in the user-mode file system to read the file, and then return the read file to the kernel-mode Fuse module in the system kernel according to the same link. The Fuse module will continue to return the read file to the VFS layer in the system kernel, and finally the VFS layer will return the read file to the above-mentioned first user-mode process.

[0056] The first user state process and the second user state process may continuously repeat the above interaction process until all split read requests are processed.

[0057] However, in the above scheme, on the one hand, since each split read request needs to pass through the system kernel, undergo multiple processing and transfers in kernel mode before being delivered to the user-mode file system in user mode, the problem of excessive system overhead will occur. For example, assuming that the above read request is a read request for a single large block file, such as a read request for a large block file of 128MB, then if the read request is split according to the default size of 128K for a single request that can be processed by the system kernel of the Linux system, it will be split into 1024 sub-read requests. These 1024 read requests all pass through the system kernel, undergo multiple processing and transfers in kernel mode before being delivered to the user-mode file system in user mode, which obviously results in a large amount of system overhead.

[0058] On the other hand, since the file finally read needs to be copied back and forth multiple times between user state and kernel state before it can be finally transmitted back to the first user state process in user state, there will obviously be a problem of excessively high access delay for the file, which will affect the access performance to the user state file system.

[0059] Based on this, this specification proposes a technical solution that can bypass the system kernel to complete access to the user-mode file system in user mode.

[0060] During implementation, a first process adapter may be implemented in a first user-mode process corresponding to the computing task, and a second process adapter may be implemented in a second user-mode process corresponding to the user-mode file system.

[0061] During the operation of the first user-mode process, the first process adapter can intercept an access request for the user-mode file system triggered by the first user-mode process during the operation, and then transmit the access request to the second process adapter in the user mode.

[0062] After receiving the access request transmitted by the first process adapter in the user state, the second process adapter may submit the access request to the second user state process, and the second user state process continues to execute the access request to access the user state file system.

[0063] When the second user-state process executes the access request, the second process adapter can intercept the access result generated by the second user-state process's access processing on the user-state file system, and then transmit the access result to the first process adapter in the user state according to the same link.

[0064] After receiving the access result transmitted by the second process adapter in the user state, the first process adapter may further submit the access result to the first user state program, so that the first user state program completes the computing task based on the access result.

[0065] In the above technical solution, by implementing process adapters on the user-state process corresponding to the computing task and the user-state process corresponding to the user-state file system mounted on the system kernel, when the user-state process corresponding to the computing task accesses the user-state file system, the access interaction for the user-state file system can be completed in the user state through the implemented process adapter, without the need to initiate a call to the system kernel. This can optimize the access link to the user-state file system, significantly reduce the number of calls to the system kernel, reduce system overhead, and thus improve the access performance when accessing the user-state file system.

[0066] See Figure 2 , Figure 2 This is a flowchart of a file access method shown in this specification, wherein the method is applied to a computing node that performs a computing task, wherein a user-mode file system running in user mode is mounted on the system kernel of the computing node; the user-mode file system is used to store files related to the computing task; a first process adapter is implemented in a first user-mode process corresponding to the computing task; and a second process adapter is implemented in a second user-mode process corresponding to the user-mode file system; the method includes the following execution process:

[0067] Step 202: The first process adapter intercepts an access request for the user-mode file system triggered by the first user-mode process during its execution;

[0068] The above-mentioned computing tasks may specifically include large-scale computing tasks of various task types; for example, in one embodiment shown, the above-mentioned computing tasks may specifically include training tasks for LLM models, and reasoning tasks for performing logical reasoning based on LLM models, and so on.

[0069] The computing nodes mentioned above can be physical nodes used to perform computing tasks, or they can be virtual nodes. For example, in actual applications, large-scale computing tasks such as training tasks for LLM models or reasoning tasks based on LLM models usually need to be executed through a large-scale distributed computing cluster. The computing cluster can further include several sites distributed in different regions, and the computing nodes mentioned above can be physical devices deployed at each site, or virtual devices (such as virtual machines) obtained by further virtualizing physical devices. In this scenario, the computing task performed by each computing node can be a subtask obtained by splitting the computing task jointly performed by each computing node in the computing cluster according to the number of computing nodes.

[0070] In practical applications, in order to achieve high-speed data access to files related to computing tasks, a user-mode file system running in user mode can be implemented on the computing node as a cache layer based on the storage resources carried by the computing node, and the user-mode file system can be mounted on the system kernel of the computing node.

[0071] For example, in one embodiment shown, taking the Linux system as an example of the operating system carried by the above-mentioned computing node, in the Linux system, the above-mentioned user-state file system can be a user-state file system created based on the libfuse library provided by the Linux system; the user-state file system can be mounted to the Linux system through the Fuse kernel module of the Linux system.

[0072] It should be noted that the type of storage resources used by the user-mode file system implemented on the computing node is not particularly limited in this specification.

[0073] In one embodiment shown, the storage resources on the computing node may generally include a flash memory device. In this case, a user-mode file system may be implemented on the computing node using the flash memory device on the computing node.

[0074] For example, in practical applications, computing nodes are usually equipped with GPUs to perform large-scale computing tasks such as training tasks for LLM models or inference tasks based on LLM models. In this case, the GPU can be directly connected to a flash storage device (such as an SSD solid-state drive) running the NVMe protocol. This allows the GPU to directly transfer files stored in the above user-mode file system from the flash storage device to the GPU memory without going through the CPU and system memory.

[0075] In this way, the high read and write speed of the flash storage device can be fully utilized, thereby improving the overall access performance of the user-mode file system.

[0076] In one embodiment shown, for large-scale computing tasks, it is usually necessary to jointly execute the computing tasks through a computing node cluster. In this case, the above-mentioned user-state file system can specifically be a distributed user-state file system implemented based on the storage resources carried by each computing node in the above-mentioned computing node cluster.

[0077] For example, still taking the example of executing the above-mentioned computing tasks through a large-scale distributed computing cluster, in actual applications, the computing cluster can further include several sites distributed in different regions, and each site can include several physical devices or virtual devices serving as computing nodes. In this case, for each site, a distributed user-mode file system can be implemented within the site based on the storage resources carried by the several physical devices or virtual devices serving as computing nodes within the site.

[0078] After the above-mentioned user-mode file system is implemented on the computing node based on the storage resources carried by the computing node, the computing node can cache files related to the computing task in the user-mode file system in advance before starting to execute the computing task.

[0079] In one embodiment, a user-mode file system implemented on a compute node can serve as a cache layer, interfacing with a storage system used to store files associated with computing tasks. This storage system can pre-establish an RDMA connection with the user-mode file system as a high-speed data transmission channel. Before executing a computing task, the compute node can synchronize the files associated with the computing task from the storage system to the user-mode file system over this established RDMA connection for caching.

[0080] It should be noted that the specific implementation process of pre-establishing an RDMA connection between the storage system and the user-mode file system will not be detailed in this specification. Those skilled in the art are referred to relevant technical documents for reference. Of course, in addition to pre-establishing an RDMA connection as a high-speed data transmission channel between the storage system and the user-mode file system, in actual applications, other forms of connections supporting high-speed data transmission can also be established as data transmission channels, which will not be listed in this specification.

[0081] In one embodiment, to improve file access efficiency, the files stored in the user-mode file system may be file blocks composed of multiple small files. That is, in practical applications, the small files stored in the user-mode file system may be aggregated into file blocks, which are then stored and maintained as the smallest storage unit.

[0082] For example, in actual applications, the above-mentioned user-mode file system can specifically define a universal file block format with a fixed size. After synchronizing the files related to the computing task from the above-mentioned storage system, the synchronized small files can be encapsulated into file blocks with a fixed size according to the above-mentioned file block format, and then these files can be stored and maintained in the form of this universal file block.

[0083] It should be noted that, in actual applications, the storage system to which the user-mode file system is connected may also be a distributed storage system.

[0084] For example, still taking the example of executing the above-mentioned computing tasks through a large-scale distributed computing cluster, in actual applications, the computing cluster can further include several sites distributed in different regions, and each site can include several physical devices or virtual devices serving as computing nodes. In this case, the above-mentioned storage system can be a distributed storage system implemented based on the storage resources carried by each site.

[0085] In this specification, when a computing node begins executing a computing task, if the first user-mode process corresponding to the computing task needs to access the user-mode file system, it can typically initiate access to the user-mode file system through the computing node's system kernel as a relay. However, in this specification, the access link of the first user-mode process to the user-mode file system can be optimized, allowing the first user-mode process to directly access the user-mode file system in user mode.

[0086] See Figure 3 , Figure 3 This is an interactive diagram of a computing node accessing a user-mode file system in user mode, as shown in this specification.

[0087] like Figure 3 As shown, a first process adapter can be implemented in a first user-mode process corresponding to a computing task, and a second process adapter can be implemented in a second user-mode process corresponding to a user-mode file system.

[0088] Specifically, the first process adapter can be used to intercept access requests to the user-mode file system triggered by the first user-mode process during operation, and transmit the intercepted access requests to the second process adapter in user mode. The second process adapter can be used to intercept access results generated by the second user-mode process performing access processing on the user-mode file system, and transmit the access results to the first process adapter in user mode.

[0089] It should be noted that, in actual applications, the process adapter can be implemented in the user-mode process by loading a shared library for the user-mode process and expanding the functionality of the user-mode process without modifying the execution code contained in the original user-mode process.

[0090] For example, Figure 3 The operating system used by the computing node is the Linux system as an example. In this case, the above process adapter can be an adapter adapter created in the user mode process based on the LD_PRELOAD mechanism supported by the Linux system.

[0091] Among them, the LD_PRELOAD mechanism supported by the Linux system is a mechanism that expands the functionality of the user-mode process by loading shared libraries for the user-mode process without modifying the execution code contained in the original user-mode process. The specific implementation process of creating an Adaptor adapter in the user-mode process based on the LD_PRELOAD mechanism will not be described in detail in this manual. Those skilled in the art can refer to the records in the relevant technology.

[0092] Please continue to see Figure 3 When the computing node starts to execute the computing task, the first user state process is running, and the first process adapter can intercept the access request for the user state file system triggered by the first user state process during the running process.

[0093] Among them, when the first process adapter intercepts the access request for the user-mode file system triggered by the first user-mode process during operation, it can be achieved by replacing the system function in the system kernel originally called by the first process adapter with a user-mode function.

[0094] For example, in one embodiment shown, the execution code running by the first user-mode process may generally include a first function for initiating a system call to the system kernel to access the user-mode file system; and in order to allow the first user-mode process to initiate access to the user-mode file system without going through the system kernel, the first process adapter may include an implementation of a second function for accessing the user-mode file system in user mode.

[0095] In this case, when the first user-state process is running, when the first process adapter monitors that the first user-state process has initiated a call to the above-mentioned first function during the running process, the above-mentioned first function can be replaced with the above-mentioned second function in response to the call to the first function by the first user-state process during the running process, so that the first user-state process can further initiate a call to the second function, and submit the access request to the user-state file system triggered during the running process as a call parameter to the first process adapter, thereby completing the interception of the first user-state process's access request to the user-state file system.

[0096] It should be noted that the access request of the first user-mode process to the user-mode file system can specifically be a read request for the target file stored in the user-mode file system, or a write request to write the target file to the user-mode file system, which is not specifically limited in this specification.

[0097] For example, when the first user-mode process's access request to the user-mode file system is a read request for a target file stored in the user-mode file system, the first function may be a kernel-mode read function, and the second function may be a user-mode read function implemented in the first process adapter. When the first user-mode process's access request to the user-mode file system is a write request to write a target file to the user-mode file system, the first function may be a kernel-mode write function, and the second function may be a user-mode write function implemented in the first process adapter.

[0098] Step 104: In response to the intercepted access request, the first process adapter transmits the access request to the second process adapter in user mode. The second process adapter further submits the access request to the second user mode process, so that the second user mode process executes the access request to access the user mode file system.

[0099] Please continue to see Figure 3 After intercepting the access request of the first user-mode process to the user-mode file system, the first process adapter can further transmit the access request to the second process adapter in the user mode.

[0100] For example, in one embodiment shown, after the first process adapter intercepts the first user-mode process's access request to the user-mode file system by replacing the first function with the second function, it can continue to execute the second function in the user mode and transmit the access request to the second process adapter in the user mode.

[0101] It should be noted that the specific transmission method adopted by the first process adapter to transmit the access request to the second process adapter in the user mode is not particularly limited in this specification.

[0102] For example, in one embodiment shown, the first process adapter and the second process adapter may share memory in user mode. In this case, the first process adapter may transmit an access request to the second process adapter in user mode in a memory-sharing manner.

[0103] Of course, in addition to using shared memory to transmit information in user mode, the first process adapter and the second process adapter can also use other methods to transmit information in user mode in actual applications, such as message queues, sockets, etc.

[0104] Please continue to see Figure 3 After obtaining the above access request transmitted by the first process adapter in the user state, the second process adapter can further submit the access request to the second user state process; for example, the access request can be submitted to the second user state process in a cross-thread manner within the process.

[0105] After receiving the access request, the second user state process may continue to execute the access request and perform access processing on the user state file system.

[0106] For example, in one example, when the access request is a read request for a target file stored in the user-mode file system, the second user-mode process can continue to execute the read request and read the target file from the target-mode file system. In this case, the access result generated by the second user-mode process accessing the user-mode file system is the target file read from the user-mode file system.

[0107] In another example, when the access request is a write request to write a target file to the user-mode file system, the second user-mode process can continue to execute the write request and write the target file to the target-mode file system. In this case, the access result generated by the second user-mode process accessing the user-mode file system is the write result of writing the target file to the user-mode file system.

[0108] It should be noted that the specific type of the file that the first user-mode process needs to write to the user-mode file system generally depends on the type of the above-mentioned computing task.

[0109] For example, if the above-mentioned computing task is a training task for model training of the LLM model, the file that the first user-state process needs to write to the user-state file system can specifically be a model snapshot generated at a specific time point during the model training of the LLM model. Model snapshots are usually used to describe the model state of the LLM model at a specific time point, also known as checkpoints. The model snapshots can usually include model parameters learned during the training process. If the above-mentioned computing task is an inference task for logical reasoning based on the LLM model, the file that the first user-state process needs to write to the user-state file system can specifically be an inference result generated by logical reasoning based on the LLM model.

[0110] Step 106: The second process adapter intercepts the access result generated by the second user-state process accessing the user-state file system, and transmits the access result to the first process adapter in the user state. The first process adapter further submits the access result to the first user-state program, so that the first user-state program completes the computing task based on the access result.

[0111] Please continue to see Figure 3 During the process in which the second user-state process performs access processing on the user-state file system, the second process adapter can intercept the access result generated by the second user-state process performing access processing on the user-state file system.

[0112] Among them, when the second process adapter intercepts the access result generated by the second user-mode process accessing the user-mode file system, it can also be achieved by replacing the system function in the system kernel originally called by the second process adapter with a user-mode function.

[0113] In one embodiment shown, the executable code running in the second user-mode process may typically include a third function for initiating a system call to the system kernel to return the access result of the user-mode file system to the first user-mode process. To allow the first user-mode process to return the access result to the first user-mode process without going through the system kernel, the second process adapter may include a fourth function implemented in user mode to return the access result of the user-mode file system to the first user-mode process. For example, the third function may be a kernel-mode callback function, and the fourth function may be a user-mode callback function implemented in the second process adapter.

[0114] In this case, when the second user-state process is performing access processing on the user-state file system, when the second process adapter monitors that the second user-state process has initiated a call to the above-mentioned third function during its operation, it can replace the above-mentioned third function with the above-mentioned fourth function in response to the call to the third function by the second user-state process during its operation, so that the second user-state process can further initiate a call to the fourth function, and submit the access result generated in the process of access processing on the user-state file system as a call parameter to the second process adapter, thereby completing the interception of the access result generated by the second user-state process's access processing on the user-state file system.

[0115] Please continue to see Figure 3 After intercepting the access result generated by the second user-mode process performing access processing on the user-mode file system, the second process adapter can further transmit the access request to the second process adapter in the user mode.

[0116] In one embodiment shown, after the second process adapter intercepts the access result generated by the second user-state process accessing the user-state file system by replacing the above-mentioned third function with the fourth function, it can continue to execute the fourth function in the user state and transmit the access result to the second process adapter in the user state.

[0117] It should be noted that the specific transmission method adopted by the first process adapter to transmit the access request to the second process adapter in the user mode is not particularly limited in this specification.

[0118] For example, in one embodiment shown, the second process adapter may also transmit the access result to the first process adapter in a user state in a memory-sharing manner.

[0119] Please continue to see Figure 3 After obtaining the access result transmitted by the second process adapter in the user state, the first process adapter can further submit the access result to the first user state process; for example, the access result can still be submitted to the first user state process in a cross-thread manner within the process.

[0120] After receiving the access result, the first user state process can continue to complete the computing task based on the access result.

[0121] For example, in one example, when the access request is a read request for a target file stored in a user-mode file system, the second user-mode process accesses the user-mode file system and generates an access result that is the target file read from the user-mode file system. In this case, after receiving the target file, the first user-mode process can continue to execute the computing task based on the target file.

[0122] In another example, when the access request is a write request to write a target file into the user-mode file system, the access result generated by the second user-mode process accessing the user-mode file system is a write result of writing the target file into the user-mode file system.

[0123] In this case, after receiving the write result, the first user-mode process indicates that the computing task may have been completed. In this case, the result indicating that the computing task has been completed can be directly returned.

[0124] In the above technical solution, by implementing process adapters on the user-state process corresponding to the computing task and the user-state process corresponding to the user-state file system mounted on the system kernel, when the user-state process corresponding to the computing task accesses the user-state file system, the access interaction for the user-state file system can be completed in the user state through the implemented process adapter, without the need to initiate a call to the system kernel. This can optimize the access link to the user-state file system, significantly reduce the number of calls to the system kernel, reduce system overhead, and thus improve the access performance when accessing the user-state file system.

[0125] For example, taking the Linux operating system as an example, assuming that the default size of a single request that can be processed by the Linux kernel is 128K, and the access request is a read request for a 128MB file stored in the user-mode file system, then according to Figure 1 The link shown for accessing the user-mode file system through the system kernel shows that, after being transmitted to the Linux system kernel, the read request may need to be split into 1024 sub-read requests within the kernel. If all 1024 read requests pass through the system kernel, undergo multiple processing and transfers in kernel mode before being delivered to the user-mode file system in user mode, this would obviously incur significant system overhead.

[0126] If you follow Figure 3As shown in the optimized access link, the read request only needs to be transmitted to the user-mode file system in user mode through shared memory once in user mode, without passing through the system kernel. The read request is also not at risk of being split. Obviously, the number of calls to the system kernel can be significantly reduced, reducing system overhead, thereby improving access performance when accessing the user-mode file system.

[0127] Corresponding to the embodiments of the aforementioned method, this specification also provides embodiments of an apparatus, an electronic device, and a storage medium.

[0128] Figure 4 This is a schematic structural diagram of an electronic device provided by an exemplary embodiment. Figure 4 At the hardware level, the device includes a processor 402, an internal bus 404, a network interface 406, a memory 408, and a non-volatile memory 410, and may also include other required hardware. One or more embodiments of this specification can be implemented based on software, such as the processor 402 reading the corresponding computer program from the non-volatile memory 410 into the memory 408 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0129] like Figure 5 As shown, Figure 5 This is a block diagram of a file access device according to an exemplary embodiment of the present specification. The device can be applied to Figure 4 The electronic device shown in the figure implements the technical solution of this specification. The device can be applied to a computing node that performs a computing task, wherein a user-mode file system running in user mode is mounted on the system kernel of the computing node; the user-mode file system is used to store files related to the computing task; a first process adapter is implemented in a first user-mode process corresponding to the computing task; a second process adapter is implemented in a second user-mode process corresponding to the user-mode file system; the device 500 includes:

[0130] A first interception module 501, the first process adapter intercepts an access request for the user-mode file system triggered by the first user-mode process during operation;

[0131] The first transmission module 502 transmits the access request to the second process adapter in user mode in response to the intercepted access request. The second process adapter further submits the access request to the second user mode process, so that the second user mode process executes the access request and accesses the user mode file system.

[0132] A second interception module 503, the second process adapter intercepts an access result generated by the second user-mode process performing access processing on the user-mode file system;

[0133] The second transmission module 504, the second process adapter transmits the access result to the first process adapter in the user state, and the first process adapter further submits the access result to the first user state program, so that the first user state program completes the computing task based on the access result.

[0134] Accordingly, this specification also provides an electronic device, which includes a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the steps in all the method flows described above.

[0135] Accordingly, this specification also provides a computer-readable storage medium on which executable computer program instructions are stored; wherein, when the instructions are executed by a processor, the steps in all the method flows described above are implemented.

[0136] Accordingly, this specification also provides a computer program product having executable computer program instructions stored thereon; wherein, when the computer program instructions are executed by a processor, the steps in all the method flows described above are implemented.

[0137] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using physical hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly performed using software called a "logic compiler." This is similar to the software compilers used during program development. Before compilation, the original code must be written in a specific programming language, called a Hardware Description Language (HDL). There are many types of HDL, including ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that simply by programming a method flow in one of these hardware description languages ​​and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.

[0138] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C2051F320. The memory controller can also be implemented as part of the memory control logic. Those skilled in the art will also appreciate that, in addition to implementing the controller purely in computer-readable program code, the controller can also be implemented in the form of logic gates, switches, an application-specific integrated circuit, a programmable logic controller, an embedded microcontroller, etc. by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the means for implementing the various functions included therein can also be considered as structures within the hardware component. Alternatively, the means for implementing the various functions can be considered both a software module implementing the method and a structure within the hardware component.

[0139] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a server system. Of course, it is not excluded that with the future development of computer technology, the computer implementing the functions of the above embodiments may be, for example, a personal computer, a laptop computer, an in-vehicle human-computer interaction device, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0140] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-inventive means. The order of steps listed in the embodiments is only one way of executing the steps among many, and does not represent the only execution order. When a device or terminal product is actually executed, the methods shown in the embodiments or figures may be executed sequentially or in parallel (for example, in a parallel processor or multi-threaded processing environment, or even a distributed data processing environment). The terms "comprise," "include," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, product, or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, product, or device. Without further limitation, it does not exclude that the process, method, product, or device that includes the elements may also have other identical or equivalent elements. For example, if words such as first and second are used to indicate names, they do not indicate any particular order.

[0141] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more of the present specifications, the functions of each module can be implemented in the same or multiple software and / or hardware, or the module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0142] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts 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, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0143] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0144] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0145] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0146] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0147] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0148] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as methods, systems, or computer program products. Thus, one or more embodiments of this specification may take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.

[0149] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In distributed computing environments, program modules may be located in local and remote computer storage media, including storage devices.

[0150] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referenced across them. Each embodiment focuses on the differences from the other embodiments. In particular, since the system embodiments are generally similar to the method embodiments, their description is relatively simple. For relevant parts, reference can be made to the description of the method embodiments. Throughout this specification, reference to the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and integrate the different embodiments or examples, and features of different embodiments or examples, described in this specification, without conflict.

[0151] The foregoing is merely an example of one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. It will be apparent to those skilled in the art that various modifications and variations may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification shall be included within the scope of the claims.

Claims

1. A file access method, applied to a computing node executing a computing task, wherein a user-mode file system running in user mode is mounted on a system kernel of the computing node; the user-mode file system is used to store files related to the computing task; A first process adapter is implemented in a first user-mode process corresponding to the computing task; a second process adapter is implemented in a second user-mode process corresponding to the user-mode file system; the process adapter is implemented in the user-mode process by loading a shared library into the user-mode process to extend the functionality of the user-mode process without modifying the execution code contained in the original user-mode process; The method comprises: The first process adapter intercepts an access request for the user-mode file system triggered by the first user-mode process during operation; In response to the intercepted access request, the first process adapter transmits the access request to the second process adapter in user mode, and the second process adapter further submits the access request to the second user mode process, so that the second user mode process executes the access request to access the user mode file system; The second process adapter intercepts the access result generated by the second user-state process in accessing the user-state file system, and transmits the access result to the first process adapter in the user state. The first process adapter further submits the access result to the first user-state process so that the first user-state process completes the computing task based on the access result.

2. The method according to claim 1, wherein the executable code executed by the first user-mode process includes a first function for initiating a system call to the system kernel to access the user-mode file system; and correspondingly, the first process adapter includes a second function for accessing the user-mode file system in the user mode; The first process adapter intercepts an access request for the user-mode file system triggered by the first user-mode process during operation, including: In response to a call to the first function by the first user-mode process during execution, replacing the first function with the second function, so that the first user-mode process further initiates a call to the second function, and submits an access request for the user-mode file system triggered during execution as a call parameter to the first process adapter; The first process adapter program transmits the access request to the second process adapter program in a user state, including: The first process adapter executes the second function and transmits the access request to the second process adapter in user mode.

3. The method of claim 1 , wherein the executable code executed by the second user-mode process includes a third function for initiating a system call to the system kernel to return an access result to the user-mode file system to the first user-mode process; and correspondingly, the second process adapter includes a fourth function for returning the access result to the user-mode file system to the first user-mode process in user mode. The second process adapter intercepts an access result generated by the second user-mode process performing access processing on the user-mode file system, including: In response to the second user-mode process calling the third function during execution, replacing the third function called by the second user-mode process with the fourth function, so that the second user-mode process further initiates a call to the fourth function, and submits an access result generated by performing access processing on the user-mode file system as a call parameter to the second process adapter; The second process adapter program transmits the access result to the first process adapter program in a user state, including: The second process adapter program executes the fourth function and transmits the access result to the first process adapter program in user mode.

4. The method according to claim 1, wherein the first process adapter transmits the access request to the second process adapter in user mode, comprising: The first process adapter transmits the access request to the second process adapter in a user state in a memory sharing manner; The second process adapter program transmits the access result to the first process adapter program in a user state, including: The second process adapter transmits the access result to the first process adapter in a user state in a memory sharing manner.

5. The method according to claim 1, wherein the access request comprises a read request for a target file stored in the user-mode file system; and correspondingly, the access result comprises the target file read from the user-mode file system; or The access request includes a write request to write a target file into the user-mode file system; correspondingly, the access result includes a write result of writing the target file into the user-mode file system.

6. The method according to claim 1, wherein the file stored in the user-mode file system is a file block composed of a plurality of files.

7. The method according to claim 1, wherein the user-mode file system is connected to a storage system for storing files related to the computing task; An RDMA connection is established between the user-mode file system and the storage system; The method further comprises: Before the computing node executes the computing task, files related to the computing task are synchronized from the storage system to the user-mode file system for storage based on the RDMA connection.

8. The method according to claim 1, wherein the operating system used by the computing node is a Linux system; and the process adapter is an adapter implemented in a user-mode process based on the LD_PRELOAD mechanism supported by the Linux system.

9. The method according to claim 1, wherein the user-state file system is a user-state file system created based on the libfuse library provided by the Linux system; and the user-state file system is mounted to the Linux system through the Fuse kernel module of the Linux system.

10. The method according to claim 1, wherein the computing task is a training task for training an LLM model; or a reasoning task for performing logical reasoning based on an LLM model.

11. The method according to claim 1, wherein the user-mode file system is a file system implemented based on a flash storage device mounted on the computing node.

12. The method according to claim 11, wherein the user-mode file system is a distributed file system implemented based on a flash storage device mounted on each computing node in a computing node cluster that jointly executes the computing task.

13. A file access device, applied to a computing node that performs a computing task, wherein a user-mode file system running in user mode is mounted on a system kernel of the computing node; the user-mode file system is used to store files related to the computing task; A first process adapter is implemented in a first user-state process corresponding to the computing task; a second process adapter is implemented in a second user-state process corresponding to the user-state file system; the process adapter is implemented in the user-state process by loading a shared library for the user-state process and extending the functionality of the user-state process without modifying the execution code contained in the original user-state process; the device includes: a first interception module, configured for the first process adapter to intercept access requests for the user-mode file system triggered by the first user-mode process during operation; a first transmission module, in response to the intercepted access request, transmitting the access request from the first process adapter to the second process adapter in user mode, and having the second process adapter further submit the access request to the second user mode process, so that the second user mode process executes the access request and performs access processing on the user mode file system; a second interception module, wherein the second process adapter intercepts an access result generated by the second user-mode process performing access processing on the user-mode file system; The second transmission module, the second process adapter transmits the access result to the first process adapter in the user state, and the first process adapter further submits the access result to the first user state process, so that the first user state process completes the computing task based on the access result.

14. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.

15. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.

16. A computer program product comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Data processing method and device

    CN110275782A

  • User mode file system performance optimization method based on system call interception technology

    CN118502846A