Method, apparatus, device and computer storage medium for performing machine learning tasks
By creating virtual machines and container instances using a combination of base images and container images on cloud servers, the problem of cumbersome execution steps for machine learning tasks in existing technologies is solved, enabling multiple container instances to run efficiently within the same virtual machine.
Patent Information
- Application Number
- CN201910700673.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-31
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2039-07-31
AI Technical Summary
In existing technologies, executing machine learning tasks in virtual machines on cloud servers is cumbersome and inefficient. The unresolved technical challenge is that virtual machines can only execute one task at a time, leading to cumbersome task switching.
By combining base images and container images, virtual machines are created in cloud servers and container instances are created within them, simplifying the execution steps of machine learning tasks and allowing multiple container instances to run in the same virtual machine.
By simplifying the process and improving efficiency, multiple container instances can run simultaneously in the same virtual machine, thereby improving the execution efficiency of machine learning tasks.
Smart Images

Figure CN110471740B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cloud services, and in particular to a method, device and equipment for executing a machine learning task and a computer storage medium.
BACKGROUND
[0002] Machine learning tasks usually require extremely high data processing capabilities, and therefore users are increasingly using cloud services with stronger performance to implement corresponding machine learning tasks. The method usually adopted by the prior art is that a user uses an image corresponding to a machine learning task provided by a cloud service provider to create a virtual machine in a cloud server, and then completes the corresponding machine learning task in the created virtual machine.
[0003] However, since the prior art integrates all components required for executing a machine learning task into one image, only one machine learning task can be executed in the virtual machine created by the image, and if another machine learning task is to be executed, the established virtual machine needs to be deleted and a virtual machine is created again by selecting an image corresponding to the new task, so the steps for executing a machine learning task are cumbersome and inefficient.
SUMMARY
[0004] Therefore, the present application provides a method, device and equipment for executing a machine learning task and a computer storage medium, which are used to simplify the execution steps of a machine learning task and improve the execution efficiency of a machine learning task.
[0005] The technical solution adopted by the present application to solve the technical problem is to provide a method for executing a machine learning task, which comprises the following steps: after a server end obtains a machine learning task, determining a basic image; determining a container image corresponding to the basic image and obtaining a container image corresponding to the machine learning task from the container image as a creation image; creating a virtual machine in a cloud server by using the basic image and creating a container instance in the virtual machine by using the creation image; after mounting data corresponding to the machine learning task to the container instance, starting the container instance to start executing the machine learning task.
[0006] According to a preferred embodiment of the present application, the basic image contains a configuration template of an operating system, pre-installed applications and a graphic processing unit (GPU) driver.
[0007] According to a preferred embodiment of the present application, the step of the server end determining a basic image comprises the following step: selecting an image from a preset general basic image.
[0008] According to a preferred embodiment of the present application, if the number of machine learning tasks is one, the server end determines one base image by: obtaining attribute information of the machine learning task; and determining one base image corresponding to the attribute information.
[0009] According to a preferred embodiment of the present application, the container image contains a configuration template of a machine learning framework, a machine learning library and a Compute Unified Device Architecture (CUDA).
[0010] According to a preferred embodiment of the present application, the determination of the container image corresponding to the base image comprises: obtaining a version of a GPU driver in the base image; determining a version of CUDA corresponding to the version of the GPU driver; and determining a container image containing the version of CUDA.
[0011] According to a preferred embodiment of the present application, the obtaining of the container image corresponding to the machine learning task as a creation image comprises: obtaining a type of the machine learning task; and obtaining an image corresponding to the type in the determined container image as a creation image.
[0012] According to a preferred embodiment of the present application, after the starting of the container instance, the method further comprises: mounting GPUs corresponding to the virtual machine as hardware into the container instance.
[0013] According to a preferred embodiment of the present application, the mounting of the GPUs corresponding to the virtual machine as hardware into the container instance comprises: if the number of container instances is one, mounting all GPUs corresponding to the virtual machine into the container instance; or if the number of container instances is more than one, mounting the GPUs corresponding to the virtual machine into each container instance according to the principle that at least one GPU is mounted in each container instance.
[0014] The present application provides an apparatus for executing a machine learning task, which is located at a server end and comprises: a determination unit configured to determine a base image after obtaining a machine learning task; a processing unit configured to determine a container image corresponding to the base image, and obtain a container image corresponding to the machine learning task as a creation image; a creation unit configured to create a virtual machine in a cloud server by using the base image, and create a container instance in the virtual machine by using the creation image; and an execution unit configured to start the container instance to begin executing the machine learning task after mounting data corresponding to the machine learning task into the container instance.
[0015] According to a preferred embodiment of the present application, the base image contains a configuration template of an operating system, a pre-installed application and a Graphics Processing Unit (GPU) driver.
[0016] According to a preferred embodiment of the present application, when determining a base image, the determining unit specifically performs: selecting an image from a preset general base image.
[0017] According to a preferred embodiment of the present application, when the number of machine learning tasks is one, the determining unit specifically performs: obtaining attribute information of the machine learning task; and determining a base image corresponding to the attribute information when determining a base image.
[0018] According to a preferred embodiment of the present application, the container image contains a configuration template of a machine learning framework, a machine learning library and a CUDA.
[0019] According to a preferred embodiment of the present application, when determining a container image corresponding to the base image, the processing unit specifically performs: obtaining a version of a GPU driver in the base image; determining a version of CUDA corresponding to the version of the GPU driver; and determining a container image containing the version of CUDA.
[0020] According to a preferred embodiment of the present application, when obtaining a container image corresponding to the machine learning task as a creation image, the processing unit specifically performs: obtaining a type of the machine learning task; and taking an image corresponding to the type in the determined container image as the creation image.
[0021] According to a preferred embodiment of the present application, after starting the container instance, the executing unit further performs: mounting GPUs corresponding to the virtual machine as hardware into the container instance.
[0022] According to a preferred embodiment of the present application, when mounting GPUs corresponding to the virtual machine as hardware into the container instance, the executing unit specifically performs: if the number of container instances is one, mounting all GPUs corresponding to the virtual machine into the container instance; or if the number of container instances is greater than one, mounting GPUs corresponding to the virtual machine into each container instance according to the principle that at least one GPU is mounted in each container instance.
[0023] It can be seen from the above technical solution that, after obtaining the machine learning task, the application first determines a base image, then determines the container image corresponding to the base image, and selects the creation image corresponding to the machine learning task from the container image. After creating the virtual machine by using the base image and creating the container instance in the virtual machine by using the creation image, the machine learning task runs in the created container instance, thereby simplifying the execution steps of the machine learning task. Since the base image + container image mode is used to execute the machine learning task, multiple container instances can run in the same virtual machine simultaneously, thereby improving the execution efficiency of the machine learning task. BRIEF DESCRIPTION OF DRAWINGS
[0024] Figure 1 A method flowchart for executing a machine learning task is provided for an embodiment of the application.
[0025] Figure 2 A device structure diagram for executing a machine learning task is provided for an embodiment of the application.
[0026] Figure 3 A block diagram of a computer system / server is provided for an embodiment of the application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of the application clearer, the application is described in detail below with reference to the drawings and specific embodiments.
[0028] The terms used in the embodiments of the application are only for the purpose of describing specific embodiments and are not intended to limit the application. The singular forms "a", "an" and "the" used in the embodiments of the application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.
[0029] It should be understood that the term "and / or" used herein is only used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which means that there are three cases of A alone, A and B together, and B alone. In addition, the character " / " in this paper generally represents that the front and rear associated objects are a "or" relationship.
[0030] Depending on the context, the word "if" as used herein can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting". Similarly, depending on the context, the phrase "if it is determined" or "if (a stated condition or event) is detected" can be interpreted as "when it is determined" or "in response to determining" or "when (a stated condition or event) is detected" or "in response to detecting (a stated condition or event)".
[0031] Figure 1 A method flowchart for performing a machine learning task is provided for an embodiment of the present application, as shown in Figure 1 The method comprises the following steps:
[0032] In 101, the server side determines a base image after obtaining a machine learning task.
[0033] In this step, the server side determines a base image after obtaining a request for processing a machine learning task. It can be understood that the server side in the embodiment of the present application is a cloud service provider capable of creating a virtual machine in a cloud server and performing a machine learning task. In addition, the number of machine learning tasks obtained in this step is not limited, and can be one or more.
[0034] In this step, the base image determined by the server side is used to create a virtual machine in the cloud server, and one or more container instances are run in the virtual machine. The base image contains an operating system, a pre-installed application, and a configuration template of a GPU (Graphics Processing Unit, graphics processor) driver.
[0035] It can be understood that a general base image can be preset in the cloud server, which can meet the needs of most machine learning tasks. Therefore, the server side can randomly select a base image from the general base image after obtaining a machine learning task, for example, selecting a general base image when multiple machine learning tasks are obtained.
[0036] In addition, if the server side only receives one machine learning task, the server side can also determine a base image in the following way when determining a base image: the server side obtains attribute information of the machine learning task, and the obtained attribute information can be type information of the machine learning task, configuration information required by the machine learning task, etc.; determine a base image corresponding to the obtained attribute information. That is, different base images can be determined for different machine learning tasks in this step, so as to further ensure that the determined base image can meet the needs of the machine learning task.
[0037] In 102, a container image corresponding to the base image is determined, and a container image corresponding to the machine learning task is obtained therefrom as a creation image.
[0038] In this step, first, the container image corresponding to the base image determined in step 101 is determined, and then the container image corresponding to the machine learning task is selected from the determined container image as the creation image, and the determined creation image is used to create the container instance corresponding to the machine learning task. It can be understood that if multiple machine learning tasks are obtained in step 101, the corresponding number of creation images will be obtained in this step.
[0039] Preferably, the container image in the embodiment of the application is a Docker image, and the created container instance is a Docker instance.
[0040] In this step, the container image determined in this step is used to create the container instance corresponding to the machine learning task, and the container image contains the configuration template of the required components of the machine learning task, wherein the required components include machine learning framework, machine learning library, CUDA (Compute Unified Device Architecture, Unified Computing Device Architecture) and the like.
[0041] Since the embodiment of the application adopts the mode of running the container instance in the virtual machine to process the machine learning task, if the version of the GPU driver used to create the virtual machine does not match the version of the CUDA used to create the container instance, it will cause the GPU to fail to be successfully used to process the machine learning task.
[0042] Therefore, when determining the container image corresponding to the base image, the following mode can be adopted: obtaining the version of the GPU driver in the determined base image; determining the version of the CUDA corresponding to the obtained version of the GPU driver; and determining the container image containing the determined version of the CUDA.
[0043] In addition, when determining the container image corresponding to the base image, the following mode can also be adopted: obtaining the identification information of the determined base image, such as obtaining the name, number and the like of the base image; according to the preset correspondence relationship, the image corresponding to the obtained identification information is determined as the container image, and the correspondence relationship contains the identification information of each base image and the corresponding container image thereof.
[0044] After the container image corresponding to the base image is determined, since different container images support different machine learning tasks, in order to ensure that the machine learning task can run smoothly in the created container instance, the image corresponding to the machine learning task needs to be further determined from the container image.
[0045] Specifically, when the container image corresponding to the machine learning task is obtained as the creation image, the following method can be adopted: obtaining the type of the machine learning task; and taking the image corresponding to the obtained type in the determined container image as the creation image. It can be understood that if multiple container images corresponding to the machine learning task are obtained in this step, one of them is randomly selected as the creation image.
[0046] In addition, if the base image is determined by the attribute information of the machine learning task in step 101, the container image corresponding to the base image can be determined as corresponding to the machine learning task by default in this step.
[0047] In 103, a virtual machine is created in the cloud server by using the base image, and a container instance is created in the virtual machine by using the creation image.
[0048] In this step, a virtual machine is first created in the cloud server by using the base image determined in step 101, and then a container instance is created in the created virtual machine by using the creation image determined in step 102.
[0049] It can be understood that if multiple creation images are obtained in step 102, the number of container instances corresponding to the number of machine learning tasks to be executed can be created in the created virtual machine. The creation of the virtual machine by using the base image and the creation of the container instance in the virtual machine by using the creation image belong to the prior art, and will not be described here.
[0050] In 104, after the data corresponding to the machine learning task is mounted to the container instance, the container instance is started to begin executing the machine learning task.
[0051] In this step, the data corresponding to the machine learning task is first obtained, and then the container instance is started to begin executing the corresponding machine learning task after the obtained data is mounted to the container instance created in step 103.
[0052] It can be understood that if multiple machine learning tasks, such as data training tasks or data computing tasks, are obtained in step 101, the data corresponding to each machine learning task is obtained in this step, and then the obtained data is mounted to the corresponding container instance.
[0053] Further, after the container instance is started in the virtual machine, the GPU corresponding to the created virtual machine can be mounted to the container instance as hardware, so that the machine learning task can successfully use the GPU when the machine learning task is running in the container instance.
[0054] Specifically, when mounting the GPU corresponding to the virtual machine as hardware into the container instance, the following methods can be adopted: if the number of container instances is one, all GPUs corresponding to the virtual machine are mounted into the container instance; if the number of container instances is more than one, the GPUs corresponding to the virtual machine are mounted into each container instance according to the principle that at least one GPU is mounted in each container instance.
[0055] In addition, when mounting the GPU into the container instance, the number of GPUs mounted into the container instance can also be determined according to the amount of data running in each container instance. For example, if the number of started container instances is 2 and the number of GPUs corresponding to the virtual machine is 3, 2 GPUs can be mounted in the container instance running a larger amount of data, and 1 GPU can be mounted in the container instance running a smaller amount of data.
[0056] It can be understood that if the number of GPUs corresponding to the virtual machine is less than the number of running container instances, the step can prompt the user to suspend one or more container instances, and restart the suspended container instance after the other container instances are running, so as to complete the entire machine learning task.
[0057] Figure 2 A device structure diagram for performing a machine learning task provided by an embodiment of the present application is shown in Figure 2 The device includes a determination unit 21, a processing unit 22, a creation unit 23, and an execution unit 24.
[0058] The determination unit 21 is configured to determine a base image after obtaining a machine learning task.
[0059] The determination unit 21 determines a base image after obtaining a request to process a machine learning task. It can be understood that the server side in the embodiment of the present application is a cloud service provider capable of creating a virtual machine in a cloud server and performing a machine learning task. In addition, the number of machine learning tasks obtained by the determination unit 21 is not limited, and can be one or more.
[0060] The base image determined by the determination unit 21 is used to create a virtual machine in a cloud server, and one or more container instances are run in the virtual machine. The base image contains a configuration template of an operating system, a pre-installed application, and a GPU driver.
[0061] It can be understood that a general base image can be preset in the cloud server, and the general base image can meet the requirements of most machine learning tasks. Therefore, the determination unit 21 can randomly select a base image from the general base image after obtaining the machine learning task, for example, selecting a general base image when multiple machine learning tasks are obtained.
[0062] In addition, if the server side only receives one machine learning task, the determination unit 21 can also use the following method when determining a base image: the server side obtains attribute information of the machine learning task; determine a base image corresponding to the obtained attribute information. That is, the determination unit 21 can determine different base images for different machine learning tasks, so as to further ensure that the determined base image can meet the requirements of the machine learning task.
[0063] The processing unit 22 is configured to determine a container image corresponding to the base image, and obtain a container image corresponding to the machine learning task from the container image as a creation image.
[0064] The processing unit 22 first determines a container image corresponding to the base image determined by the determination unit 21, and then selects a container image corresponding to the machine learning task from the container image as a creation image, and the determined creation image is used to create a container instance of the machine learning task. It can be understood that if the determination unit 21 obtains multiple machine learning tasks, the processing unit 22 will obtain a corresponding number of creation images.
[0065] Preferably, the container image in the embodiment of the application is a Docker image, and the created container instance is a Docker instance.
[0066] The container image determined by the processing unit 22 is used to create a container instance corresponding to the machine learning task, and the container image contains a configuration template of a required component of the machine learning task, wherein the required component includes a machine learning framework, a machine learning library, a CUDA and the like.
[0067] Since the embodiment of the application uses a method of running a container instance in a virtual machine to process a machine learning task, if the version of the GPU driver used to create the virtual machine does not match the version of the CUDA used to create the container instance, it will cause the GPU to be unable to successfully process the machine learning task.
[0068] Therefore, the processing unit 22 can use the following method when determining a container image corresponding to the base image: obtaining the version of the GPU driver in the determined base image; determining the version of the CUDA corresponding to the obtained version of the GPU driver; and determining a container image containing the determined version of the CUDA.
[0069] In addition, the processing unit 22 can also adopt the following manner when determining the container image corresponding to the base image: obtaining the identification information of the determined base image; determining the image corresponding to the obtained identification information as the container image according to the preset correspondence relationship, wherein the correspondence relationship contains the identification information of each base image and its corresponding container image.
[0070] After determining the container image corresponding to the base image, since different container images support different machine learning tasks, in order to ensure that the machine learning task can run smoothly in the created container instance, the processing unit 22 needs to further determine the image corresponding to the machine learning task from the container images.
[0071] Specifically, when the processing unit 22 obtains the container image corresponding to the machine learning task as the creation image, it can adopt the following manner: obtaining the type of the machine learning task; determining the image corresponding to the obtained type in the determined container image as the creation image. It can be understood that if the processing unit 22 obtains multiple container images corresponding to the machine learning task, it randomly selects one as the creation image.
[0072] In addition, if the determination unit 21 determines a base image through the attribute information of the machine learning task, the processing unit 22 can default that the container image corresponding to the base image also corresponds to the machine learning task.
[0073] The creation unit 23 is configured to create a virtual machine in the cloud server by using the base image, and create a container instance in the virtual machine by using the creation image.
[0074] The creation unit 23 first creates a virtual machine in the cloud server by using the base image determined by the determination unit 21, and then creates a container instance in the created virtual machine by using the creation image determined by the processing unit 22.
[0075] It can be understood that if the processing unit 22 obtains multiple creation images, the creation unit 23 will create a corresponding number of container instances in the created virtual machine to execute different machine learning tasks respectively. Creating a virtual machine by using a base image and creating a container instance in a virtual machine by using a creation image belong to the prior art, and will not be described here.
[0076] The execution unit 24 is configured to start the container instance to start executing the machine learning task after mounting the data corresponding to the machine learning task to the container instance.
[0077] Execution unit 24 first obtains the data corresponding to the machine learning task, and then mounts the obtained data to the container instance created by creation unit 23, and starts the container instance to begin executing the corresponding machine learning task.
[0078] Understandably, if the determination unit 21 acquires multiple machine learning tasks at the same time, such as data training tasks or data computation tasks, the execution unit 24 will acquire the data corresponding to each machine learning task, and then mount the acquired data to the corresponding container instance.
[0079] Furthermore, after the execution unit 24 starts the container instance in the virtual machine, it can also mount the GPU corresponding to the created virtual machine as hardware into the container instance, so that when the machine learning task is run in the container instance, the machine learning task can successfully use the GPU.
[0080] Specifically, when the execution unit 24 mounts the GPU corresponding to the virtual machine as hardware to the container instance, it can do so in the following way: if there is only one container instance, then all GPUs corresponding to the virtual machine are mounted to the container instance; if there is more than one container instance, then the GPUs corresponding to the virtual machine are mounted to each container instance respectively, according to the principle that at least one GPU is mounted in each container instance.
[0081] In addition, when mounting the GPU to a container instance, the execution unit 24 can also determine the amount of data being processed by each container instance.
[0082] Understandably, if the number of GPUs corresponding to the virtual machine is less than the number of running container instances, the execution unit 24 can prompt the user to pause the running of one or more container instances, and then restart the paused container instance after the other container instances have finished running, thereby completing all the machine learning tasks.
[0083] like Figure 3 As shown, the computer system / server 012 is represented in the form of a general-purpose computing device. The components of the computer system / server 012 may include, but are not limited to: one or more processors or processing units 016, system memory 028, and a bus 018 connecting different system components (including system memory 028 and processing unit 016).
[0084] Bus 018 is representative of one or more of various bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration bus, a processor or local bus using any of a variety of bus structures, and the like. For example, these can include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0085] Computer system / server 012 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer system / server 012 and includes both volatile and non-volatile media, removable and non-removable media.
[0086] System memory 028 can include computer system readable media in the form of volatile memory, such as random access memory (RAM) 030 and / or cache memory 032. Computer system / server 012 can further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 034 can be provided for reading from and writing to a non-removable, non-volatile magnetic media (i.e., a "hard drive"). Figure 3 not shown, a magnetic hard disk drive for reading from and writing to non-removable, non-volatile magnetic media (e.g., a "hard drive"). Figure 3 not shown, a magnetic hard disk drive for reading from and writing to non-removable, non-volatile magnetic media (e.g., a "hard drive").
[0087] Program / utility 040 having a set (at least one) of program modules 042 can be stored in, for example, memory 028 by way of example, such program modules 042 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of or some combination of which can include implementation of a networking environment. Program modules 042 generally carry out the functions and / or methodologies of embodiments of the application as described herein.
[0088] The computer system / server 012 can also communicate with one or more external devices 014 such as a keyboard or a pointing device, displays 024, etc. One or more devices enabling a user to interact with the computer system / server 012 and / or one or more devices enabling the computer system / server 012 to communicate with one or more other computing devices. Such communication can be via Input / Output (I / O) interfaces 022. Still yet, the computer system / server 012 can communicate with one or more networks, such as a local area network (LAN), a general wide area network (WAN), and / or a public network, such as the Internet, via network adapter 020. As depicted, network adapter 020 communicates with the other components of the computer system / server 012 via bus 018. It should be understood that although not shown, other hardware and / or software components could be used in conjunction with the computer system / server 012. Examples, include, but are not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.
[0089] The processing unit(s) 016 can execute instructions stored in the system memory 028 to perform various functions as described herein, including to implement the methods of embodiments of the application.
[0090] As time evolves, technology develops, the media meaning is more and more extensive, the computer program propagation way is no longer limited to the tangible media, but also can be directly downloaded from the network, etc. Any combination of one or more computer readable media can be used. The computer readable media can be computer readable signal media or computer readable storage media. The computer readable storage media, for example, can be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples (non-exhaustive list) of the computer readable storage media include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer readable storage media can be any tangible media that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus or device.
[0091] Computer readable signal media can include a data signal traveling in baseband or alien carrier waves, which encodes a computer readable program code. Such a data signal can take many forms, including but not limited to, electro-magnetic, optical or any suitable combination thereof. Computer readable signal media can also be any computer readable medium that is not a computer readable storage medium and that can be used to carry or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
[0092] The program code contained on a computer readable medium can be transmitted using any suitable medium, including but not limited to wireless, wire line, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0093] Computer program code for carrying out operations of the present application can be written in one or more programming languages or combinations of languages including object oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can 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. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0094] With the technical solutions provided by the present application, after obtaining a machine learning task, a base image is first determined, and then a container image corresponding to the determined base image is determined, and a created image corresponding to the machine learning task is selected from the container image. After a virtual machine is created using the base image and a container instance is created in the virtual machine using the created image, the machine learning task is run in the created container instance, thus simplifying the execution steps of the machine learning task. Since the base image and the container image are used to execute the machine learning task, multiple container instances can be simultaneously run in the same virtual machine, thus improving the execution efficiency of the machine learning task.
[0095] In the several embodiments of the present application, it should be understood that the disclosed system, apparatus, and method can be implemented in other ways. For example, the described device embodiments are merely illustrative. For example, the division of the units is only a logical function division. There can be another division manner in actual implementation.
[0096] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e., may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0097] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.
[0098] The integrated unit realized in the form of software functional unit can be stored in a computer readable storage medium. The software functional unit stored in a storage medium includes a plurality of instructions for making a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor execute part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes a variety of storage media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0099] The above is only the preferred embodiment of the present application, and is not used to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method of performing a machine learning task, the method comprising: The method comprises: The server side determines a base image after obtaining a plurality of machine learning tasks; Determine the container image corresponding to the base image, and obtain the container image corresponding to the plurality of machine learning tasks from the base image as a plurality of creation images, the number of creation images being the same as the number of machine learning tasks; Create a virtual machine in the cloud server using the base image, and create a plurality of container instances in the virtual machine using the plurality of creation images; After mounting the data corresponding to the plurality of machine learning tasks to the corresponding container instances respectively, start the plurality of container instances to start executing the plurality of machine learning tasks; Wherein, the container image corresponding to the plurality of machine learning tasks is obtained from the base image as a plurality of creation images, comprising: For each machine learning task, obtain the type of the machine learning task; Determine the image corresponding to the type in the determined container image as the creation image of the machine learning task.
2. The method of claim 1, wherein, The base image contains an operating system, a pre-installed application, and a configuration template of a graphics processing unit (GPU) driver.
3. The method of claim 1, wherein, The server side determines a base image, which includes selecting an image from a pre-set general base image.
4. The method of claim 1, wherein, If the number of machine learning tasks is one, the server side determines a base image, which includes: Obtain the attribute information of the machine learning task; Determine a base image corresponding to the attribute information.
5. The method of claim 1, wherein, The container image contains a machine learning framework, a machine learning library, and a configuration template of a unified computing device architecture (CUDA).
6. The method of claim 1, wherein, The determination of the container image corresponding to the base image includes: Obtain the version of the GPU driver in the base image; Determine the version of CUDA corresponding to the version of the GPU driver; Determine the container image containing the version of CUDA.
7. The method of claim 1, wherein, After starting the container instance, it also includes mounting the GPU corresponding to the virtual machine as hardware into the container instance.
8. The method of claim 7, wherein, The container instance includes: If the number of container instances is one, mount all GPUs corresponding to the virtual machine into the container instance; If the number of container instances is greater than one, mount the GPUs corresponding to the virtual machine into each container instance according to the principle of mounting at least one GPU in each container instance.
9. An apparatus for performing a machine learning task, the apparatus comprising: The device is located at the server side, comprising: A determination unit for determining a base image after obtaining a plurality of machine learning tasks; A processing unit for determining a container image corresponding to the base image, and obtaining a container image corresponding to the plurality of machine learning tasks from the base image as a plurality of creation images, the number of creation images being the same as the number of machine learning tasks; A creation unit for creating a virtual machine in the cloud server using the base image, and creating a plurality of container instances in the virtual machine using the plurality of creation images; An execution unit for starting the plurality of container instances to start executing the plurality of machine learning tasks after mounting the data corresponding to the plurality of machine learning tasks to the corresponding container instances respectively. The processing unit specifically performs the following operations when obtaining the container images corresponding to the plurality of machine learning tasks respectively as a plurality of created images from the container image repository: For each machine learning task, obtain the type of the machine learning task; Determine the image corresponding to the type in the determined container image as the created image of the machine learning task.
10. The apparatus of claim 9, wherein, The base image contains an operating system, pre-installed applications, and a configuration template of a graphics processing unit (GPU) driver.
11. The apparatus of claim 9, wherein, The determining unit specifically performs the following operation when determining a base image: selecting an image from a preset general base image.
12. The apparatus of claim 9, wherein, If the number of machine learning tasks is one, the determining unit specifically performs the following operation when determining a base image: Obtain the attribute information of the machine learning task; Determine a base image corresponding to the attribute information.
13. The apparatus of claim 9, wherein, The container image contains a machine learning framework, a machine learning library, and a configuration template of a compute unified device architecture (CUDA).
14. The apparatus of claim 9, wherein, The processing unit specifically performs the following operations when determining the container image corresponding to the base image: Obtain the version of the GPU driver in the base image; Determine the version of CUDA corresponding to the version of the GPU driver; Determine the container image containing the version of CUDA.
15. The apparatus of claim 9, wherein, After starting the container instance, the execution unit further performs the following operation: mounting the GPU corresponding to the virtual machine as hardware into the container instance.
16. The apparatus of claim 15, wherein, The execution unit specifically performs the following operation when mounting the GPU corresponding to the virtual machine as hardware into the container instance: If the number of container instances is one, mount all GPUs corresponding to the virtual machine into the container instance; If the number of container instances is more than one, mount the GPUs corresponding to the virtual machine into each container instance according to the principle that at least one GPU is mounted in each container instance.
17. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, The processor executes the program to implement the method of any one of claims 1-8.
18. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the method of any one of claims 1-8.
Citation Information
Patent Citations
Virtual machine establishing method and device and big data cluster establishing method and device
CN107783816A
Deep learning task processing method and device, equipment and storage medium
CN107783818A