The invention discloses a GPU dynamic memory
resource management method and
system based on
time sequence historical analysis. According to the method, a CUDAAPI function during running of a
deep learning model is intercepted, and an execution history table containing a kernel execution sequence, a
memory block size and an address is generated. By comparing two latest execution history tables, calculating a consistency ratio to judge whether a memory access mode is stable or not, so that a memory prefetch strategy is started; and when the GPU memory is insufficient, the memory blocks are exchanged to the CPU memory based on an expelling strategy of
reference counting, so that sufficient GPU memory can be available during kernel execution. The
system comprises a memory extraction module, a prefetching module and a dynamic decision module, supports dynamic asynchronous memory exchange, and optimizes GPU memory utilization efficiency. The method is suitable for
deep learning model training in a GPU memory resource limited environment, a larger-scale
deep learning model and training batches can be supported on the GPU with the same configuration, memory waste is reduced, and operation performance is improved.