WO2023173954A1 - 数据获取方法、装置、存储介质以及电子设备 - Google Patents

数据获取方法、装置、存储介质以及电子设备 Download PDF

Info

Publication number
WO2023173954A1
WO2023173954A1 PCT/CN2023/074457 CN2023074457W WO2023173954A1 WO 2023173954 A1 WO2023173954 A1 WO 2023173954A1 CN 2023074457 W CN2023074457 W CN 2023074457W WO 2023173954 A1 WO2023173954 A1 WO 2023173954A1
Authority
WO
WIPO (PCT)
Prior art keywords
function
terminal
call request
data
gpu
Prior art date
Application number
PCT/CN2023/074457
Other languages
English (en)
French (fr)
Inventor
齐思凯
张宗强
白云
刘哲瑞
王剑
Original Assignee
北京有竹居网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京有竹居网络技术有限公司 filed Critical 北京有竹居网络技术有限公司
Publication of WO2023173954A1 publication Critical patent/WO2023173954A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system

Definitions

  • the present disclosure relates to the field of computer technology, and specifically, to a data acquisition method, device, storage medium and electronic equipment.
  • GPU graphics processing unit, graphics processor
  • the present disclosure provides a data acquisition method, applied to a first terminal, the method includes:
  • the first call request is processed through the first function to obtain a second call request, and the second call request is sent to the second terminal through the first function, so that the second terminal can
  • the second call request calls the second function in the native function library of the physical GPU, and calls the physical GPU installed by itself according to the second function.
  • the GPU performs processing to obtain the target data corresponding to the second call request, and the first function is a function with the same name as the second function in the function library of the first terminal;
  • the present disclosure provides a data acquisition device, applied to a first terminal, and the device includes:
  • a first call request acquisition module configured to obtain a first call request to call the virtual GPU installed on the first terminal itself, where the first call request carries an identifier corresponding to the first function
  • a second call request generation module is configured to process the first call request through the first function, obtain a second call request, and send the second call request to the second terminal through the first function. , so that the second terminal calls the second function in the native function library of the physical GPU according to the second calling request, and calls the physical GPU installed by itself according to the second function to process, and obtains the second Call the target data corresponding to the request, and the first function is a function with the same name as the second function in the function library of the first terminal;
  • a target data receiving module configured to receive the target data returned by the second terminal.
  • the present disclosure provides a computer-readable storage medium on which a computer program is stored, which implements the steps of the method described in the first aspect when executed by a processing device.
  • an electronic device including:
  • a storage device having at least one computer program stored thereon;
  • At least one processing device configured to execute the at least one computer program in the storage device to implement the steps of the method described in the first aspect.
  • the present disclosure provides a computer program product.
  • the computer program product includes computer-executable instructions.
  • a processor executes the computer-executable instructions, the steps of the method described in the first aspect are implemented.
  • the present disclosure provides a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.
  • Figure 1 is a schematic diagram of an application environment provided according to an exemplary embodiment
  • Figure 2 is a schematic flowchart of a data acquisition method according to an exemplary embodiment
  • Figure 3 is a schematic diagram of another application environment provided according to an exemplary embodiment
  • Figure 4 is a schematic diagram of module connections of a data acquisition device according to an exemplary embodiment
  • FIG. 5 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
  • the term “include” and its variations are open-ended, ie, “including but not limited to.”
  • the term “based on” means “based at least in part on.”
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; and the term “some embodiments” means “at least some embodiments”. Relevant definitions of other terms will be given in the description below.
  • GPU tasks can include development, debugging, and running GPU programs, etc., and when executing GPU tasks, the GPU is called for processing.
  • tf needs to explicitly call the tf.config.experimental_connect_to_cluster method.
  • Torch usually needs to be compiled with xla, and some code needs to be added to the original code that can run on a single machine. For example, xm.mark_step(), etc.
  • embodiments of the present disclosure provide a data acquisition method, device, storage medium, and electronic equipment.
  • the first terminal without a physical GPU When the first terminal without a physical GPU is installed obtains the first call request, the first call request is processed to obtain the second call request, and then the second call request is processed through the physical GPU of the remote second terminal. and returns the processed target data to the first terminal, realizing the function of completing the GPU task even if the first terminal does not have a GPU.
  • the first function in the function library of the terminal has the same name as the second function in the native function library of the physical GPU, so that when programming the GPU task, the user can follow the same programming habits as the physical GPU in the first terminal and avoid users Modifying the code when writing GPU tasks makes the user program more transparent and reduces the possibility of user programming errors.
  • FIG. 1 is a schematic diagram of an application environment provided by an embodiment of the present disclosure. It includes a first terminal and a second terminal, wherein the first terminal and the second terminal are connected through a network.
  • the first terminal can send the local GPU program's call request to the virtual GPU to the second terminal through the first function in the virtual function library, so that the second terminal calls the native function library of its own physical GPU with the same name as the first function.
  • the second function and calls the physical GPU installed on itself for processing according to the second function, thereby supporting users to develop, debug and run GPU programs on machines without GPU devices, and the entire process is transparent to the user program, just like the GPU device is Same as local in first terminal.
  • Figure 2 is a schematic flowchart of a data acquisition method according to an exemplary embodiment.
  • the data acquisition method provided by the embodiment of the present disclosure can be executed through the first terminal shown in Figure 1. Specifically, it can be executed through a data acquisition device.
  • the device can be implemented in the form of software and/or hardware and is configured on the first terminal shown in Figure 1. in the first terminal. Please refer to Figure 2.
  • the data acquisition method provided by the embodiment of the present disclosure may include the following steps:
  • S210 Obtain a first call request for calling the virtual GPU installed on the first terminal itself.
  • the first call request carries an identifier corresponding to the first function.
  • the virtual GPU can be understood as a GPU that is virtualized locally on the first terminal. Unlike a real physical GPU, the virtual GPU cannot perform calculations.
  • a driving device can be created and mounted on the /dev/remotegpu path.
  • the driving device can be a Linux driving device.
  • This driver device can create remote physical GPU configuration information in the proc file system, such as /proc/driver/bytedance/remotegpu0, /proc/driver/bytedance/remotegpu1.
  • Each file stores information about the remote real physical GPU.
  • the virtual GPU device points to the remote second terminal with the IP address 192.0.0.1 and the UUID GPU device GPU-5a0622d3-66c6-4f39-30fd-d31ab6401071. This process completes the creation of the virtual GPU. Subsequently, the first terminal can access the second terminal through Ethernet.
  • the first calling request carries the identifier corresponding to the first function.
  • the first calling request may be initiated by any GPU program of the first terminal.
  • it may be a certain game or drawing software that requires calling the GPU for processing.
  • S220 process the first calling request through the first function to obtain the second calling request, and send the second calling request to the second terminal through the first function, so that the second terminal calls the physical GPU according to the second calling request.
  • the second function in the native function library of the first terminal is called, and the physical GPU installed on itself is called for processing according to the second function, and the target data corresponding to the second call request is obtained.
  • the first function is the same name as the second function in the function library of the first terminal. The function.
  • the first terminal after obtaining the first call request, can parse the first call request to obtain the identifier corresponding to the first function included in it, and then can call the corresponding first function according to the identifier. Processing, because the GPU of the first terminal is a virtual GPU and cannot perform calculations, therefore, the first function does not call the virtual GPU to calculate the first call request, but re-encapsulates the first call request to obtain the second call request. Second call request, and send the second call request to the second terminal.
  • the function performed by the first function mainly includes two parts.
  • the functions of these two parts can be completed by corresponding sub-functions, for example, the first sub-function and the second sub-function, where the first sub-function
  • the function of re-encapsulating the first call request is completed to obtain the second call request, and the second sub-function completes the function of sending the second call request to the second terminal.
  • the second terminal After sending the second call request to the second terminal, the second terminal can call the second function with the same name as the first function in the native function library of the physical GPU according to the second call request, and call its own installed function according to the second function.
  • the physical GPU performs processing and obtains the target data corresponding to the second call request.
  • the native function library of the physical GPU may include a native cuda function library and a native nvidia function library.
  • the function library where the first function is located may be a custom cuda function library and a custom nvidia function library. , after calling the custom cuda function library and the custom nvidia function library, there will be no direct operation Physical GPU performs calculations.
  • the second terminal calls the physical GPU installed on itself to process the second call request. After obtaining the target data, it can return the target data to the first terminal, so that the first terminal can receive the second call request. Target data returned by the terminal.
  • the first terminal may return the target data to the corresponding upper-layer application.
  • the first terminal that does not have a physical GPU installed when it obtains the first call request, it can process the first call request to obtain the second call request, and then process the second call request through the physical GPU of the remote second terminal.
  • the call request is processed and the processed target data is returned to the first terminal, realizing the function of completing the GPU task even if the first terminal does not have a GPU.
  • a virtual GPU is installed on the first terminal, and The first function in the function library of the first terminal corresponding to the virtual GPU has the same name as the second function in the native function library of the physical GPU, so that when users program GPU tasks, they can program as if there is a physical GPU in the first terminal. Get used to programming to avoid users from modifying the code when writing GPU tasks, making the user program more transparent and reducing the possibility of user programming errors.
  • the physical GPU corresponds to a video memory address in the second terminal.
  • the virtual GPU can also correspond to a video memory address in the first terminal, where , the display memory address of the virtual GPU in the first terminal may be virtual.
  • the first call request and the second call request are both calculation sub-requests that call the GPU for calculation.
  • the second call request may specifically include For a calculation sub-request that calls the physical GPU for calculation, in this case, the first call request is processed through the first function to obtain the second call request, which includes the following steps:
  • the identification corresponding to the first function, the configuration information of the physical GPU, the calculation parameters and the target video memory address are obtained through the first function; through the first function Based on the identifier corresponding to the first function, the configuration information of the physical GPU, the calculation parameters, and the target video memory address, a calculation subrequest is generated.
  • the configuration information of the virtual GPU indicates It refers to the configuration information of the real physical GPU. Therefore, the configuration information of the virtual GPU is the same as the configuration information of the physical GPU.
  • the video memory address in the first terminal and the video memory address in the second terminal may not correspond. , therefore, when generating the second call request, it is also necessary to obtain the actual corresponding video memory address when the physical GPU in the second terminal performs calculations, that is, the target video memory address.
  • the identifier corresponding to the first function, the configuration information of the physical GPU, the calculation parameters, and the target video memory address can be obtained first through the first function, and then the identifier corresponding to the first function is obtained through the first function.
  • the physical GPU configuration information, calculation parameters, and target memory address are used to generate calculation subrequests.
  • the first function may be the cuLaunchKernel function.
  • obtaining the target video memory address may include the following steps:
  • the first call request in the first terminal, can be parsed through the first function, thereby obtaining the identification corresponding to the first function, the configuration information of the physical GPU, the calculation parameters, and the first terminal used by the virtual GPU.
  • the original video memory address of The target video memory address in the second terminal corresponding to the video memory address.
  • the first terminal after the first terminal obtains the first call request, it can also directly forward the first call request to the second terminal through the first function, and the second terminal parses the first call request.
  • the second terminal parses the first call request.
  • the mapping relationship between the above-mentioned display memory address in the first terminal and the display memory address in the second terminal can also be stored in the second terminal.
  • both the first call request and the second call request are change sub-requests for calling the GPU to make changes to the video memory.
  • the second call request may specifically include changes for calling the physical GPU to make changes to the video memory.
  • the target data includes the first changed video memory address after the physical GPU changes the video memory.
  • the data acquisition method in the embodiment of the present disclosure also includes the following steps:
  • the physical GPU corresponds to the video memory address in the second terminal
  • the virtual GPU corresponds to the video memory address in the first terminal.
  • the virtual GPU can also call the first terminal.
  • the first changed video memory address and the changed second changed video memory address can be Correspond to the addresses to update the mapping relationship.
  • the change sub-request for changing the video memory may include a video memory application sub-request and a video memory release sub-request.
  • the first function may be the cuMemAlloc function.
  • the function library where the first function is located is not the native function library of the physical GPU, it cannot be directly installed and deployed in the deployment location of the native function library of the physical GPU. For example, it cannot be directly deployed in /usr/lib/x86_64- linux-gnu/libnvidia-ml.so.1 path or /usr/lib/x86_64-linux-gnu/libcuda.so.1 path.
  • the data acquisition method of the embodiment of the present disclosure may also include the following steps:
  • a soft link also called a symbolic link, can be thought of as an alias for a file that contains the pathname of another file. It can be any file or directory, and can link files from different file systems. Soft links allow us to use the same file in different directories. We don’t need to put a file that must be the same in every required directory. We only need to put the file in a fixed directory, and then put it in other directories. Just link to it in the directory.
  • the first terminal and the second terminal can communicate through a remote call protocol.
  • a remote call server can be deployed on the second terminal, and a remote call client (i.e., the first terminal) can be deployed on the first terminal. function), so that the client and server can communicate through the remote call protocol.
  • the second calling request can be sent to the second terminal based on the remote calling protocol through the first function, and the second calling request can be received through the remote calling protocol.
  • Target data returned by the terminal can be sent to the second terminal based on the remote calling protocol through the first function, and the second calling request can be received through the remote calling protocol.
  • sending the second call request to the second terminal through the first function may include the following steps:
  • receiving the target data returned by the second terminal may include the following steps:
  • rpc Remote Procedure Call Protocol
  • RDMA Remote Direct Memory Access
  • the control transmission data packet corresponding to the second call request can be sent to the second terminal based on the remote call protocol, and when the second call request When the data transmission packet is included, the data transmission packet corresponding to the second call request can be sent to the second terminal based on the remote direct data access network.
  • the target data includes the control transmission data packet
  • the target data can be received through the remote call protocol.
  • the data transmission data packet corresponding to the target data can be received through the remote direct data access network.
  • the first function includes the MPI_Send function and the MPI_Recv function.
  • the data transmission packet corresponding to the second call request is sent to the second terminal through the first function based on the remote direct data access network. , including: calling the MPI_Send function to send the data transmission packet corresponding to the second call request to the second terminal based on the remote direct data access network.
  • Receive the data transmission packet corresponding to the target data through the remote direct data access network including: calling the MPI_Recv function to copy the data transmission packet corresponding to the target data through the remote direct data access network
  • the MPI_Send function can be called to send the data transmission packet to the second terminal through the remote direct data access network. , to achieve network acceleration when the first terminal sends data to the second terminal.
  • the MPI_Recv function can be called to copy the data transmission packet from the second terminal through the remote direct data access network, for example, copying the GPU from the second terminal video memory data to achieve network acceleration when the first terminal copies data from the second terminal.
  • FIG. 3 is a schematic diagram of another application environment involved in an embodiment of the present disclosure. It includes a first terminal and a second terminal. Among them, the first terminal and the second terminal can be connected through the rpc protocol and the RDMA network.
  • the first terminal can send the local control transmission data packet to the rpc server of the second terminal based on the rpc protocol through the first function in the virtual function library. , and receive control transmission data packets from the rpc server through the rpc protocol.
  • You can also use the first function in the virtual function library to send local data transmission data packets to the second terminal based on the RDMA network, and from the second terminal through the RDMA network. Receive data transfer packets.
  • FIG 4 is a schematic diagram of module connections of a data acquisition device according to an exemplary embodiment. As shown in Figure 4, an embodiment of the present disclosure provides a data acquisition device, which is applied to the first terminal pole.
  • the device 400 may include:
  • the first call request acquisition module 410 is used to obtain the first call request to call the virtual GPU installed on the first terminal itself, where the first call request carries the identifier corresponding to the first function;
  • the second call request generation module 420 is configured to process the first call request through the first function to obtain a second call request, and send the second call request to the second call request through the first function.
  • Terminal so that the second terminal calls the second function in the native function library of the physical GPU according to the second calling request, and calls the physical GPU installed by itself according to the second function to process, and obtains the third 2.
  • Call the target data corresponding to the request, and the first function is a function with the same name as the second function in the function library of the first terminal;
  • the target data receiving module 430 is used to receive the target data returned by the second terminal.
  • the second call request generation module 420 includes:
  • Obtaining sub-module configured to obtain the identification corresponding to the first function and the identification number of the physical GPU through the first function when the second call request includes a calculation sub-request for calling the physical GPU for calculation.
  • a calculation sub-request generation sub-module configured to generate the calculation sub-request through the first function based on the identification corresponding to the first function, the configuration information of the physical GPU, the calculation parameters and the target video memory address.
  • the acquisition sub-module is also used to obtain the original video memory address of the first terminal used by the virtual GPU for calculation; based on the mapping relationship between the video memory address in the first terminal and the video memory address in the second terminal, Determine the target display memory address in the second terminal corresponding to the original display memory address.
  • the target data includes the first changed display memory after the physical GPU changes the display memory. address
  • the device 400 also includes:
  • a changed video memory address acquisition module used to obtain the second changed video memory address after the virtual GPU changes the video memory, and the first changed video memory address
  • a mapping relationship update module configured to update the mapping relationship based on the first changed display memory address and the second changed display memory address.
  • the device 400 also includes:
  • the actual installation location acquisition module is used to obtain the actual installation location of the function library of the first terminal;
  • a soft link module configured to soft link the actual installation location to a common installation location of the physical GPU's native function library on the first terminal.
  • the data packet type corresponding to the second call request includes a control transmission data packet and a data transmission data packet
  • the data packet type corresponding to the target data includes a control transmission data packet and a data transmission data packet.
  • the second call request Generate module 420 including:
  • a first sending submodule configured to send the control transmission data packet corresponding to the second call request to the second terminal based on the remote call protocol through the first function
  • the second sending submodule is configured to send the data transmission packet corresponding to the second call request to the second terminal based on the remote direct data access network through the first function.
  • the target data receiving module 430 includes:
  • the first receiving sub-module is used to receive the control transmission data packet corresponding to the target data through the remote call protocol;
  • the second receiving sub-module is used to receive the data transmission packet corresponding to the target data through the remote direct data access network.
  • the first function includes an MPI_Send function and an MPI_Recv function.
  • the second sending sub-module is also used to call the MPI_Send function to transmit the data corresponding to the second call request based on the remote direct data access network.
  • the data packet is sent to the second terminal.
  • the second receiving sub-module is also used to call the MPI_Recv function to copy the data transmission packet corresponding to the target data through the remote direct data access network.
  • Terminal devices in embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Android Devices), PMPs (Portable Multimedia Player, Portable Media Player), vehicle-mounted terminal (such as vehicle navigation Terminals) and the like, as well as fixed terminals such as digital TVs (Televisions), desktop computers, and the like.
  • the electronic device shown in FIG. 5 is only an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
  • the electronic device 500 may include a processing device (such as a central processing unit, a graphics processor, etc.) 501, which may process data according to a program stored in a read-only memory (Read Only Memory, ROM) 502 or from a storage device 508
  • a processing device such as a central processing unit, a graphics processor, etc.
  • the program loaded into the random access memory (Random Access Memory, RAM) 503 performs various appropriate actions and processing.
  • RAM 503 Random Access Memory
  • various programs and data required for the operation of the electronic device 500 are also stored.
  • the processing device 501, ROM 502 and RAM 503 are connected to each other via a bus 504.
  • An input/output (I/O) interface 505 is also connected to bus 504.
  • input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a Liquid Crystal Display (LCD) , an output device 507 such as a speaker, a vibrator, etc.; a storage device 508 including a magnetic tape, a hard disk, etc.; and a communication device 509.
  • Communication device 509 may allow electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data.
  • FIG. 5 illustrates electronic device 500 with various means, it should be understood that implementation or availability of all illustrated means is not required. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart.
  • the computer program may be downloaded and installed from the network via communication device 509, or from storage device 508, or from ROM 502.
  • the processing device 501 When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any combination thereof. More specific examples of computer readable storage media may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard drive, random access memory (RAM), read only memory (ROM), removable Programmd read-only memory (EPROM or flash memory), fiber optics, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device.
  • the computer-readable signal medium may be included in baseband or as part of a carrier wave.
  • a data signal transmitted separately, which carries computer-readable program code. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the above.
  • electronic devices can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can communicate with digital data in any form or medium (for example, communication network) interconnection.
  • HTTP HyperText Transfer Protocol
  • Examples of communication networks include Local Area Networks (LANs), Wide Area Networks (WANs), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any current network for knowledge or future research and development.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; it may also exist independently without being assembled into the electronic device.
  • the computer-readable medium carries one or more programs.
  • the electronic device obtains the current process priority of the hosting application; and transfers the host application corresponding to the hosting application to The process priority of the target process is adjusted to be consistent with the current process priority.
  • the target process is a process necessary for the host application to create a virtual operating environment for running the hosting application; wherein, the hosting application There is a dependency relationship between the process priority of the host application and the process priority of the target process, and the dependency relationship is used to cause the process priority of the target process to change following the change of the process priority of the hosting application.
  • Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as "C" or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as an Internet service provider). connected via the Internet).
  • LAN local area network
  • WAN wide area network
  • Internet service provider such as an Internet service provider
  • each box in the flowchart or block diagram may represent a module, segment, or portion of code that contains one or more Executable instructions used to implement specified logical functions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved.
  • each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration can be implemented by special purpose hardware-based systems that perform the specified functions or operations. , or can be implemented using a combination of specialized hardware and computer instructions.
  • the modules involved in the embodiments of the present disclosure can be implemented in software or hardware. Among them, the name of the module does not constitute a limitation on the module itself under certain circumstances.
  • exemplary types of hardware logic components include: field programmable gate array (Field Programmable Gate Array, FPGA), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), application specific standard product (Application Specific Standard Product (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), etc.
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with an instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, laptop disks, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM portable compact disk read-only memory
  • magnetic storage device or any suitable combination of the above.
  • Example 1 provides a data acquisition method, applied to a first terminal, and the method includes:
  • the first call request is processed through the first function to obtain a second call request, and the second call request is sent to the second terminal through the first function, so that the second terminal can
  • the second call request calls the second function in the native function library of the physical GPU, and calls the physical GPU installed by itself according to the second function to process, and obtains the target data corresponding to the second call request.
  • the first function is the first terminal's A function in the function library with the same name as the second function;
  • Example 2 provides the method of Example 1, wherein the first call request is processed by the first function to obtain a second call request, including:
  • the second call request includes a calculation sub-request for calling the physical GPU for calculation, the identification corresponding to the first function, the configuration information of the physical GPU, calculation parameters and Target memory address;
  • the calculation sub-request is generated by the first function based on the identifier corresponding to the first function, the configuration information of the physical GPU, the calculation parameters, and the target video memory address.
  • Example 3 provides the method of Example 2, obtaining the target video memory address, including:
  • a target display memory address in the second terminal corresponding to the original display memory address is determined.
  • Example 4 provides the method of Example 3.
  • the target The data includes the first changed video memory address after the physical GPU changes the video memory. After obtaining the target data, the method further includes:
  • the mapping relationship is updated based on the first changed video memory address and the second changed video memory address.
  • Example 5 provides the method of Example 1, the method further comprising:
  • Example 6 provides the method of any one of Examples 1-5.
  • the data packet type corresponding to the second call request includes a control transmission data packet and a data transmission data packet.
  • the target The data packet types corresponding to the data include control transmission data packets and data transmission data packets.
  • the second call request is sent to the second terminal through the first function, including:
  • the first function sends the control transmission data packet corresponding to the second call request based on the remote call protocol. sent to the second terminal;
  • the receiving the target data returned by the second terminal includes:
  • Example 7 provides the method of Example 6, the first function includes an MPI_Send function and an MPI_Recv function, and the first function uses the remote direct data access network to transfer the The data transmission packet corresponding to the second call request is sent to the second terminal, including:
  • the receiving the data transmission packet corresponding to the target data through the remote direct data access network includes:
  • the MPI_Recv function is called to copy the data transmission packet corresponding to the target data through the remote direct data access network.
  • Example 8 provides a data acquisition device, applied to a first terminal, and the device includes:
  • a first call request acquisition module configured to obtain a first call request to call the virtual GPU installed on the first terminal itself, where the first call request carries an identifier corresponding to the first function
  • a second call request generation module is configured to process the first call request through the first function, obtain a second call request, and send the second call request to the second terminal through the first function. , so that the second terminal calls the second function in the native function library of the physical GPU according to the second calling request, and calls the physical GPU installed by itself according to the second function to process, and obtains the second Call the target data corresponding to the request, and the first function is a function with the same name as the second function in the function library of the first terminal;
  • a target data receiving module configured to receive the target data returned by the second terminal.
  • Example 9 provides the apparatus of Example 8, where the second call request generation module includes:
  • Obtaining sub-module configured to obtain the identification corresponding to the first function and the identification number of the physical GPU through the first function when the second call request includes a calculation sub-request for calling the physical GPU for calculation.
  • Calculation sub-request generation sub-module used to use the first function based on the identification corresponding to the first function, the The configuration information of the physical GPU, the calculation parameters and the target video memory address are used to generate the calculation sub-request.
  • Example 10 provides the device of Example 9, and the acquisition sub-module is further configured to acquire the original video memory address of the first terminal used when the virtual GPU performs calculations; based on the first terminal in the first terminal.
  • the mapping relationship between the display memory address and the display memory address in the second terminal determines the target display memory address in the second terminal corresponding to the original display memory address.
  • Example 11 provides the apparatus of Example 10.
  • the target The data includes the first changed video memory address after the physical GPU changes the video memory.
  • the device also includes:
  • a changed video memory address acquisition module used to obtain the second changed video memory address after the virtual GPU changes the video memory, and the first changed video memory address
  • a mapping relationship update module configured to update the mapping relationship based on the first changed display memory address and the second changed display memory address.
  • Example 12 provides the device of Example 8, the device further comprising:
  • the actual installation location acquisition module is used to obtain the actual installation location of the function library of the first terminal;
  • a soft link module configured to soft link the actual installation location to a common installation location of the physical GPU's native function library on the first terminal.
  • Example 13 provides the device of any one of Examples 8-12, the data packet type corresponding to the second call request includes a control transmission data packet and a data transmission data packet, and the target The data packet types corresponding to the data include control transmission data packets and data transmission data packets.
  • the second call request generation module includes:
  • a first sending submodule configured to send the control transmission data packet corresponding to the second call request to the second terminal based on the remote call protocol through the first function
  • a second sending submodule configured to send the data transmission packet corresponding to the second call request to the second terminal based on the remote direct data access network through the first function
  • the target data receiving module includes:
  • the first receiving sub-module is used to receive the control transmission data packet corresponding to the target data through the remote call protocol;
  • the second receiving sub-module is used to receive the data transmission packet corresponding to the target data through the remote direct data access network.
  • Example 14 provides the device of Example 13, the first function includes an MPI_Send function and an MPI_Recv function, and the second sending sub-module is further configured to call the MPI_Send function based on remote
  • the direct data access network sends the data transmission packet corresponding to the second call request to the third Second terminal.
  • the second receiving sub-module is also used to call the MPI_Recv function to copy the data transmission packet corresponding to the target data through the remote direct data access network.
  • Example 15 provides a computer-readable medium having a computer program stored thereon, which implements the steps of the method in any one of Examples 1-7 when executed by a processing device. .
  • Example 16 provides an electronic device, including:
  • a processing device configured to execute the computer program in the storage device to implement the steps of the method in any one of Examples 1-7.
  • Example 17 provides a computer program product.
  • the computer program product includes computer-executable instructions. When executed by a processor, any one of Examples 1-7 is implemented. The steps of the method described in the item.
  • Example 18 provides a computer program that, when executed by a processor, implements the steps of the method described in any one of Examples 1-7.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

本公开涉及一种数据获取方法、装置、存储介质以及电子设备,涉及计算机技术领域,该方法包括:获取调用第一终端自身安装的虚拟GPU的第一调用请求,第一调用请求携带第一函数对应的标识;通过第一函数对第一调用请求进行处理,得到第二调用请求,并通过第一函数将第二调用请求发送到第二终端,以使第二终端根据第二调用请求,调用物理GPU的原生函数库中的第二函数,并根据第二函数调用自身安装的物理GPU进行处理,得到第二调用请求对应的目标数据,第一函数为第一终端的函数库中与第二函数同名的函数;接收第二终端返回的目标数据。采用该方法可以避免用户在编写GPU任务时对代码进行修改,对用户程序更加透明。

Description

数据获取方法、装置、存储介质以及电子设备
相关申请的交叉引用
本申请要求于2022年03月15日提交中国专利局、申请号为202210256039.4、申请名称为“数据获取方法、装置、存储介质以及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本文中。
技术领域
本公开涉及计算机技术领域,具体地,涉及一种数据获取方法、装置、存储介质以及电子设备。
背景技术
目前GPU(graphics processing unit,图形处理器)资源有限,成本高,直接使用本地安装GPU的设备完成GPU任务,大部分时间GPU都是空闲的,会造成严重的资源浪费,并且为每一台设备本地安装GPU也不太现实。
相关技术中,存在将本地GPU任务发送到远程设备的GPU执行,从而通过远程的设备的GPU完成GPU任务的方案,如此,便能够实现在没有GPU的本地设备也完成GPU任务的功能,然而,相关技术中的方案通常需要在编写GPU任务时对代码进行修改。
发明内容
提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。
第一方面,本公开提供一种数据获取方法,应用于第一终端,该方法包括:
获取调用所述第一终端自身安装的虚拟GPU的第一调用请求,所述第一调用请求携带第一函数对应的标识;
通过所述第一函数对所述第一调用请求进行处理,得到第二调用请求,并通过所述第一函数将所述第二调用请求发送到第二终端,以使所述第二终端根据所述第二调用请求,调用物理GPU的原生函数库中的第二函数,并根据所述第二函数调用自身安装的物理 GPU进行处理,得到所述第二调用请求对应的目标数据,所述第一函数为所述第一终端的函数库中与所述第二函数同名的函数;
接收所述第二终端返回的所述目标数据。
第二方面,本公开提供一种数据获取装置,应用于第一终端,该装置包括:
第一调用请求获取模块,用于获取调用所述第一终端自身安装的虚拟GPU的第一调用请求,所述第一调用请求携带第一函数对应的标识;
第二调用请求生成模块,用于通过所述第一函数对所述第一调用请求进行处理,得到第二调用请求,并通过所述第一函数将所述第二调用请求发送到第二终端,以使所述第二终端根据所述第二调用请求,调用物理GPU的原生函数库中的第二函数,并根据所述第二函数调用自身安装的物理GPU进行处理,得到所述第二调用请求对应的目标数据,所述第一函数为所述第一终端的函数库中与所述第二函数同名的函数;
目标数据接收模块,用于接收所述第二终端返回的所述目标数据。
第三方面,本公开提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理装置执行时实现第一方面所述方法的步骤。
第四方面,本公开提供一种电子设备,包括:
存储装置,其上存储有至少一个计算机程序;
至少一个处理装置,用于执行所述存储装置中的所述至少一个计算机程序,以实现第一方面所述方法的步骤。
第五方面,本公开提供一种计算机程序产品,所述计算机程序产品包含计算机执行指令,当处理器执行所述计算机执行指令时,实现第一方面所述方法的步骤。
第六方面,本公开提供一种计算机程序,当处理器执行所述计算机程序时,实现第一方面所述方法的步骤。
本公开的其他特征和优点将在随后的具体实施方式部分予以详细说明。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。在附图中:
图1是根据一示例性实施例提供的一种应用环境的示意图;
图2是根据一示例性实施例提供的一种数据获取方法的流程示意图;
图3是根据一示例性实施例提供的另一种应用环境的示意图;
图4是根据一示例性实施例提供的一种数据获取装置的模块连接示意图;
图5是根据一示例性实施例提供的一种电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
相关技术中,存在一些框架,例如tensorflow、pytorch等可以把GPU任务提交到远程机器上执行,然而,这些框架在使用时,用户意识到自己使用的是远程机器上的GPU,在GPU任务编程时需要在GPU任务的代码的基础上额外增加一些代码。其中,GPU任务可以包括开发、调试以及运行GPU程序等,且在执行GPU任务时,调用GPU进行处理。
例如,tf需要显示调用tf.config.experimental_connect_to_cluster方法,又例如,Torch通常需要用xla编译,并且需要在原本单机能跑通的代码上添加一些代码。比如xm.mark_step()等。
由于需要额外增加一些代码,导致整个GPU任务编程过程变得复杂,对用户程序不 透明,并且由于不同于传统的在本地安装GPU的设备编程时的编程习惯,因此,增加了用户编程出错的可能性。
针对上述技术问题,本公开实施例提供了一种数据获取方法、装置、存储介质以及电子设备。通过在未安装物理GPU的第一终端获取到第一调用请求时,对第一调用请求进行处理得到第二调用请求,然后再通过远程第二终端的物理GPU来对第二调用请求进行处理,并将处理后的目标数据返回给第一终端,实现了在第一终端没有GPU的情况下也能够完成GPU任务的功能,此外,通过在第一终端安装虚拟GPU,并且虚拟GPU对应的第一终端的函数库中的第一函数与物理GPU的原生函数库中的第二函数同名,使得用户在对GPU任务进行编程时,可以按照第一终端存在物理GPU一样的编程习惯进行编程,避免用户在编写GPU任务时对代码进行修改,使得对用户程序更加透明,也降低用户编程出错的可能性。
为了便于详细说明本申请方案,下面先结合附图对本申请实施例中的一种应用环境进行介绍。
在一些实施方式中,请参阅图1,图1所示为本公开实施例所提供的一种应用环境的示意图。其中,包括有第一终端和第二终端,其中,第一终端和第二终端通过网络连接。第一终端可以将本地的GPU程序对虚拟GPU的调用请求通过虚拟函数库中的第一函数发送到第二终端,以使第二终端调用自身物理GPU的原生函数库中的与第一函数同名的第二函数,并根据第二函数调用自身安装的物理GPU进行处理,从而支持用户在没有GPU设备的机器上开发、调试和运行GPU程序,并且整个过程对用户程序透明,就像GPU设备是在第一终端本地一样。
下面将结合附图对本公开实施例提出的一种数据获取方法、装置、存储介质以及电子设备进行详细说明。
图2是根据一示例性实施例提供的一种数据获取方法的流程示意图。本公开实施例提供的数据获取方法可以通过图1所示的第一终端执行,具体可以通过数据获取装置来执行,该装置可以有软件和/或硬件的方式实现,配置于图1所示的第一终端中。请参考图2,本公开实施例提供的数据获取方法可以包括以下步骤:
S210,获取调用第一终端自身安装的虚拟GPU的第一调用请求,第一调用请求携带第一函数对应的标识。
其中,虚拟GPU可以理解为在第一终端本地虚拟出的GPU,与真实的物理GPU不同,虚拟GPU不能够进行计算。
在一些实施方式中,可以创建驱动设备,将驱动设备挂载在/dev/remotegpu路径,该驱动设备可以是Linux驱动设备。该驱动设备可以在proc文件系统中创建远程物理GPU的配置信息,比如/proc/driver/bytedance/remotegpu0,/proc/driver/bytedance/remotegpu1。每个文件内保存了远程真实的物理GPU的信息。示例性地,该虚拟GPU设备指向了IP地址是192.0.0.1的远程第二终端上,UUID是GPU-5a0622d3-66c6-4f39-30fd-d31ab6401071的GPU设备,该过程便完成了虚拟GPU的创建,后续第一终端可以通过以太网访问第二终端。
可以理解的是,由于调用GPU进行计算是通过调用对应的函数实现的,因此,第一调用请求携带有第一函数对应的标识。
其中,第一调用请求可以是第一终端的任一个GPU程序发起的,示例性地,可以是某一个需要调用GPU进行处理的游戏、绘图软件等。
S220,通过第一函数对第一调用请求进行处理,得到第二调用请求,并通过第一函数将第二调用请求发送到第二终端,以使第二终端根据第二调用请求,调用物理GPU的原生函数库中的第二函数,并根据第二函数调用自身安装的物理GPU进行处理,得到第二调用请求对应的目标数据,第一函数为第一终端的函数库中与第二函数同名的函数。
本公开实施例中,第一终端在获取到第一调用请求之后,可以对第一调用请求进行解析,得到其中包括的第一函数对应的标识,然后便可以根据该标识调用对应的第一函数进行处理,由于第一终端的GPU为虚拟GPU,不能够进行计算,因此,第一函数不会调用虚拟GPU对第一调用请求进行计算,而是对第一调用请求进行重新封装处理,得到第二调用请求,并将第二调用请求发送到第二终端。
在一些实施方式中,第一函数执行的功能主要包括两个部分,这两个部分的功能分别可以由对应的子函数完成,例如,第一子函数和第二子函数,其中第一子函数完成对第一调用请求进行重新封装处理的功能,得到第二调用请求,第二子函数完成将第二调用请求发送到第二终端的功能。
在将第二调用请求发送到第二终端之后,第二终端便能够根据第二调用请求调用物理GPU的原生函数库中与第一函数同名的第二函数,并根据第二函数调用自身安装的物理GPU进行处理,得到第二调用请求对应的目标数据。
可以理解的是,物理GPU的原生函数库可以包括原生cuda函数库以及原生nvidia函数库,本公开实施例中,第一函数所在的函数库可以是自定义的cuda函数库以及自定义nvidia函数库,在调用自定义的cuda函数库以及自定义nvidia函数库之后,不会直接操作 物理GPU进行计算。
S230,接收第二终端返回的目标数据。
本公开实施例中,第二终端在调用自身安装的物理GPU对第二调用请求进行处理,得到目标数据之后,便可以将目标数据返回给第一终端,从而第一终端便能够接收到第二终端返回的目标数据。
在一些实施方式中,第一终端在接收到第二终端返回的目标数据之后,可以将目标数据返回给对应的上层应用程序。
采用上述方法,由于在未安装物理GPU的第一终端获取到第一调用请求时,可以对第一调用请求进行处理得到第二调用请求,然后再通过远程第二终端的物理GPU来对第二调用请求进行处理,并将处理后的目标数据返回给第一终端,实现了在第一终端没有GPU的情况下也能够完成GPU任务的功能,此外,由于在第一终端安装有虚拟GPU,并且虚拟GPU对应的第一终端的函数库中的第一函数与物理GPU的原生函数库中的第二函数同名,使得用户在对GPU任务进行编程时,可以按照第一终端存在物理GPU一样的编程习惯进行编程,以避免用户在编写GPU任务时对代码进行修改,对用户程序更加透明,也降低用户编程出错的可能性。
可以理解的是,物理GPU在第二终端中对应有显存地址,此外,为了尽可能的减少对编程代码的更改,对用户程序透明,虚拟GPU在第一终端中也可以对应有显存地址,其中,虚拟GPU在第一终端中的显存地址可以是虚拟的。
本公开实施例中,相当于是把在第一终端本地执行的GPU任务发送到远程的第二终端进行执行,因此,在第一终端与第二终端中对应的GPU任务是不变的,也就是说,调用请求包括的请求类型是不变的,在一些实施方式中,第一调用请求与第二调用请求均为调用GPU进行计算的计算子请求,此时,第二调用请求具体可以包括用于调用物理GPU进行计算的计算子请求,这种情况下,通过第一函数对第一调用请求进行处理,得到第二调用请求,包括以下步骤:
在第二调用请求包括用于调用物理GPU进行计算的计算子请求的情况下,通过第一函数获取第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址;通过第一函数基于第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址,生成计算子请求。
由于在第一终端与第二终端中对应完成的GPU功能不变,因此,在生成第二调用请求时,调用的函数是相同的,计算参数也是相同的,此外,由于虚拟GPU的配置信息指 向的是真实物理GPU的配置信息,因此,虚拟GPU的配置信息与物理GPU的配置信息是相同的,然而考虑到第一终端中的显存地址与第二终端中的显存地址可能并不是对应的,因此,在生成第二调用请求时,还需要获取到第二终端中的物理GPU进行计算时实际对应的显存地址,即目标显存地址。
从而,在本公开实施例中,可以先通过第一函数获取第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址,然后再通过第一函数基于第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址,生成计算子请求。
示例性地,第一调用请求与第二调用请求均为调用GPU进行计算的计算子请求时,第一函数可以是cuLaunchKernel函数。
在一些实施方式中,获取目标显存地址,可以包括以下步骤:
获取虚拟GPU进行计算时使用的第一终端的原始显存地址;基于第一终端中的显存地址与第二终端中的显存地址之间的映射关系,确定与原始显存地址对应的第二终端中的目标显存地址。
本公开实施例中,在第一终端中,可以通过第一函数对第一调用请求进行解析,从而获得第一函数对应的标识、物理GPU的配置信息、计算参数以及虚拟GPU使用的第一终端的原始显存地址,在获取到虚拟GPU进行计算时使用的第一终端的原始显存地址之后,可以基于第一终端中的显存地址与第二终端中的显存地址之间的映射关系,确定与原始显存地址对应的第二终端中的目标显存地址。
此外,在一些实施方式中,第一终端在获取到第一调用请求之后,也可以通过第一函数将第一调用请求直接转发到第二终端,由第二终端对第一调用请求进行解析,得到第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址,并基于第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址,生成计算子请求。这种情况下,上述第一终端中的显存地址与第二终端中的显存地址之间的映射关系还可以存储在第二终端中。
在另一些实施方式中,第一调用请求与第二调用请求均为调用GPU对显存进行变更的变更子请求,此时,第二调用请求具体可以包括用于调用物理GPU对显存进行变更的变更子请求,目标数据包括物理GPU对显存进行变更后的第一变更显存地址,这种情况下,获取目标数据之后,本公开实施例的数据获取方法还包括以下步骤:
获取虚拟GPU对显存进行变更后的第二变更显存地址,以及第一变更显存地址;基于第一变更显存地址以及第二变更显存地址,对映射关系进行更新。
结合前述内容可知,物理GPU在第二终端中对应有显存地址,虚拟GPU在第一终端中对应有显存地址,那么当第一终端获取到第一调用请求之后,虚拟GPU也可以对第一终端中的显存地址进行变更,得到变更后的第二变更显存地址,进而,为了保证后续GPU任务的准确完成,在获取到目标数据之后,可以将第一变更显存地址与变更后的第二变更显存地址进行对应,以对映射关系进行更新。
在一些实施方式中,对显存进行变更的变更子请求可以包括显存申请子请求与显存释放子请求两种。示例性地,第一调用请求与第二调用请求均为调用GPU对显存进行变更的变更子请求时,第一函数可以是cuMemAlloc函数。
此外,考虑到第一函数所在的函数库并不是物理GPU的原生函数库,因此,不能够直接安装部署在物理GPU的原生函数库的部署位置,例如不能直接部署在/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1路径或者/usr/lib/x86_64-linux-gnu/libcuda.so.1路径,这种情况下,为了进一步减少用户在编写GPU任务时对代码进行修改,对用户程序更加透明,在一些实施方式中,本公开实施例的数据获取方法还可以包括以下步骤:
获取第一终端的函数库的实际安装位置;将实际安装位置软链接到物理GPU的原生函数库在第一终端上的通用安装位置。
软链接又叫符号链接,可以将其视为文件的别名,这个文件包含了另一个文件的路径名。可以是任意文件或目录,可以链接不同文件系统的文件。软链接使的我们需要在不同的目录用到相同的文件时,不需要在每一个需要的目录下都放一个必须相同的文件,只要在某个固定的目录放上该文件,然后在其它的目录下链接(link)它就可以。
示例性地,假设将第一函数对应的函数库安装部署在/usr/lib/x86_64-linux-gnu/libcuda.so路径,则可以将其软链接到/usr/lib/x86_64-linux-gnu/libcuda.so.1路径,又或者假设将第一函数对应的函数库安装部署在/usr/lib/x86_64-linux-gnu/libnvidia.so路径,则可以将其软链接到/usr/lib/x86_64-linux-gnu/libnvidia.so.1路径。
通过将第一终端的函数库的实际安装位置软链接到物理GPU的原生函数库在第一终端上的通用安装位置,可以使得在不便于在原生函数库的通用安装位置安装第一函数库的情况下,依然能够减少用户在编写GPU任务时对代码进行修改,对用户程序更加透明。
在一些实施方式中,第一终端与第二终端之间可以通过远程调用协议进行通信,示例性地,可以在第二终端部署远程调用服务器,在第一终端部署远程调用客户端(即第一函数),从而客户端与服务器之间可以通过远程调用协议通信。这种情况下,可以通过第一函数基于远程调用协议将第二调用请求发送到第二终端,以及通过远程调用协议接收第二 终端返回的目标数据。
此外,考虑到一些终端上安装有远程直接数据存取网卡,这种情况下,可以通过远程直接数据存取技术实现网络加速,因此,在另一些实施方式中,第一终端与第二终端之间可以通过远程调用协议以及远程直接数据存取网络进行通信,从而,可以将第二调用请求对应的数据包类型细分为控制传输数据包以及数据传输数据包,以及将目标数据对应的数据包类型细分为控制传输数据包以及数据传输数据包,这种情况下,通过第一函数将第二调用请求发送到第二终端,可以包括以下步骤:
通过第一函数基于远程调用协议将第二调用请求对应的控制传输数据包发送到第二终端;和/或通过第一函数基于远程直接数据存取网络将第二调用请求对应的数据传输数据包发送到第二终端。
同样地,接收第二终端返回的目标数据可以包括以下步骤:
通过远程调用协议接收目标数据对应的控制传输数据包;和/或通过远程直接数据存取网络接收目标数据对应的数据传输数据包。
其中,远程调用协议简称为rpc(Remote Procedure Call Protocol)协议。远程直接数据存取简称为RDMA(Remote Direct Memory Access)。
也就是说,本公开实施例中,当第二调用请求包括控制传输数据包时,可以基于远程调用协议将第二调用请求对应的控制传输数据包发送到第二终端,而当第二调用请求包括数据传输数据包时,可以基于远程直接数据存取网络将第二调用请求对应的数据传输数据包发送到第二终端,当目标数据包括控制传输数据包时,可以通过远程调用协议接收目标数据对应的控制传输数据包,当目标数据包括数据传输数据包时,可以通过远程直接数据存取网络接收目标数据对应的数据传输数据包。
此外,在一些实施方式中,第一函数包括MPI_Send函数以及MPI_Recv函数,这种情况下,通过第一函数基于远程直接数据存取网络将第二调用请求对应的数据传输数据包发送到第二终端,包括:调用MPI_Send函数基于远程直接数据存取网络将第二调用请求对应的数据传输数据包发送到第二终端。
通过远程直接数据存取网络接收目标数据对应的数据传输数据包,包括:调用MPI_Recv函数通过远程直接数据存取网络拷贝目标数据对应的数据传输数据包
本公开实施例中,当第一终端向第二终端发送数据传输数据包时,比如调用cuMemcpyHtoD函数发送数据包时,可以调用MPI_Send函数通过远程直接数据存取网络发送数据传输数据包到第二终端,以实现第一终端向第二终端发送数据时的网络加速。
当第一终端从第二终端拷贝数据时,比如调用cuMemcpyDtoH函数拷贝数据包时,可以调用MPI_Recv函数通过远程直接数据存取网络从第二终端拷贝数据传输数据包,例如,从第二终端拷贝GPU的显存数据,以实现第一终端从第二终端拷贝数据时的网络加速。
请参阅图3,图3所示为本公开实施例所涉及的另一种应用环境的示意图。其中,包括有第一终端和第二终端。其中,第一终端和第二终端可以通过rpc协议以及RDMA网络连接,第一终端可以通过虚拟函数库中的第一函数,将本地的控制传输数据包基于rpc协议发送到第二终端的rpc服务器,以及通过rpc协议从rpc服务器接收控制传输数据包,还可以通过虚拟函数库中的第一函数,将本地的数据传输数据包基于RDMA网络发送到第二终端,以及通过RDMA网络从第二终端接收数据传输数据包。
图4是根据一示例性实施例提供的一种数据获取装置的模块连接示意图。如图4所示,本公开实施例提供了一种数据获取装置,应用于第一终端杆,该装置400可以包括:
第一调用请求获取模块410,用于获取调用所述第一终端自身安装的虚拟GPU的第一调用请求,所述第一调用请求携带第一函数对应的标识;
第二调用请求生成模块420,用于通过所述第一函数对所述第一调用请求进行处理,得到第二调用请求,并通过所述第一函数将所述第二调用请求发送到第二终端,以使所述第二终端根据所述第二调用请求,调用物理GPU的原生函数库中的第二函数,并根据所述第二函数调用自身安装的物理GPU进行处理,得到所述第二调用请求对应的目标数据,所述第一函数为所述第一终端的函数库中与所述第二函数同名的函数;
目标数据接收模块430,用于接收所述第二终端返回的所述目标数据。
可选地,第二调用请求生成模块420,包括:
获取子模块,用于在所述第二调用请求包括用于调用所述物理GPU进行计算的计算子请求的情况下,通过所述第一函数获取所述第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址;
计算子请求生成子模块,用于通过所述第一函数基于所述第一函数对应的标识、所述物理GPU的配置信息、所述计算参数以及所述目标显存地址,生成所述计算子请求。
可选地,获取子模块还用于获取所述虚拟GPU进行计算时使用的第一终端的原始显存地址;基于第一终端中的显存地址与第二终端中的显存地址之间的映射关系,确定与所述原始显存地址对应的第二终端中的目标显存地址。
可选地,在所述第二调用请求为用于调用所述物理GPU对显存进行变更的变更子请求的情况下,所述目标数据包括所述物理GPU对显存进行变更后的第一变更显存地址, 这种情况下,装置400还包括:
变更显存地址获取模块,用于获取所述虚拟GPU对显存进行变更后的第二变更显存地址,以及所述第一变更显存地址;
映射关系更新模块,用于基于所述第一变更显存地址以及所述第二变更显存地址,对所述映射关系进行更新。
可选地,装置400还包括:
实际安装位置获取模块,用于获取所述第一终端的所述函数库的实际安装位置;
软链接模块,用于将所述实际安装位置软链接到物理GPU的原生函数库在所述第一终端上的通用安装位置。
可选地,所述第二调用请求对应的数据包类型包括控制传输数据包以及数据传输数据包,所述目标数据对应的数据包类型包括控制传输数据包以及数据传输数据包,第二调用请求生成模块420,包括:
第一发送子模块,用于通过所述第一函数基于远程调用协议将所述第二调用请求对应的控制传输数据包发送到所述第二终端;
第二发送子模块,用于通过所述第一函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第二终端。
所述目标数据接收模块430,包括:
第一接收子模块,用于通过远程调用协议接收所述目标数据对应的控制传输数据包;
第二接收子模块,用于通过远程直接数据存取网络接收所述目标数据对应的数据传输数据包。
可选地,所述第一函数包括MPI_Send函数以及MPI_Recv函数,所述第二发送子模块,还用于调用所述MPI_Send函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第二终端。第二接收子模块,还用于调用所述MPI_Recv函数通过远程直接数据存取网络拷贝所述目标数据对应的数据传输数据包。
关于上述实施例中的装置的各个功能模块的具体实施方式,已在关于方法的部分进行了详细说明,在此不再赘述。
下面参考图5,其示出了适于用来实现本公开实施例的电子设备500的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理,Personal Digital Assistant)、PAD(平板电脑,Portable Android Device)、PMP(便携式多媒体播放器,Portable Media Player)、车载终端(例如车载导航 终端)等等的移动终端以及诸如数字TV(电视,Television)、台式计算机等等的固定终端。图5示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图5所示,电子设备500可以包括处理装置(例如中央处理器、图形处理器等)501,其可以根据存储在只读存储器(Read Only Memory,ROM)502中的程序或者从存储装置508加载到随机访问存储器(Random Access Memory,RAM)503中的程序而执行各种适当的动作和处理。在RAM 503中,还存储有电子设备500操作所需的各种程序和数据。处理装置501、ROM 502以及RAM 503通过总线504彼此相连。输入/输出(Input/Output,I/O)接口505也连接至总线504。
通常,以下装置可以连接至I/O接口505:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置506;包括例如液晶显示器(Liquid Crystal Display,LCD)、扬声器、振动器等的输出装置507;包括例如磁带、硬盘等的存储装置508;以及通信装置509。通信装置509可以允许电子设备500与其他设备进行无线或有线通信以交换数据。虽然图5示出了具有各种装置的电子设备500,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置509从网络上被下载和安装,或者从存储装置508被安装,或者从ROM 502被安装。在该计算机程序被处理装置501执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部 分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,电子设备可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(Local Area Network,LAN),广域网(Wide Area Network,WAN),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取寄宿应用的当前进程优先级;将所述寄宿应用对应的宿主应用的目标进程的进程优先级调整为与所述当前进程优先级一致,所述目标进程为所述宿主应用创建用于运行所述寄宿应用的虚拟运行环境所必须的进程;其中,所述寄宿应用的进程优先级与所述目标进程的进程优先级之间存在依赖关系,所述依赖关系用于使得所述目标进程的进程优先级跟随所述寄宿应用的进程优先级的变化而变化。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个 用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该模块本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application Specific Integrated Circuit,ASIC)、专用标准产品(Application Specific Standard Product,ASSP)、片上系统(System on Chip,SOC)、复杂可编程逻辑设备(Complex Programmable Logic Device,CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,示例1提供了一种数据获取方法,应用于第一终端,所述方法包括:
获取调用所述第一终端自身安装的虚拟GPU的第一调用请求,所述第一调用请求携带第一函数对应的标识;
通过所述第一函数对所述第一调用请求进行处理,得到第二调用请求,并通过所述第一函数将所述第二调用请求发送到第二终端,以使所述第二终端根据所述第二调用请求,调用物理GPU的原生函数库中的第二函数,并根据所述第二函数调用自身安装的物理GPU进行处理,得到所述第二调用请求对应的目标数据,所述第一函数为所述第一终端的 函数库中与所述第二函数同名的函数;
接收所述第二终端返回的所述目标数据。
根据本公开的一个或多个实施例,示例2提供了示例1的方法,所述通过所述第一函数对所述第一调用请求进行处理,得到第二调用请求,包括:
在所述第二调用请求包括用于调用所述物理GPU进行计算的计算子请求的情况下,通过所述第一函数获取所述第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址;
通过所述第一函数基于所述第一函数对应的标识、所述物理GPU的配置信息、所述计算参数以及所述目标显存地址,生成所述计算子请求。
根据本公开的一个或多个实施例,示例3提供了示例2的方法,获取所述目标显存地址,包括:
获取所述虚拟GPU进行计算时使用的第一终端的原始显存地址;
基于第一终端中的显存地址与第二终端中的显存地址之间的映射关系,确定与所述原始显存地址对应的第二终端中的目标显存地址。
根据本公开的一个或多个实施例,示例4提供了示例3的方法,在所述第二调用请求为用于调用所述物理GPU对显存进行变更的变更子请求的情况下,所述目标数据包括所述物理GPU对显存进行变更后的第一变更显存地址,获取所述目标数据之后,所述方法还包括:
获取所述虚拟GPU对显存进行变更后的第二变更显存地址,以及所述第一变更显存地址;
基于所述第一变更显存地址以及所述第二变更显存地址,对所述映射关系进行更新。
根据本公开的一个或多个实施例,示例5提供了示例1的方法,所述方法还包括:
获取所述第一终端的所述函数库的实际安装位置;
将所述实际安装位置软链接到物理GPU的原生函数库在所述第一终端上的通用安装位置。
根据本公开的一个或多个实施例,示例6提供了示例1-5任一项的方法,所述第二调用请求对应的数据包类型包括控制传输数据包以及数据传输数据包,所述目标数据对应的数据包类型包括控制传输数据包以及数据传输数据包,通过所述第一函数将所述第二调用请求发送到第二终端,包括:
通过所述第一函数基于远程调用协议将所述第二调用请求对应的控制传输数据包发 送到所述第二终端;和/或
通过所述第一函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第二终端;
所述接收所述第二终端返回的所述目标数据,包括:
通过远程调用协议接收所述目标数据对应的控制传输数据包;和/或
通过远程直接数据存取网络接收所述目标数据对应的数据传输数据包。
根据本公开的一个或多个实施例,示例7提供了示例6的方法,所述第一函数包括MPI_Send函数以及MPI_Recv函数,所述通过所述第一函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第二终端,包括:
调用所述MPI_Send函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第二终端;
所述通过远程直接数据存取网络接收所述目标数据对应的数据传输数据包,包括:
调用所述MPI_Recv函数通过远程直接数据存取网络拷贝所述目标数据对应的数据传输数据包。
根据本公开的一个或多个实施例,示例8提供了一种数据获取装置,应用于第一终端,所述装置包括:
第一调用请求获取模块,用于获取调用所述第一终端自身安装的虚拟GPU的第一调用请求,所述第一调用请求携带第一函数对应的标识;
第二调用请求生成模块,用于通过所述第一函数对所述第一调用请求进行处理,得到第二调用请求,并通过所述第一函数将所述第二调用请求发送到第二终端,以使所述第二终端根据所述第二调用请求,调用物理GPU的原生函数库中的第二函数,并根据所述第二函数调用自身安装的物理GPU进行处理,得到所述第二调用请求对应的目标数据,所述第一函数为所述第一终端的函数库中与所述第二函数同名的函数;
目标数据接收模块,用于接收所述第二终端返回的所述目标数据。
根据本公开的一个或多个实施例,示例9提供了示例8的装置,所述第二调用请求生成模块,包括:
获取子模块,用于在所述第二调用请求包括用于调用所述物理GPU进行计算的计算子请求的情况下,通过所述第一函数获取所述第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址;
计算子请求生成子模块,用于通过所述第一函数基于所述第一函数对应的标识、所述 物理GPU的配置信息、所述计算参数以及所述目标显存地址,生成所述计算子请求。
根据本公开的一个或多个实施例,示例10提供了示例9的装置,获取子模块还用于获取所述虚拟GPU进行计算时使用的第一终端的原始显存地址;基于第一终端中的显存地址与第二终端中的显存地址之间的映射关系,确定与所述原始显存地址对应的第二终端中的目标显存地址。
根据本公开的一个或多个实施例,示例11提供了示例10的装置,在所述第二调用请求为用于调用所述物理GPU对显存进行变更的变更子请求的情况下,所述目标数据包括所述物理GPU对显存进行变更后的第一变更显存地址,这种情况下,装置还包括:
变更显存地址获取模块,用于获取所述虚拟GPU对显存进行变更后的第二变更显存地址,以及所述第一变更显存地址;
映射关系更新模块,用于基于所述第一变更显存地址以及所述第二变更显存地址,对所述映射关系进行更新。
根据本公开的一个或多个实施例,示例12提供了示例8的装置,装置还包括:
实际安装位置获取模块,用于获取所述第一终端的所述函数库的实际安装位置;
软链接模块,用于将所述实际安装位置软链接到物理GPU的原生函数库在所述第一终端上的通用安装位置。
根据本公开的一个或多个实施例,示例13提供了示例8-12任一项的装置,所述第二调用请求对应的数据包类型包括控制传输数据包以及数据传输数据包,所述目标数据对应的数据包类型包括控制传输数据包以及数据传输数据包,第二调用请求生成模块,包括:
第一发送子模块,用于通过所述第一函数基于远程调用协议将所述第二调用请求对应的控制传输数据包发送到所述第二终端;
第二发送子模块,用于通过所述第一函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第二终端;
所述目标数据接收模块,包括:
第一接收子模块,用于通过远程调用协议接收所述目标数据对应的控制传输数据包;
第二接收子模块,用于通过远程直接数据存取网络接收所述目标数据对应的数据传输数据包。
根据本公开的一个或多个实施例,示例14提供了示例13的装置,所述第一函数包括MPI_Send函数以及MPI_Recv函数,所述第二发送子模块,还用于调用所述MPI_Send函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第 二终端。第二接收子模块,还用于调用所述MPI_Recv函数通过远程直接数据存取网络拷贝所述目标数据对应的数据传输数据包。
根据本公开的一个或多个实施例,示例15提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现示例1-7中任一项所述方法的步骤。
根据本公开的一个或多个实施例,示例16提供了一种电子设备,包括:
存储装置,其上存储有计算机程序;
处理装置,用于执行所述存储装置中的所述计算机程序,以实现示例1-7中任一项所述方法的步骤。
根据本公开的一个或多个实施例,示例17提供了一种计算机程序产品,所述计算机程序产品包含计算机执行指令,当处理器执行所述计算机执行指令时,实现示例1-7中任一项所述方法的步骤。
根据本公开的一个或多个实施例,示例18提供了一种计算机程序,当处理器执行所述计算机程序时,实现示例1-7中任一项所述方法的步骤。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。

Claims (12)

  1. 一种数据获取方法,应用于第一终端,所述方法包括:
    获取调用所述第一终端自身安装的虚拟图形处理器GPU的第一调用请求,所述第一调用请求携带第一函数对应的标识;
    通过所述第一函数对所述第一调用请求进行处理,得到第二调用请求,并通过所述第一函数将所述第二调用请求发送到第二终端,以使所述第二终端根据所述第二调用请求,调用物理GPU的原生函数库中的第二函数,并根据所述第二函数调用自身安装的物理GPU进行处理,得到所述第二调用请求对应的目标数据,所述第一函数为所述第一终端的函数库中与所述第二函数同名的函数;
    接收所述第二终端返回的所述目标数据。
  2. 根据权利要求1所述的数据获取方法,其中,所述通过所述第一函数对所述第一调用请求进行处理,得到第二调用请求,包括:
    在所述第二调用请求包括用于调用所述物理GPU进行计算的计算子请求的情况下,通过所述第一函数获取所述第一函数对应的标识、物理GPU的配置信息、计算参数以及目标显存地址;
    通过所述第一函数基于所述第一函数对应的标识、所述物理GPU的配置信息、所述计算参数以及所述目标显存地址,生成所述计算子请求。
  3. 根据权利要求2所述的数据获取方法,其中,获取所述目标显存地址,包括:
    获取所述虚拟GPU进行计算时使用的第一终端的原始显存地址;
    基于第一终端中的显存地址与第二终端中的显存地址之间的映射关系,确定与所述原始显存地址对应的第二终端中的目标显存地址。
  4. 根据权利要求3所述的数据获取方法,其中,在所述第二调用请求为用于调用所述物理GPU对显存进行变更的变更子请求的情况下,所述目标数据包括所述物理GPU对显存进行变更后的第一变更显存地址,获取所述目标数据之后,所述方法还包括:
    获取所述虚拟GPU对显存进行变更后的第二变更显存地址,以及所述第一变更显存地址;
    基于所述第一变更显存地址以及所述第二变更显存地址,对所述映射关系进行更新。
  5. 根据权利要求1所述的数据获取方法,其中,所述方法还包括:
    获取所述第一终端的所述函数库的实际安装位置;
    将所述实际安装位置软链接到物理GPU的原生函数库在所述第一终端上的通用安装 位置。
  6. 根据权利要求1-5中任一项所述的数据获取方法,其中,所述第二调用请求对应的数据包类型包括控制传输数据包以及数据传输数据包,所述目标数据对应的数据包类型包括控制传输数据包以及数据传输数据包,通过所述第一函数将所述第二调用请求发送到第二终端,包括:
    通过所述第一函数基于远程调用协议将所述第二调用请求对应的控制传输数据包发送到所述第二终端;和/或
    通过所述第一函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第二终端;
    所述接收所述第二终端返回的所述目标数据,包括:
    通过远程调用协议接收所述目标数据对应的控制传输数据包;和/或
    通过远程直接数据存取网络接收所述目标数据对应的数据传输数据包。
  7. 根据权利要求6所述的数据获取方法,其中,所述第一函数包括MPI_Send函数以及MPI_Recv函数,所述通过所述第一函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第二终端,包括:
    调用所述MPI_Send函数基于远程直接数据存取网络将所述第二调用请求对应的数据传输数据包发送到所述第二终端;
    所述通过远程直接数据存取网络接收所述目标数据对应的数据传输数据包,包括:
    调用所述MPI_Recv函数通过远程直接数据存取网络拷贝所述目标数据对应的数据传输数据包。
  8. 一种数据获取装置,应用于第一终端,所述装置包括:
    第一调用请求获取模块,用于获取调用所述第一终端自身安装的虚拟图形处理器GPU的第一调用请求,所述第一调用请求携带第一函数对应的标识;
    第二调用请求生成模块,用于通过所述第一函数对所述第一调用请求进行处理,得到第二调用请求,并通过所述第一函数将所述第二调用请求发送到第二终端,以使所述第二终端根据所述第二调用请求,调用物理GPU的原生函数库中的第二函数,并根据所述第二函数调用自身安装的物理GPU进行处理,得到所述第二调用请求对应的目标数据,所述第一函数为所述第一终端的函数库中与所述第二函数同名的函数;
    目标数据接收模块,用于接收所述第二终端返回的所述目标数据。
  9. 一种计算机可读介质,其上存储有计算机程序,其特征在于,该程序被处理装置执 行时实现权利要求1-7中任一项所述方法的步骤。
  10. 一种电子设备,其特征在于,包括:
    存储装置,其上存储有至少一个计算机程序;
    至少一个处理装置,用于执行所述存储装置中的所述至少一个计算机程序,以实现权利要求1-7中任一项所述方法的步骤。
  11. 一种计算机程序产品,所述计算机程序产品包含计算机执行指令,当处理器执行所述计算机执行指令时,实现权利要求1-7中任一项所述方法的步骤。
  12. 一种计算机程序,当处理器执行所述计算机程序时,实现权利要求1-7中任一项所述方法的步骤。
PCT/CN2023/074457 2022-03-15 2023-02-03 数据获取方法、装置、存储介质以及电子设备 WO2023173954A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210256039.4A CN114595065A (zh) 2022-03-15 2022-03-15 数据获取方法、装置、存储介质以及电子设备
CN202210256039.4 2022-03-15

Publications (1)

Publication Number Publication Date
WO2023173954A1 true WO2023173954A1 (zh) 2023-09-21

Family

ID=81817919

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/074457 WO2023173954A1 (zh) 2022-03-15 2023-02-03 数据获取方法、装置、存储介质以及电子设备

Country Status (2)

Country Link
CN (1) CN114595065A (zh)
WO (1) WO2023173954A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117453423A (zh) * 2023-12-25 2024-01-26 北京趋动智能科技有限公司 Gpu显存管理方法和系统,存储介质和电子设备

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114595065A (zh) * 2022-03-15 2022-06-07 北京有竹居网络技术有限公司 数据获取方法、装置、存储介质以及电子设备
CN117573418B (zh) * 2024-01-15 2024-04-23 北京趋动智能科技有限公司 针对显存访问异常的处理方法、系统、介质及设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9576332B1 (en) * 2014-06-02 2017-02-21 VCE IP Holding Company LLC Systems and methods for remote graphics processing unit service
CN109614230A (zh) * 2018-12-03 2019-04-12 联想(北京)有限公司 资源虚拟化方法、装置和电子设备
CN111223036A (zh) * 2019-12-29 2020-06-02 广东浪潮大数据研究有限公司 一种gpu虚拟化共享方法、装置及电子设备和存储介质
WO2021098182A1 (zh) * 2019-11-20 2021-05-27 上海商汤智能科技有限公司 资源管理方法和装置、电子设备及存储介质
CN114595065A (zh) * 2022-03-15 2022-06-07 北京有竹居网络技术有限公司 数据获取方法、装置、存储介质以及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9576332B1 (en) * 2014-06-02 2017-02-21 VCE IP Holding Company LLC Systems and methods for remote graphics processing unit service
CN109614230A (zh) * 2018-12-03 2019-04-12 联想(北京)有限公司 资源虚拟化方法、装置和电子设备
WO2021098182A1 (zh) * 2019-11-20 2021-05-27 上海商汤智能科技有限公司 资源管理方法和装置、电子设备及存储介质
CN111223036A (zh) * 2019-12-29 2020-06-02 广东浪潮大数据研究有限公司 一种gpu虚拟化共享方法、装置及电子设备和存储介质
CN114595065A (zh) * 2022-03-15 2022-06-07 北京有竹居网络技术有限公司 数据获取方法、装置、存储介质以及电子设备

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117453423A (zh) * 2023-12-25 2024-01-26 北京趋动智能科技有限公司 Gpu显存管理方法和系统,存储介质和电子设备
CN117453423B (zh) * 2023-12-25 2024-04-19 北京趋动智能科技有限公司 Gpu显存管理方法和系统,存储介质和电子设备

Also Published As

Publication number Publication date
CN114595065A (zh) 2022-06-07

Similar Documents

Publication Publication Date Title
WO2023173954A1 (zh) 数据获取方法、装置、存储介质以及电子设备
CN111475235B (zh) 函数计算冷启动的加速方法、装置、设备及存储介质
WO2020248745A1 (zh) 用户界面中字符的显示方法、装置、电子设备及存储介质
CN111857658A (zh) 一种渲染动态组件的方法、装置、介质和电子设备
WO2023174013A1 (zh) 显存分配方法、装置、介质及电子设备
CN114089920A (zh) 数据存储方法、装置、可读介质及电子设备
CN111400068B (zh) 接口的控制方法、装置、可读介质和电子设备
CN111309304B (zh) 一种生成idl文件的方法、装置、介质和电子设备
CN111324376B (zh) 功能配置方法、装置、电子设备及计算机可读介质
CN110221877B (zh) 一种应用程序的运行方法、装置、电子设备、及存储介质
CN114201317B (zh) 数据传输方法、装置、存储介质及电子设备
CN113886019B (zh) 虚拟机创建方法、装置、系统、介质和设备
CN110618768B (zh) 信息呈现方法和装置
CN111338666A (zh) 一种实现应用程序升级的方法、装置、介质和电子设备
CN112416303B (zh) 软件开发工具包热修复方法、装置及电子设备
WO2024055819A1 (zh) 页面展示方法、装置、存储介质和电子设备
CN116257320B (zh) 一种基于dpu虚拟化配置管理方法、装置、设备及介质
CN113391860A (zh) 服务请求处理方法、装置、电子设备及计算机存储介质
CN111752644A (zh) 接口模拟方法、装置、设备及存储介质
CN113783966B (zh) 数据传输方法、装置、可读介质及电子设备
CN114489891A (zh) 云应用程序的控制方法、系统、装置、可读介质和设备
CN111367590A (zh) 中断事件处理方法及其装置
CN113778566A (zh) 原生应用调用方法、装置、电子设备和计算机可读介质
CN117215730B (zh) 数据传输方法、装置、设备及存储介质
CN112486826B (zh) 测试方法、装置、电子设备及计算机可读介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23769465

Country of ref document: EP

Kind code of ref document: A1