Task scheduling method, device and electronic device for deep learning platform
By selecting the appropriate GPU to allocate tasks from the task queue and load gate in the deep learning platform, the problem of load imbalance is solved and more efficient task processing is achieved.
Patent Information
- Application Number
- CN202110954074.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-19
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2041-08-19
AI Technical Summary
In existing deep learning platforms, GPU load balancing has low accuracy, resulting in some GPUs having high loads and long processing times, while other GPUs have low loads and short processing times. The task scheduling strategy of existing technologies leads to low computing efficiency.
By obtaining the target pending tasks with a duration not less than the set duration from the task queue and selecting the target load gate with a load lower than the set load from N load gates, the target pending tasks are assigned to the target GPU for processing, ensuring that tasks with high duration are assigned to GPUs with low load.
The accuracy of load balancing is improved, the total time required to complete tasks is shortened, and processing efficiency is improved.
Smart Images

Figure CN115712489B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to a task scheduling method, device, and electronic device for a deep learning platform. Background Art
[0002] In existing deep learning platforms, a service usually requires enabling multiple graphics processing units (GPUs) for calculations, and each computing task is deployed on a GPU for feature calculation. Multiple threads are deployed on each GPU, and each thread can perform one task calculation at a time. In this way, each GPU may need to perform multiple task calculations simultaneously.
[0003] Because each GPU may need to perform multiple computations simultaneously, a task scheduling strategy is needed to balance the computational load across all GPUs, preventing situations where some GPUs are heavily loaded and computationally expensive, while others are lightly loaded and computationally efficient. Existing techniques typically poll GPU threads and assign tasks to idle threads. However, this can result in high-volume tasks being concentrated on certain GPUs, while low-volume tasks are assigned to other GPUs. This results in some GPUs being heavily loaded while others are lightly loaded, leading to low load balancing accuracy in existing techniques. Summary of the Invention
[0004] Embodiments of the present invention provide a task scheduling method, device, and electronic device for a deep learning platform, which can improve the accuracy of load balancing, shorten the total time required to complete tasks, and improve processing efficiency.
[0005] A first aspect of an embodiment of the present invention provides a task scheduling method for a deep learning platform, the method comprising:
[0006] Get the target pending tasks from the task queue whose duration is not less than the set duration;
[0007] Selecting a load gate having a load lower than a set load from N load gates as a target load gate, wherein the N load gates correspond one-to-one to the N GPUs included in the deep learning platform, and N is an integer greater than 1;
[0008] Allocate the target to-be-processed task to the target GPU corresponding to the target load gate for processing.
[0009] Optionally, before obtaining a target to-be-processed task with a duration not less than a set duration from the task queue, the method further includes:
[0010] Get all currently pending tasks;
[0011] All pending tasks are sorted by time consumption and then placed into the task queue.
[0012] Optionally, obtaining all currently pending tasks includes:
[0013] In response to the currently received request, computing tasks of multiple deep learning graphs corresponding to the request are obtained, and the computing tasks of the multiple deep learning graphs are used as all the tasks to be processed.
[0014] Optionally, sorting all pending tasks by time consumption and placing them into the task queue includes:
[0015] Obtaining the expected time consumption of each of the pending tasks;
[0016] According to the expected time consumption of each task to be processed, all the tasks to be processed are placed into the task queue in descending order of expected time consumption.
[0017] Optionally, placing all pending tasks into the task queue in descending order of expected time consumption according to the expected time consumption of each pending task includes:
[0018] According to the expected time consumption of each task to be processed, all the tasks to be processed are sorted from largest to smallest according to the expected time consumption;
[0019] Put all the sorted tasks to be processed into the task queue.
[0020] Optionally, selecting a load gate having a load lower than a set load from the N load gates as the target load gate includes:
[0021] Obtaining a load value corresponding to each of the N load gates, where the load value is determined based on the number of currently waiting threads of the load gate;
[0022] According to the load value corresponding to each load gate, a load gate having a load lower than the set load is selected from the N load gates as the target load gate.
[0023] Optionally, selecting a load gate having a load lower than a set load from the N load gates as the target load gate includes:
[0024] A load gate with the lowest load is selected from the N load gates as the target load gate.
[0025] Optionally, allocating the target to-be-processed task to a target GPU corresponding to the target load gate for processing includes:
[0026] The target to-be-processed task is assigned to an idle thread in the target GPU for processing, and the current load of the target load gate is adjusted.
[0027] A second aspect of an embodiment of the present invention further provides a task scheduling device for a deep learning platform, the device comprising:
[0028] A target task acquisition unit is used to acquire a target pending task whose duration is not less than a set duration from a task queue;
[0029] a target load gate selection unit, configured to select a load gate having a load lower than a set load from N load gates as a target load gate, wherein the N load gates correspond one-to-one to the N GPUs included in the deep learning platform, and N is an integer greater than 1;
[0030] The task processing unit is used to assign the target to-be-processed task to the target GPU corresponding to the target load gate for processing.
[0031] Optionally, also include:
[0032] A pending task acquisition unit is used to acquire all currently pending tasks;
[0033] The sorting unit is used to sort all the pending tasks according to their time consumption and then put them into the task queue.
[0034] Optionally, the pending task acquisition unit is used to respond to the currently received request, obtain the computing tasks of multiple deep learning graphs corresponding to the request, and use the computing tasks of the multiple deep learning graphs as all the pending tasks.
[0035] Optionally, the target load gate selection unit is used to obtain the load value corresponding to each load gate of the N load gates, where the load value is determined based on the current number of waiting threads of the load gate; and based on the load value corresponding to each load gate, select a load gate with a load lower than the set load from the N load gates as the target load gate.
[0036] A third aspect of an embodiment of the present invention provides an electronic device comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute operating instructions corresponding to the task scheduling method for a deep learning platform as provided in the first aspect.
[0037] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps corresponding to the task scheduling method for a deep learning platform provided in the first aspect.
[0038] The above one or at least one technical solution in the embodiments of the present invention has at least the following technical effects:
[0039] Based on the above technical solution, a target pending task with a time consumption not less than the set time consumption is obtained from the task queue; a load gate with a load lower than the set load is selected from N load gates as the target load gate; the target pending task is assigned to the target GPU corresponding to the target load gate for processing. In this way, since the time consumption of the target pending task is not less than the set time consumption, and the load of the target load gate is lower than the set load, and the N load gates correspond one-to-one with the N GPUs, the target pending task with high time consumption is assigned to the target GPU with low load for processing, thereby improving the accuracy of load balancing. On the basis of the improved accuracy of load balancing, the balancing performance of the total load of tasks is improved, so that tasks with high time consumption will be scheduled and calculated first, thereby effectively shortening the total time consumption for task completion and improving task processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A flowchart of a task scheduling method for a deep learning platform provided by an embodiment of the present invention;
[0041] Figure 2 A block diagram of a task scheduling device for a deep learning platform provided by an embodiment of the present invention;
[0042] Figure 3 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The main implementation principles, specific implementation methods and corresponding beneficial effects of the technical solutions of the embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0044] Example
[0045] Please refer to Figure 1 , an embodiment of the present invention provides a task scheduling method for a deep learning platform, the method comprising:
[0046] S101, obtaining a target pending task whose duration is not less than a set duration from a task queue;
[0047] S102. Selecting a load gate having a load lower than a set load from N load gates as a target load gate, wherein the N load gates correspond one-to-one to the N GPUs included in the deep learning platform, and N is an integer greater than 1;
[0048] S103: Allocate the target to-be-processed task to the target GPU corresponding to the target load gate for processing.
[0049] In the embodiments of this specification, the deep learning platform may be a deep learning inference platform.
[0050] Among them, in step S101, if the pending tasks in the pending task set in the task queue have not been sorted by time consumption, it is necessary to calculate the time consumption of each pending task in the pending task set, and according to the expected time consumption of each pending task obtained by calculation, one pending task is selected from the pending task set in order from large to small as the target pending task; if the pending tasks in the pending task set in the task queue have been sorted by time consumption, then directly select one pending task from the pending task set in order from large to small as the target pending task.
[0051] In the embodiment of this specification, the set time consumption can be determined based on the time consumption of each pending task in the task queue. For example, the set time consumption can be no less than the second highest or third highest time consumption in the task queue and no greater than the highest time consumption. For example, if there are three pending tasks in the task queue with time consumptions of 30ms (milliseconds), 20ms, and 15ms, the set time consumption can be determined to be 20ms, 25ms, or 26ms, etc. Of course, the set time consumption can also be set according to actual conditions, and this specification does not impose any specific restrictions.
[0052] Specifically, the set time consumption changes according to the changes in the pending tasks in the task queue. If there are 3 pending tasks in the task queue at the previous moment, and the time consumptions are 30ms (milliseconds), 20ms and 15ms respectively, then according to 30ms and 20ms, it can be determined that the set time consumption can be 20, 25 and 26, etc., so that the 30ms pending task is assigned to the corresponding GPU for processing; so that at the next moment, there are 2 pending tasks in the task queue, and the time consumptions are 20ms and 15ms respectively. At this time, according to 20ms and 15ms, it can be determined that the set time consumption can be 19ms, 17ms and 16ms, etc., so that the 20ms pending task is assigned to the corresponding GPU for processing; and at the next moment, there is only one pending task in the task queue, and its time consumption is 15ms. Then, according to 15ms, since the set time consumption is not greater than the maximum time consumption, the set time consumption is determined to be 15ms, 14ms and 13ms, etc., so that the 15ms pending task is assigned to the corresponding GPU for processing.
[0053] Preferably, the time consumption is set to be no less than the second highest time consumption in the task queue. In this case, one pending task will be selected from the set of pending tasks in the task queue in descending order of time consumption as the target pending task; for each selected target pending task, steps S102-S103 are executed to complete the processing of each pending task in the task queue.
[0054] In the embodiment of this specification, before executing step S101, all current pending tasks can be obtained; all pending tasks are sorted by time consumption and placed in the task queue; in this way, when executing step S101, the target pending task can be obtained more quickly from all pending tasks sorted by time consumption.
[0055] In the embodiment of this specification, when obtaining all current pending tasks, if multiple requests are received at the same time, then multiple computing tasks of deep learning graphs corresponding to the multiple requests are obtained, and the computing tasks of the multiple deep learning graphs are used as all pending tasks. When obtaining multiple computing tasks of deep learning graphs corresponding to multiple requests, for each request, if the request corresponds to only one computing task of a deep learning graph, then the computing task of the deep learning graph corresponding to the request is directly added to the computing tasks of the multiple deep learning graphs; if the request corresponds to multiple computing tasks of deep learning graphs, then the computing tasks of the multiple deep learning graphs are added to all pending tasks; after the computing tasks corresponding to each request are added to all pending tasks, all pending tasks are obtained.
[0056] Specifically, when obtaining all the current pending tasks, only one request will be received at the same time. Then, by responding to the currently received request, the computing tasks of multiple deep learning graphs corresponding to the request can be obtained, and the computing tasks of multiple deep learning graphs can be used as all pending tasks.
[0057] Specifically, when a request is received, the request includes the calculation of multiple deep learning graphs (i.e., feature graphs). The calculation of each deep learning graph is regarded as a computing task. Different deep learning graphs may have different computing times due to their different model structures. Therefore, after obtaining the computing tasks of multiple deep learning graphs, the expected computing time of each deep learning graph is calculated, and then the computing tasks of each deep learning graph are sorted according to the expected computing time. Then, the sorted computing tasks of the multiple deep learning graphs are put into the task queue as all pending tasks.
[0058] After acquiring all pending tasks, all pending tasks are sorted by time consumption and placed into a task queue. The expected time consumption of each pending task can be acquired. Based on the expected time consumption of each pending task, all pending tasks are placed into the task queue in descending order of expected time consumption. In this way, all pending tasks in the task queue are sorted in descending order of expected time consumption. Furthermore, when executing step S101, the pending task with the highest or second highest time consumption among all pending tasks can be directly selected as the target pending task based on the set time consumption, thereby shortening the time to acquire the target pending task and improving acquisition efficiency.
[0059] Specifically, when all pending tasks are placed into the task queue according to the expected time of each pending task, all pending tasks can be sorted according to the expected time of each pending task, and then all sorted pending tasks are placed into the task queue. In this case, all pending tasks can be sorted first and then all sorted pending tasks can be placed into the task queue. Alternatively, all pending tasks can be placed into the task queue directly according to the expected time from largest to smallest, without sorting them. This specification does not impose any specific restrictions.
[0060] For example, taking the case where a request is received and contains the calculation of four deep learning graphs, the calculation tasks of the four deep learning graphs corresponding to the request are A1, A2, A3 and A4, respectively. Among them, the expected time consumption of A1, A2, A3 and A4 is calculated to be 12ms, 10ms, 20ms and 6ms, respectively. Then, A1, A2, A3 and A4 are sorted from large to small according to the expected time consumption, and the sorted sequence is {A3, A1, A2, A4}, and then the sorted sequence is put into the task queue. At this time, when the sorted sequence is put into the task queue, the put method can be called in sequence to put A3, A1, A2 and A4 into the task queue in sequence. And, if the time consumption is set to 18ms, since 20>18>12, A3 is selected as the target task to be processed.
[0061] After the target task to be processed is determined, step S102 is executed.
[0062] In step S102, after the target processing task is determined, the operation of selecting a target load gate is automatically triggered. At this time, the load value corresponding to each of the N load gates is obtained. The load value is determined based on the current number of waiting threads for the load gate. Based on the load value corresponding to each load gate, a load gate with a load lower than the set load is selected from the N load gates as the target load gate. The current number of waiting threads refers to the number of threads currently in a waiting state. For example, if the number of GPUs in a waiting state corresponding to a certain load gate is 3, then the current number of waiting threads for that load gate is 3.
[0063] In the embodiments of this specification, since N is an integer greater than 1, the value of N can be 2, 3, 5, 8, etc., and this specification does not impose any specific limitation.
[0064] In the embodiments of this specification, the set load can be determined based on the load value of each of the N load gates. For example, the set load can be no greater than the second lowest load value or the third lowest load value among the N load gates and greater than the lowest load value. For example, if the load values of the three load gates are -5, -2, and -8, respectively, the set loads can be determined to be -6, -6, and -7, etc. Of course, the set load can also be set according to actual conditions, and this specification does not impose any specific limitations.
[0065] Specifically, a load gate with the lowest or second lowest load value can be selected from the N load gates as the target load gate. That is, a load gate with the smallest or second smallest load value can be selected from the N load gates as the target load gate.
[0066] Preferably, the load is set to be less than the second lowest load value among the N load gates and greater than the lowest load value. In this case, the target task to be processed will be assigned to the load gate with the lowest load, so that when the time consumption is set to be no less than the second highest time consumption in the task queue, the time consumption of the target task to be processed determined each time is the highest, and the load of the load gate assigned to it is the lowest, which can further increase the probability of high-time-consuming tasks being scheduled and calculated as much as possible, further shorten the total time required to complete all tasks, and thus effectively improve the task processing efficiency.
[0067] Specifically, a gate_states array is created for each of the N GPUs in advance, resulting in N gate_states arrays serving as N load gates. For each gate_states array, the load value corresponding to the array is initialized to 0. Whenever a thread in the GPU corresponding to the gate is in an idle state, the load value corresponding to the gate is decremented by one (if three threads are in a waiting state, the load value corresponding to the gate is -3). In this way, the load value of each of the N load gates can be obtained. Furthermore, after obtaining the load value of each load gate, a load gate with a load value lower than the set load is selected from the N load gates as the target load gate. Of course, whenever a thread in the GPU corresponding to the gate is in an idle state, the load value corresponding to the gate is increased or decreased by a corresponding value. For example, whenever a thread in the GPU corresponding to the gate is in an idle state, the load value corresponding to the gate is increased by 1, increased by 2, decreased by 2, or decreased by 3, etc., although this specification does not impose specific limitations. The following specifically uses the example of decrementing the load value corresponding to the gate whenever a thread in the GPU corresponding to the gate is in an idle state.
[0068] Take a deep learning platform with four GPUs as an example. The four GPUs are B1, B2, B3, and B4, and a gate_states array is created for each GPU in B1, B2, B3, and B4, which are G1, G2, G3, and G4, respectively. According to the number of threads currently in the waiting state of each GPU, the load values of G1, G2, G3, and G4 are obtained as -3, -4, -6, and -5, respectively. If the load is set to -5.5, since -6<-5.5, G3 is selected as the target load gate.
[0069] In actual application, after calling the put method to put all sorted pending tasks into the task queue, the select_and_signal method is called. By calling the select_and_signal method, a load gate with the lowest load is selected and the thread corresponding to the load gate is notified.
[0070] After the target load door is determined, step S103 is executed.
[0071] In step S103, after determining the target load gate, since N load gates correspond one-to-one to N GPUs, the target GPU corresponding to the target load gate can be obtained, and then the target to-be-processed task is assigned to an idle thread in the target GPU for processing, and the current load of the target load gate is adjusted.
[0072] For example, if G3 is selected as the target load gate, and since G3 corresponds to B3, the target GPU is determined to be B3. The waiting threads in B3 are notified to assign the target pending task to the target load gate selected as G3. If B3's current load value is -6 + 1 = -5, then B3's current load value is adjusted from -6 to -5. This allows pending tasks in the task queue that take longer than the set time to be assigned to the target GPU with the lower load, prioritizing the computation of time-consuming tasks. This reduces the total time required to complete all tasks, effectively improving task processing efficiency.
[0073] In the embodiment of this specification, for the remaining pending tasks in the task queue except the target pending task, steps S101-S103 are executed for each of the remaining pending tasks. At this time, the set time consumption needs to be determined based on the expected time consumption of the current pending task in the task queue, so that the set time consumption and the set load are changed according to the actual situation. In this way, the low-time-consuming pending tasks will be assigned to the GPU with high load for processing, which can improve the accuracy of load balancing of N GPUs.
[0074] Based on the above technical solution, a target pending task with a time consumption not less than the set time consumption is obtained from the task queue; a load gate with a load lower than the set load is selected from N load gates as the target load gate; the target pending task is assigned to the target GPU corresponding to the target load gate for processing. In this way, since the time consumption of the target pending task is not less than the set time consumption, and the load of the target load gate is lower than the set load, and the N load gates correspond one-to-one with the N GPUs, the target pending task with high time consumption is assigned to the target GPU with low load for processing, thereby improving the accuracy of load balancing. On the basis of the improved accuracy of load balancing, the balancing performance of the total load of tasks is improved, so that tasks with high time consumption will be scheduled and calculated first, thereby effectively shortening the total time consumption for task completion and improving task processing efficiency.
[0075] In view of the above embodiment, a task scheduling method for a deep learning platform is provided. The embodiment of the present invention also provides a task scheduling device for a deep learning platform. Figure 2 , the device comprises:
[0076] The target task acquisition unit 201 is used to acquire a target to-be-processed task whose duration is not less than a set duration from the task queue;
[0077] a target load gate selection unit 202, configured to select a load gate having a load lower than a set load from N load gates as a target load gate, wherein the N load gates correspond one-to-one to the N GPUs included in the deep learning platform, and N is an integer greater than 1;
[0078] The task processing unit 203 is configured to assign the target to-be-processed task to the target GPU corresponding to the target load gate for processing.
[0079] In an optional embodiment, the device further includes:
[0080] A pending task acquisition unit is used to acquire all currently pending tasks;
[0081] The sorting unit is used to sort all the pending tasks according to their time consumption and then put them into the task queue.
[0082] In an optional embodiment, the pending task acquisition unit is used to respond to a currently received request, obtain computing tasks of multiple deep learning graphs corresponding to the request, and use the computing tasks of the multiple deep learning graphs as all pending tasks.
[0083] In an optional embodiment, the sorting unit is used to obtain the expected time consumption of each task to be processed among all the tasks to be processed; according to the expected time consumption of each task to be processed, all the tasks to be processed are placed into the task queue in descending order of the expected time consumption.
[0084] In an optional embodiment, the sorting unit is used to sort all the tasks to be processed from large to small according to the expected time consumption of each task to be processed; and put all the sorted tasks to be processed into the task queue.
[0085] In an optional embodiment, the target load gate selection unit 202 is used to obtain the load value corresponding to each load gate of the N load gates, where the load value is determined based on the current number of waiting threads of the load gate; and based on the load value corresponding to each load gate, select a load gate with a load lower than the set load from the N load gates as the target load gate.
[0086] In an optional implementation, the target load gate selection unit 202 is configured to select a load gate with the lowest load from the N load gates as the target load gate.
[0087] In an optional implementation, the task processing unit 203 is configured to assign the target to-be-processed task to an idle thread in the target GPU for processing, and adjust the current load of the target load gate.
[0088] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0089] Figure 3 The block diagram of an electronic device 800 is shown, according to an exemplary embodiment, as a method for scheduling tasks on a deep learning platform. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
[0090] Reference Figure 3 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / display (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0091] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 802 may include one or more modules to facilitate interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
[0092] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0093] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0094] The multimedia component 808 includes a screen that provides a presentation interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
[0095] The audio component 810 is configured to present and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for presenting audio signals.
[0096] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.
[0097] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800. The sensor assembly 814 can also detect changes in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and temperature changes of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0098] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0099] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0100] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0101] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a mobile terminal, enables the mobile terminal to perform a task scheduling method for a deep learning platform, the method comprising:
[0102] Get the target pending tasks from the task queue whose duration is not less than the set duration;
[0103] Selecting a load gate having a load lower than a set load from N load gates as a target load gate, wherein the N load gates correspond one-to-one to the N GPUs included in the deep learning platform, and N is an integer greater than 1;
[0104] Allocate the target to-be-processed task to the target GPU corresponding to the target load gate for processing.
[0105] Other embodiments of the present invention will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the invention being indicated by the following claims.
[0106] It should be understood that the present invention is not limited to the exact construction described above and shown in the accompanying drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
[0107] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A task scheduling method for a deep learning platform, characterized in that: The method comprises: Obtaining a target pending task from the task queue whose duration is not less than a set duration; the set duration varies according to changes in pending tasks in the task queue, and the set duration is not less than the second highest or third highest duration in the task queue and not greater than the highest duration; Obtain the load value corresponding to each load gate in N load gates; According to the load value corresponding to each load gate, a load gate having a load lower than a set load is selected from the N load gates as a target load gate, wherein the N load gates correspond one-to-one to the N GPUs included in the deep learning platform, and N is an integer greater than 1; the set load is determined according to the load value of each load gate in the N load gates, and the set load is not greater than the second lowest load value or the third lowest load value among the N load gates and is greater than the lowest load value; Allocate the target to-be-processed task to the target GPU corresponding to the target load gate for processing.
2. The method according to claim 1, wherein Before obtaining a target to-be-processed task with a duration not less than a set duration from the task queue, the method further includes: Get all currently pending tasks; All pending tasks are sorted by time consumption and then placed into the task queue.
3. The method according to claim 2, wherein The above method obtains all currently pending tasks, including: In response to the currently received request, computing tasks of multiple deep learning graphs corresponding to the request are obtained, and the computing tasks of the multiple deep learning graphs are used as all the tasks to be processed.
4. The method according to claim 2, wherein The step of sorting all pending tasks by time consumption and placing them into the task queue comprises: Obtaining the expected time consumption of each of the pending tasks; According to the expected time consumption of each task to be processed, all the tasks to be processed are placed into the task queue in descending order of expected time consumption.
5. The method according to claim 4, wherein The step of placing all pending tasks into the task queue according to the expected time consumption of each pending task in descending order of expected time consumption includes: According to the expected time consumption of each task to be processed, all the tasks to be processed are sorted from largest to smallest according to the expected time consumption; Put all the sorted tasks to be processed into the task queue.
6. The method according to any one of claims 1 to 5, wherein: The load value is determined according to the current number of waiting threads of the load gate.
7. The method according to claim 6, wherein The selecting a load gate having a load lower than the set load from the N load gates as the target load gate includes: A load gate with the lowest load is selected from the N load gates as the target load gate.
8. The method according to claim 7, wherein Allocating the target to-be-processed task to the target GPU corresponding to the target load gate for processing includes: The target to-be-processed task is assigned to an idle thread in the target GPU for processing, and the current load of the target load gate is adjusted.
9. A task scheduling device for a deep learning platform, characterized in that: The device comprises: a target task acquisition unit, configured to acquire a target to-be-processed task whose duration is not less than a set duration from a task queue; the set duration varies according to changes in the to-be-processed tasks in the task queue, and the set duration is not less than the second highest or third highest duration in the task queue and not greater than the highest duration; A load value obtaining unit, configured to obtain a load value corresponding to each of the N load gates; a target load gate selection unit, configured to select, from the N load gates, a load gate having a load lower than a set load as a target load gate, based on the load value corresponding to each load gate, wherein the N load gates correspond one-to-one to the N GPUs included in the deep learning platform, and N is an integer greater than 1; the set load is determined based on the load value of each load gate in the N load gates, and the set load is not greater than the second lowest load value or the third lowest load value among the N load gates and is greater than the lowest load value; The task processing unit is used to assign the target to-be-processed task to the target GPU corresponding to the target load gate for processing.
10. The device according to claim 9, wherein Also includes: A pending task acquisition unit is used to acquire all currently pending tasks; The sorting unit is used to sort all the pending tasks according to their time consumption and then put them into the task queue.
11. The device according to claim 10, wherein The pending task acquisition unit is used to respond to the currently received request, obtain the computing tasks of multiple deep learning graphs corresponding to the request, and use the computing tasks of the multiple deep learning graphs as all the pending tasks.
12. The device according to claim 10, wherein The sorting unit is configured to obtain an expected time consumption of each of the tasks to be processed among all the tasks to be processed; and according to the expected time consumption of each task to be processed, put all the tasks to be processed into the task queue in descending order of expected time consumption.
13. The device according to claim 12, wherein The sorting unit is configured to sort all the tasks to be processed from largest to smallest according to the expected time consumption of each task to be processed; and put all the sorted tasks to be processed into the task queue.
14. The device according to any one of claims 9 to 13, wherein: The load value is determined according to the current number of waiting threads of the load gate.
15. The device according to claim 14, wherein The target load gate selection unit is configured to select a load gate with the lowest load from the N load gates as the target load gate.
16. The device according to claim 15, characterized in that The task processing unit is configured to assign the target to-be-processed task to an idle thread in the target GPU for processing, and to adjust the current load of the target load gate.
17. An electronic device, characterized in that: The invention comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute the operation instructions corresponding to the method according to any one of claims 1 to 8 contained in the one or more programs.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps corresponding to the method according to any one of claims 1 to 8 are implemented.
19. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Task scheduling energy-saving method in multi-phase GPU heterogeneous system environment
CN111240818A