Remote execution method and device of target interface, equipment and storage medium

By hijacking the application's call request and adding remote procedure callback functions, the problem that the host callback function cannot be executed when some target interfaces are remotely called, and the effect of executing the callback function on the client after the server target flow is completed is achieved, which improves the utilization rate of remote GPU computing resources.

CN119645533APending Publication Date: 2025-03-18CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311204499.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-18
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

It is difficult to remotely call certain target interfaces, such as the cudaStreamAddCallback API, especially because the callback function is not recognized by the server under the client virtual address space, resulting in the failure to trigger the execution of the client callback function.

Method used

By hijacking the application to call the target interface, add a remote procedure callback function, and send a remote procedure call request message to the server. After receiving and executing the server, it sends a remote procedure call reply message to the client, including the host callback function and function parameter information. After receiving the client, the remote procedure callback function is triggered to execute the remote procedure callback function to realize the execution of the host callback function.

Benefits of technology

Remote execution of the target interface is realized. After the target flow execution of the server side is completed, the callback function specified by the application is executed on the client, achieving the same effect as calling the local interface, and solving the execution problem of the host callback function in remote calls.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645533A_ABST
    Figure CN119645533A_ABST
Patent Text Reader

Abstract

The invention provides a remote execution method and device of a target interface, equipment and a storage medium, and relates to the technical field of computers. The method is applied to a client and comprises the following steps: hijacking a calling request of calling a target interface by an application program; the calling request comprises a host callback function and function parameter information of the host callback function; adding a remote procedure call callback function, and sending a remote procedure call request message to the server; the remote procedure call request message comprises a call request; receiving a remote procedure call response message sent by the server; the remote procedure call response message is sent by triggering a flow callback function after the server calls a native interface corresponding to the target interface, and the remote procedure call response message comprises a host callback function and function parameter information; and executing the host callback function based on the remote procedure call response message and the remote procedure call callback function. Remote execution of the target interface is achieved, and the same effect as calling of the local interface can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a remote execution method, device, equipment and storage medium of a target interface. Background Art

[0002] Graphics Processing Unit (GPU) is an expensive computing resource. If it can only be used exclusively by applications on the physical machine where it is deployed, its utilization rate is usually low, and the computing power is wasted because it cannot be fully utilized. In order to improve the utilization rate of GPU, a feasible solution is to use the physical machine with GPU deployed as a server to provide GPU computing services to the client without GPU deployed.

[0003] Compute Unified Device Architecture (CUDA) is a general-purpose parallel computing architecture launched by NVIDIA, which can use cheaper device resources to achieve more efficient parallel computing. Currently, when client applications call remote GPU computing resources by calling CUDA APIs, they usually forward the hijacked call requests to the server, which processes the call requests and then returns the processing results to the client. However, some interfaces cannot be remotely called in the above way. For example, when calling the cudaStreamAddCallback API remotely, the callback function is a function under the virtual address space of the client application, which cannot be recognized by the server at all. Therefore, after the stream is executed on the server, the execution of the client callback function cannot be triggered.

[0004] For this type of interface, a feasible remote execution method needs to be provided to meet the user's remote execution needs, thereby improving the user experience. Summary of the invention

[0005] The present application provides a method, apparatus, device and storage medium for remote execution of a target interface, so as to solve the technical problem of how to implement remote execution of a target interface.

[0006] In a first aspect, the present application provides a remote execution method of a target interface, the method being applied to a client, the method comprising:

[0007] Hijacking a call request of an application to call a target interface; wherein the call request includes a host callback function and function parameter information of the host callback function;

[0008] Adding a remote procedure call callback function, and sending a remote procedure call request message to the server; wherein the remote procedure call request message includes the call request;

[0009] Receiving a remote procedure call response message sent by the server; wherein the remote procedure call response message is sent by the server after calling a native interface corresponding to the target interface to trigger a stream callback function, and the remote procedure call response message includes the host callback function and the function parameter information;

[0010] The host callback function is executed based on the remote procedure call reply message and the remote procedure call callback function.

[0011] Optionally, the method as described above, executing the host callback function based on the remote procedure call reply message and the remote procedure call callback function, comprises:

[0012] Triggering the execution of the remote procedure call callback function, parsing the host callback function and function parameter information in the remote procedure call response message;

[0013] Based on the function parameter information, the host callback function is executed.

[0014] Optionally, in the method described above, after sending the remote procedure call request message to the server, the method further includes:

[0015] Return result information to the application; wherein the result information is used to indicate that the remote procedure call callback function is added successfully.

[0016] In a second aspect, the present application provides a remote execution method of a target interface, the method being applied to a server, the method comprising:

[0017] Receiving a remote procedure call request message sent by a client; wherein the remote procedure call request message includes a call request, the call request is issued by the application of the client when calling a target interface, and the call request includes a host callback function and function parameter information of the host callback function;

[0018] Based on the remote procedure call request message, a remote procedure call response message is sent to the client; wherein the remote procedure call response message includes the host callback function and the function parameter information; when the client receives the remote procedure call response message, the host callback function is executed.

[0019] Optionally, the method as described above, based on the remote procedure call request message, sending a remote procedure call response message to the server includes:

[0020] Parsing the remote procedure call request message, and saving the host callback function and the function parameter information into the remote procedure call response message;

[0021] Calling the native interface corresponding to the target interface, executing the target stream, and adding a stream callback function;

[0022] After determining that the execution status of the target stream is completed, triggering the execution of the stream callback function, and sending the remote procedure call response message to the client.

[0023] Optionally, the method as described above further comprises:

[0024] Determining a target area for storing the execution result of the target flow;

[0025] The execution result of the target flow is obtained, and the execution result is stored in the target area.

[0026] Optionally, the method as described above further comprises:

[0027] Monitor the execution status of the target flow, and if it is determined that the execution status of the target flow is completed, execute the step of triggering the execution of the flow callback function; wherein the execution status includes completed execution and incomplete execution.

[0028] In a third aspect, the present application provides a remote execution device of a target interface, the device is applied to a client, and the device includes:

[0029] A hijacking unit, used to hijack a call request of an application to call a target interface; wherein the call request includes a host callback function and function parameter information of the host callback function;

[0030] A processing unit, configured to add a remote procedure call callback function and send a remote procedure call request message to a server; wherein the remote procedure call request message includes the call request;

[0031] A receiving unit, configured to receive a remote procedure call response message sent by the server; wherein the remote procedure call response message is sent by the server after the server triggers a stream callback function after calling a native interface corresponding to the target interface, and the remote procedure call response message includes the host callback function and the function parameter information;

[0032] An execution unit is used to execute the host callback function based on the remote procedure call response message and the remote procedure call callback function.

[0033] In a fourth aspect, the present application provides a remote execution device of a target interface, the device is applied to a server, and the device includes:

[0034] A receiving unit, configured to receive a remote procedure call request message sent by a client; wherein the remote procedure call request message includes a call request, the call request is issued by an application of the client when calling a target interface, and the call request includes a host callback function and function parameter information of the host callback function;

[0035] A response unit, used for sending a remote procedure call response message to the client based on the remote procedure call request message; wherein the remote procedure call response message includes the host callback function and the function parameter information; when the client receives the remote procedure call response message, the host callback function will be executed.

[0036] In a fifth aspect, the present application provides an electronic device, the electronic device comprising: a processor, and a memory communicatively connected to the processor;

[0037] The memory stores computer-executable instructions;

[0038] The processor executes the computer-executable instructions stored in the memory to implement the aforementioned method.

[0039] In a sixth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to implement the method as described above when executed by a processor.

[0040] In a sixth aspect, the present application provides a computer program product, including a computer program, which is used to implement the method as described above when executed by a processor.

[0041] The present application provides a remote execution method, apparatus, device and storage medium for a target interface, wherein one method is applied to a client, and the method comprises: hijacking a call request of an application to call a target interface; wherein the call request comprises a host callback function and function parameter information of the host callback function; adding a remote procedure call callback function, and sending a remote procedure call request message to a server; wherein the remote procedure call request message comprises the call request; receiving a remote procedure call response message sent by the server; wherein the remote procedure call response message is sent by the server after triggering a stream callback function after calling a native interface corresponding to the target interface, and the remote procedure call response message comprises the host callback function and the function parameter information; and executing the host callback function based on the remote procedure call response message and the remote procedure call callback function. By adding a remote procedure call callback function and the execution logic of the remote procedure call callback function, the problem of how to implement the remote call of the target interface is solved, and the remote execution of the target interface is realized. After the target stream on the server is executed, the callback function specified by the application can be executed on the client, which can achieve the same effect as calling the local interface, and realizes the purpose of remotely using the server's GPU computing resources on the client without GPU resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0043] Figure 1 A schematic diagram of the architecture of a remote calling system provided in an embodiment of the present application;

[0044] Figure 2 A flowchart of a remote execution method of a target interface provided in an embodiment of the present application;

[0045] Figure 3 A flowchart of another method for remote execution of a target interface provided in an embodiment of the present application;

[0046] Figure 4 A signaling flow chart of a remote execution method for implementing a target interface provided in an embodiment of the present application;

[0047] Figure 5 A schematic diagram of the structure of a remote execution device of a target interface provided in an embodiment of the present application;

[0048] Figure 6 A schematic diagram of the structure of a remote execution device of another target interface provided in an embodiment of the present application;

[0049] Figure 7A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0050] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0051] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0052] Graphics Processing Unit (GPU) is an expensive computing resource. If it can only be used exclusively by applications on the physical machine where it is deployed, its utilization rate is usually low, and the computing power cannot be fully utilized, resulting in waste. In order to improve the resource utilization of graphics processor GPU, one feasible solution is to use the physical machine with GPU deployed as the server to provide GPU computing services to clients without GPU deployed.

[0053] For example, Figure 1 This is a schematic diagram of the architecture of a remote call system provided in an embodiment of the present application. Figure 1 As shown, the client 100 is connected to the server 200 through a network, and the server 200 can provide GPU computing services for the client 100. Specifically, a customized unified computing device architecture interface cuda api is implemented on the client 100, and these unified computing device architecture interfaces have the same format definition and external processing logic as the native unified computing device architecture interface cuda api of the server 200. Accordingly, usually when making an interface call, the client 100 only needs to forward the call request of the hijacked application (application, app) to the server 200 through a remote procedure call (Remote Procedure Call, RPC), and the server 200 will process the call request and return the result to the client 100, and the client 100 will return the result to the application that initiated the call request.

[0054] Take the api: cudaError_t cudaSetDevice(int device) as an example: if a remote device is equipped with multiple GPUs, when calling this interface, it will determine which GPU to use based on the needs and carry it in the parameter device value, so that the client sends the device value to the server, calls the native interface on the server and obtains the return value, then transmits the return value back to the client, and the client returns the return value to the application. At this point, it can be guaranteed that the client application can get the same result when calling this interface and calling the native cuda api, realizing the remote call of this interface.

[0055] However, some interfaces cannot be called remotely in the above way, for example, cudaStreamAddCallbackapi, the purpose of this interface is to add a host callback function to the stream and trigger the added callback after the stream processing is completed. Among them, stream is a set of operation sequences, the operations in the queue will be executed in the order of adding to the stream, operations on multiple streams can be executed concurrently, and stream supports asynchronous processing. Operations on different streams can be executed at the same time, and stream gives a GPU the ability to run multiple kernel functions simultaneously. In this application, stream is literally translated as "stream". callback represents the callback function to be executed, and callbackArg represents the parameters of the callback function.

[0056] In a remote scenario, based on the above method, when the client application wants to call the interface, it only needs to send parameters such as stream / callback / callbackArg to the server, and the server will call the native interface to execute. However, the callback function added by the application here is a function under the virtual address space of the client application, which cannot be recognized by the server at all. Therefore, after the stream is executed on the server, the execution of the client callback function cannot be triggered. How to implement remote calls of this type of interface to achieve the same effect of calling the remote interface and the local interface has become a problem to be solved.

[0057] In order to solve the above problems, the present application provides a remote execution method of a target interface. When the client hijacks the application's call request for a target interface such as the "cudaStreamAddCallback api", a remote procedure call callback function is added, and a remote procedure call request message is sent to the server, which is received and executed. At the same time, a stream callback function is added to trigger the stream callback function after determining that the target stream execution is completed, and then the host callback function and callback function parameters in the call request are sent back to the client as a remote procedure call reply message. After receiving the remote procedure call reply message, the client triggers the execution of the remote procedure call callback function, thereby realizing the execution of the host callback function. This method can realize the remote call of the interface and achieve the same effect as calling the local interface, thereby solving the execution problem of the host callback function in the remote call.

[0058] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0059] Figure 2 A flowchart of a remote execution method of a target interface provided in an embodiment of the present application. The method provided in this embodiment is used on a client, and its execution subject can be a client or a remote execution device of a target interface located on the client. The embodiment of the present application is described in detail by taking the execution subject as a client as an example.

[0060] like Figure 2 As shown, the remote execution method of the target interface provided in this embodiment includes:

[0061] S201. Hijack a call request of an application to call a target interface; wherein the call request includes a host callback function and function parameter information of the host callback function.

[0062] Exemplarily, a hijacking module may be provided on the client, and the hijacking module of the client is used to hijack the call request issued by the application when the application calls the target interface. This application takes the target interface as the cuda Stream AddCallback api as an example, and thus, the call request at least includes the host callback function hostCallback and the function parameter information hostCallbackArg of the host callback function. In addition, the call request may also include other information, such as the target stream stream that needs to be executed on the server.

[0063] Among them, the host callback function hostCallback is a function under the client application virtual address space, and is a specified function passed in by the application. This application does not limit the specific content of the host callback function and the function parameter information of the host callback function.

[0064] S202: Add a remote procedure call callback function and send a remote procedure call request message to the server; wherein the remote procedure call request message includes a call request.

[0065] For example, after hijacking the call request of the application to call the target interface, the client will add a remote procedure call callback function (i.e., RPC callback function) and send the remote procedure call request message containing the call request to the server for subsequent processing by the server. Among them, the remote procedure call callback function will be triggered and executed when the client receives the remote procedure call reply message, and its role is to parse and process the remote procedure call reply message to realize the execution of the host callback function.

[0066] In some examples, after sending the remote procedure call request message to the server, the following may also be included:

[0067] Return result information to the application; wherein the result information is used to indicate that the remote procedure call callback function is added successfully.

[0068] Exemplarily, after sending a remote procedure call request message to the server, the client may also return result information to the application indicating that the remote procedure call callback function has been added successfully, so that the application can perform other processing based on the result information, and the client does not need to use other resource-consuming methods to determine whether the application's call request is sent successfully, thereby reducing the application's occupation of client resources. Subsequently, the client can have more resources to handle other transactions, thereby improving the client's transaction processing efficiency.

[0069] S203, receiving a remote procedure call response message sent by the server; wherein the remote procedure call response message is sent by the server after calling the native interface corresponding to the target interface and triggering the stream callback function, and the remote procedure call response message includes the host callback function and function parameter information.

[0070] For example, after receiving the remote procedure call request message sent by the client, the server will call the native interface corresponding to the target interface based on the remote procedure call request message to obtain the processing result, and send a remote procedure call response message including the host callback function and function parameter information to the client after the processing is completed. The client receives the remote procedure call response message sent by the server after processing the call task based on the remote procedure call request message, so that the client can perform subsequent processing.

[0071] Among them, this application does not limit the process of how the server processes the remote procedure call request message, and one example is described in detail in the subsequent embodiments.

[0072] S204: Execute the host callback function based on the remote procedure call response message and the remote procedure call callback function.

[0073] Exemplarily, after the client receives the remote procedure call response message, it can execute the host callback function based on the remote procedure call response message and the remote procedure call callback function, thereby completing the remote execution of the target interface, and achieving the purpose of executing the callback function specified by the application on the client after the target flow execution on the server is completed.

[0074] In one example, executing the host callback function based on the remote procedure call reply message and the remote procedure call callback function may include:

[0075] S1. Trigger the execution of the remote procedure call callback function, and parse the host callback function and function parameter information in the remote procedure call response message.

[0076] S2. Execute the host callback function based on the function parameter information.

[0077] Exemplarily, when the client receives a remote procedure call response message, it triggers the execution of the remote procedure call callback function, thereby parsing the host callback function and function parameter information of the host callback function in the remote procedure call response message, and then controlling the execution of the host callback function according to the function parameter information.

[0078] The remote execution method of the target interface provided by the embodiment of the present application includes: hijacking the call request of the application to call the target interface; wherein the call request includes the host callback function and the function parameter information of the host callback function; adding a remote procedure call callback function, and sending a remote procedure call request message to the server; wherein the remote procedure call request message includes the call request; receiving a remote procedure call reply message sent by the server; wherein the remote procedure call reply message is sent by the server after the stream callback function is triggered after calling the native interface corresponding to the target interface, and the remote procedure call reply message includes the host callback function and the function parameter information; based on the remote procedure call reply message and the remote procedure call callback function, the host callback function is executed. The scheme of the present application solves the problem of how to implement the remote call of the target interface by adding a remote procedure call callback function and the execution logic of the remote procedure call callback function, and realizes the remote execution of the target interface. After the target stream execution on the server is completed, the callback function specified by the application can be executed on the client, which can achieve the same effect as calling the local interface, and realizes the purpose of remotely using the GPU computing power resources of the server on the client without GPU resources.

[0079] Figure 3 A flowchart of another method for remote execution of a target interface provided in an embodiment of the present application. The method provided in this embodiment is used on a server, and its execution subject can be a server or a remote execution device of a target interface located on the server. The embodiment of the present application is described in detail by taking the execution subject as a server as an example.

[0080] like Figure 3 As shown, the remote execution method of the target interface provided in this embodiment includes:

[0081] S301. Receive a remote procedure call request message sent by a client; wherein the remote procedure call request message includes a call request, which is issued by an application of the client when calling a target interface, and includes a host callback function and function parameter information of the host callback function.

[0082] For example, when implementing remote execution of the target interface, the client receives a call request for the target interface from the application, and puts the host callback function and function parameter information of the host callback function included in the call request into a remote procedure call request message, and then sends the remote procedure call request message to the server that provides remote GPU computing resources. The server receives the remote procedure call request message sent by the client.

[0083] S302. Based on the remote procedure call request message, a remote procedure call response message is sent to the client; wherein the remote procedure call response message includes a host callback function and function parameter information; when the client receives the remote procedure call response message, the host callback function is executed.

[0084] Exemplarily, when the server receives a remote procedure call request message, it processes it based on the remote procedure call request message and sends a remote procedure call response message to the client, so that after the client receives the remote procedure call response message, it can execute the host callback function based on the host callback function and function parameter information included in the remote procedure call response message.

[0085] In one example, based on the remote procedure call request message, sending a remote procedure call response message to the client may include:

[0086] S10. Parse the remote procedure call request message, and save the host callback function and function parameter information into the remote procedure call response message.

[0087] S20. Call the native interface corresponding to the target interface, execute the target flow, and add a flow callback function.

[0088] S30. After determining that the execution status of the target stream is completed, trigger the execution of the stream callback function and send a remote procedure call response message to the client.

[0089] Exemplarily, the server parses the remote procedure call request message, and can obtain the call request contained in the remote procedure call request message, as well as the host callback function and the function parameter information of the host callback function contained in the call request. The server of this application saves the function parameter information of the host callback function and the host callback function in the remote procedure call response message. In addition, the call request may also include the target stream that needs to be executed on the server, and the target stream is also the stream. Then, after the server parses the remote procedure call request message, based on the call request, the native interface corresponding to the target interface on the server is called, the target stream is executed, and the stream callback function is added. Among them, the stream callback function is a function callback added by cudaStreamAddCallback(stream, callback, userData, flags), userData is the parameter of the added function callback, and the stream callback function will be triggered and executed after all events on the stream are executed. Its function is to trigger the remote procedure callback response (RPC response). The server of the present application will also trigger the execution of the added stream callback function after determining that the execution status of the target stream is completed, thereby sending a remote procedure call response message to the client including the host callback function sent by the client and the function parameter information of the host callback function.

[0090] After executing the event in the target stream, the server will obtain the corresponding execution result. Therefore, in an example, the solution of the present application may also include:

[0091] S100: Determine a target area for storing execution results of a target flow.

[0092] S200: Obtain the execution result of the target flow, and save the execution result in the target area.

[0093] Exemplarily, the execution result obtained by the server when executing the target stream will be used by the client, but the time when the client uses the execution result is uncertain. Therefore, in order to reduce the occupation of client memory resources by the execution result, the server can also determine a target area for storing the execution result of the target stream when executing the events in the target stream. After obtaining the execution result of the target stream, the execution result is first saved in the target area, and the client obtains it from the server when using the execution result, thereby reducing the occupation of client memory resources by the execution result.

[0094] In one example, to trigger the execution of the stream callback function after determining that the execution status of the target stream is completed, it is also necessary to determine the execution status of the target stream. Therefore, the solution of the present application may further include:

[0095] Monitor the execution status of the target flow. If it is determined that the execution status of the target flow is completed, execute the step of triggering the execution of the flow callback function; wherein the execution status includes completed execution and incomplete execution.

[0096] Exemplarily, the GPU resources that the server can provide are also limited. When the GPU resources are occupied by other devices, the newly received call request of the server will not be processed immediately, and it will take a certain amount of time to wait. In addition, the server uses GPU resources to process the call request, and it also takes a certain amount of time to execute the target flow. Therefore, the execution status of the target flow may be completed or incomplete, and when the execution is incomplete, it may be in a waiting state or in execution. In order to accurately trigger the flow callback function, the server can also monitor the execution status of the target flow, and when it is determined that the execution status of the target flow is completed, execute the steps of triggering the execution of the flow callback function, thereby improving the processing accuracy.

[0097] The remote execution method of the target interface provided by the embodiment of the present application includes: receiving a remote procedure call request message sent by a client; wherein the remote procedure call request message includes a call request, which is issued by the client application when calling the target interface, and the call request includes a host callback function and function parameter information of the host callback function; based on the remote procedure call request message, a remote procedure call reply message is sent to the server; wherein the remote procedure call reply message includes the host callback function and function parameter information; when the client receives the remote procedure call reply message, the host callback function is executed. The solution of the present application solves the problem of how to implement the remote call of the target interface and implements the remote execution of the target interface, which can achieve the same effect as calling the local interface and realizes the purpose of remotely using the GPU computing resources of the server on the client without GPU resources.

[0098] Figure 4 The signaling flow chart of a remote execution method for implementing a target interface provided by an embodiment of the present application. Figure 4 As shown, the process of implementing remote execution of the target interface may include:

[0099] S401. The client application initiates a call request to the target interface, and the hijacking module hijacks the call request.

[0100] The call request includes the host callback function hostCallback and callback function parameter information hostCallbackArg passed in by the application.

[0101] S402: The client's remote procedure call RPC adds a remote procedure callback function and sends a remote procedure call request message to the server.

[0102] The remote procedure call request message includes a call request to a target interface initiated by an application.

[0103] S403: The client returns result information to the application.

[0104] The result information is used to indicate that the remote procedure call callback function is added successfully.

[0105] S404: The server calls the native interface corresponding to the target interface based on the received remote procedure call request message, executes the target flow, and adds a flow callback function.

[0106] S405. After determining that the target stream has been executed, the server triggers the execution of the stream callback function and sends a remote procedure call response message to the client.

[0107] The remote procedure call response message includes the host callback function hostCallback and function parameter information hostCallbackArg. After the client receives the remote procedure call response message, step S406 is executed.

[0108] S406: The client triggers the execution of the remote procedure callback function.

[0109] S407: Execute the host callback function.

[0110] Based on this, the remote execution of the target interface is realized. This method solves the problem of how to realize the remote call of the target interface. After the target stream on the server is executed, the callback function specified by the application is executed on the client, so that the application calls the remote interface to obtain the same effect as calling the local interface, thereby realizing the purpose of remotely using the server-side GPU computing resources on the client side without GPU resources.

[0111] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0112] Figure 5 A schematic diagram of a remote execution device for a target interface provided in an embodiment of the present application. The remote execution device 50 for a target interface provided in this embodiment is applied to a client, and the device 50 includes a hijacking unit 501 , a processing unit 502 , a receiving unit 503 and an execution unit 504 .

[0113] The hijacking unit 501 is used to hijack the calling request of the application to call the target interface; wherein the calling request includes the host callback function and function parameter information of the host callback function.

[0114] The processing unit 502 is used to add a remote procedure call callback function and send a remote procedure call request message to the server; wherein the remote procedure call request message includes a call request.

[0115] The receiving unit 503 is used to receive a remote procedure call response message sent by the server; wherein the remote procedure call response message is sent by the server after the stream callback function is triggered after calling the native interface corresponding to the target interface, and the remote procedure call response message includes the host callback function and function parameter information;

[0116] The execution unit 504 is used to execute the host callback function based on the remote procedure call response message and the remote procedure call callback function.

[0117] In one example, the execution unit 504 includes a parsing module 5041 and a control module 5042 .

[0118] The parsing module 5041 is used to trigger the execution of the remote procedure call callback function and parse the host callback function and function parameter information in the remote procedure call response message.

[0119] The control module 5042 is used to execute the host callback function based on the function parameter information.

[0120] In one example, the device 50 also includes a sending unit 505.

[0121] The sending unit 505 is used to return result information to the application; wherein the result information is used to indicate that the remote procedure call callback function is added successfully.

[0122] The device provided in this embodiment can be used to execute the method of the above embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.

[0123] Figure 6 A schematic diagram of the structure of another remote execution device of a target interface provided in an embodiment of the present application. The remote execution device 60 of the target interface provided in this embodiment is applied to a server, and the device 60 includes a receiving unit 601 and a responding unit 602 .

[0124] The receiving unit 601 is used to receive a remote procedure call request message sent by a client; wherein the remote procedure call request message includes a call request, which is issued by the client application when calling a target interface, and includes a host callback function and function parameter information of the host callback function.

[0125] The response unit 602 is used to send a remote procedure call response message to the client based on the remote procedure call request message; wherein the remote procedure call response message includes a host callback function and function parameter information; when the client receives the remote procedure call response message, the host callback function will be executed.

[0126] In one example, the response unit 602 includes a parsing and processing module 6021 , a calling module 6022 , and a triggering module 6023 .

[0127] The parsing processing module 6021 is used to parse the remote procedure call request message and save the host callback function and function parameter information into the remote procedure call response message.

[0128] The calling module 6022 is used to call the native interface corresponding to the target interface, execute the target flow, and add a flow callback function.

[0129] The trigger module 6023 is used to trigger the execution of the stream callback function after determining that the execution status of the target stream is completed, and send a remote procedure call response message to the client.

[0130] In one example, the device 60 further includes a storage unit 603 .

[0131] The saving unit 603 is used to determine a target area for saving the execution result of the target flow; obtain the execution result of the target flow, and save the execution result in the target area.

[0132] In one example, the device 60 further includes a monitoring unit 604 .

[0133] The monitoring unit 604 is used to monitor the execution status of the target flow. If it is determined that the execution status of the target flow is completed, the step of triggering the execution of the flow callback function is executed; wherein the execution status includes completed execution and incomplete execution.

[0134] The device provided in this embodiment can be used to execute the method of the above embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.

[0135] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. In addition, it can also be stored in the memory of the above device in the form of program code, and the functions of the above data processing modules can be called and executed by a processing element of the above device. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0136] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device 70 includes: a processor 701, and a memory 702 communicatively connected to the processor.

[0137] The memory 702 stores computer-executable instructions; the processor 701 executes the computer-executable instructions stored in the memory 702 to implement any of the aforementioned methods.

[0138] In the specific implementation of the above electronic device, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The method disclosed in the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in the processor for execution.

[0139] An embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement any of the methods described above.

[0140] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to computer instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0141] An embodiment of the present application also provides a computer program product, including a computer program, which is used to implement any of the aforementioned methods when executed by a processor.

[0142] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0143] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0144] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0145] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0146] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not specifically stated, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.

[0147] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0148] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0149] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0150] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A remote execution method of a target interface, characterized in that: The method is applied to a client, and the method comprises: Hijacking a call request of an application to call a target interface; wherein the call request includes a host callback function and function parameter information of the host callback function; Adding a remote procedure call callback function, and sending a remote procedure call request message to the server; wherein the remote procedure call request message includes the call request; Receiving a remote procedure call response message sent by the server; wherein the remote procedure call response message is sent by the server after calling a native interface corresponding to the target interface to trigger a stream callback function, and the remote procedure call response message includes the host callback function and the function parameter information; The host callback function is executed based on the remote procedure call reply message and the remote procedure call callback function.

2. The method according to claim 1, characterized in that: Executing the host callback function based on the remote procedure call reply message and the remote procedure call callback function includes: Triggering the execution of the remote procedure call callback function, parsing the host callback function and function parameter information in the remote procedure call response message; Based on the function parameter information, the host callback function is executed.

3. The method according to claim 1, characterized in that After sending the remote procedure call request message to the server, the method further includes: Return result information to the application; wherein the result information is used to indicate that the remote procedure call callback function is added successfully.

4. A remote execution method of a target interface, characterized in that: The method is applied to the server, and the method includes: Receiving a remote procedure call request message sent by a client; wherein the remote procedure call request message includes a call request, the call request is issued by the application of the client when calling a target interface, and the call request includes a host callback function and function parameter information of the host callback function; Based on the remote procedure call request message, a remote procedure call response message is sent to the client; wherein the remote procedure call response message includes the host callback function and the function parameter information; when the client receives the remote procedure call response message, the host callback function is executed.

5. The method according to claim 4, characterized in that Based on the remote procedure call request message, sending a remote procedure call response message to the server includes: Parsing the remote procedure call request message, and saving the host callback function and the function parameter information into the remote procedure call response message; Calling the native interface corresponding to the target interface, executing the target stream, and adding a stream callback function; After determining that the execution status of the target stream is completed, triggering the execution of the stream callback function, and sending the remote procedure call response message to the client.

6. The method according to claim 5, characterized in that The method further comprises: Determining a target area for storing the execution result of the target flow; The execution result of the target flow is obtained, and the execution result is stored in the target area.

7. The method according to claim 5, characterized in that The method further comprises: Monitor the execution status of the target flow, and if it is determined that the execution status of the target flow is completed, execute the step of triggering the execution of the flow callback function; wherein the execution status includes completed execution and incomplete execution.

8. A remote execution device for a target interface, characterized in that: The device is applied to a client, and comprises: A hijacking unit, used to hijack a call request of an application to call a target interface; wherein the call request includes a host callback function and function parameter information of the host callback function; A processing unit, configured to add a remote procedure call callback function and send a remote procedure call request message to a server; wherein the remote procedure call request message includes the call request; A receiving unit, configured to receive a remote procedure call response message sent by the server; wherein the remote procedure call response message is sent by the server after the server triggers a stream callback function after calling a native interface corresponding to the target interface, and the remote procedure call response message includes the host callback function and the function parameter information; An execution unit is used to execute the host callback function based on the remote procedure call response message and the remote procedure call callback function.

9. A remote execution device for a target interface, characterized in that: The device is applied to a server, and includes: A receiving unit, configured to receive a remote procedure call request message sent by a client; wherein the remote procedure call request message includes a call request, the call request is issued by an application of the client when calling a target interface, and the call request includes a host callback function and function parameter information of the host callback function; A response unit, used for sending a remote procedure call response message to the client based on the remote procedure call request message; wherein the remote procedure call response message includes the host callback function and the function parameter information; when the client receives the remote procedure call response message, the host callback function will be executed.

10. An electronic device, characterized in that: The electronic device comprises: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 3, or implements the method according to any one of claims 4 to 7.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method according to any one of claims 1 to 3, or to implement the method according to any one of claims 4 to 7.