• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • GPU? ?? DPDK ? GPUdev? ??? ??? ?? ?? ??

    Reading Time: 8 minutes

    GPU? ??? ???? ??? ??? ??? ?? ??, ???? ??, ?? ??, ?? ??? ? ??? ?????? ???? ??? ?? ?? ?????.

    ??? ?????? ??? ?? ??? ??? ??? ??? ?? GPU ???? ???? ?? ??? ???? CUDA ??? ????? ????.

    ???? ??? ???? ???? GPU ???? ??? ?? ??? ? ?? ??? ??? ?????? ???? ????. ??? ??? GPU ? CPU? ???? ?? ?? CUDA ??? ???? ?? ??? ?????.

    ???? ?????? ?????? ??? ?? ????? ???? ??? ?? ?? ?? ?? ?? ??? ??? ??? ?????? ???? ??? ?????.

    • ???? ????: ??? ???? ??? GPU ???? ?????.
    • CPU: ??? ??? ?? ??? ?? ?? ???? ????? ?????.
    • GPU: ?? ??? ???? GPU ???? ?? ?????.

    ?? 1? NVIDIA GPU? ConnectX ???? ??? ???? ??? ??? ?? ?? ??????? ???? ?? ????? ????? ?????.

    ?? 1. ???? ??? ?? ?? ????? ????

    ?? ?? ??????? ?? ??? ???? ??? ?? ?? ?? ?????. ??? ?? ?? ?? ??? ?????? ???? ???? ??? ???? ?????. ?? ????? ??? ???? ???? ?? ?? ?? ?? ?? ??? ???? ?? ????? ???? ???. 

    ?? ? ?? ??? ???? ??? ? ????.

    • ??? ??: ???? ???(???? ??)? PCIe ??? ?? ???? ??? GPU ?? ?????.
    • ?? ??: CPU? GPU? ???? ??? ??????????.

    ??? ??

    ???? ????? GPU ?? ???? ??? ??(?? ???)? ?????. NVIDIA GPU? ?? ?? ????(?: ???? ??) ?? ?? ??? ??? ???? GPUDirect RDMA ?? ? PCI Express ?? ?????? ?? ??? ???? ???? ??? ??? ??? ? ????.

    GPUDirect RDMA? PCI Express ?? ?? ????(BAR) ??? ???? ??? ??? ???? NVIDIA GPU ??? ?????. ??? ??? CUDA ?? ????? GPUDirect RDMA? ??? Linux ?? ?? ??? ?????. ?? ?? ???? GPUDirect RDMA ???? ?????? ??? ??? ????? ???? ?? IB ??? ???? ??(???)? ??? ??? GPUDirect RDMA ??? ? ?? ??? ?? ????? ?????. 

    ?? 2. PCI Express? ?? ??? ???? GPU? ?? ?? ???? ?? ??? ??? ?? ?? ??? ???? NVIDIA GPUDirect RDMA

    Linux ????? GPUDirect RDMA? ?????? nvidia-peermem ??(CUDA 11.4 ???? ?? ??)? ?????. ?? 3? GPUDirect RDMA ?? ???? ????? ???? ??? ???? ?????. ?, ?? ?? ??? ???? ??? PCIe ??? ??? ?? GPU? NIC ?? ?? PCIe ??????.

    ?? 3. ???? ????? GPU ?? ?? ??? ???? ????? ???? ????

    ?? ??

    CPU? ???? ????? GPU ?? ??? ???? ????? ???? NIC? ????? GPU ???? ??? ???? CUDA ????? ? ??? ??? ? ??? ????.

    GPU? ?? ?? CPU? GPU ?? ????? ?? ?????. ?? ???? ?? ? ??? ???? ??? ??????? ?? ? ? ????.

    • ?? ??
    • ?? ??
    • ??? ?? ??

    ? ?????? ??? ???????? ?? ??? ???? 4?? ??? ??? ???? ?? ?????.

    ?? 1 

    ?? 4? ?? ??? ?? ??? ?? ?? ??? ?????. ?? CPU ???? ??? ???? CUDA ??? ???? ??? ???? CUDA ??? ??? ??? ????? ??? ??? ???? ????? ???? ??? ???.

    ?? 4. ?? CPU? ??? CUDA ??? ???? ?? ??? ???? ? ??? ???? ?????

    ?? ??? ??? ????? ??? ? ?? ??? GPU ?? ?? CPU? ??? ???? ??? ? ???? ?? ????. ?? ?? ???? ??? ?? ???? ??? ????? ???? ?? ?? ??? ?? ??? ??? ?? ????.

    ?? 2 

    ? ?? ???? ??????? CPU ????? ? ?? CPU ???? ?????. ??? ??? ???? GPU ??? ???? ?????, ?? ??? GPU ??? ??? ??? ???? ????? ?? ??? ??? ???? ??????(?? 5). 

    ?? 5. CPU ???? ???? GPU? ?? ?? ??

    ? ?? ??? ??? ??? ????? ? CUDA ??? ????? ??? ????. CPU??? ?? ???? CUDA ??? ?? ?? ??? ?????. GPU? ????? ?? ??? ?? ???? ?? ??? ??? ?? ????.

    ?? 3

    ?? 6? CUDA ?? ??? ???? ? ?? ?? ??? ?????.

    ?? 6. ?? CUDA ??? ??? ??? ?? ??

    CUDA ?? ??? CPU ??? ????? ?? ?? ??? ?????. ??? CPU ???? ? ??? ???? ??? ??? ???? ?????. ??? ???? ??? ?? ??? ??? ? ??? ? ?? CPU ???? ????. 

    ? ?? ???? ???? ?? ?? ??? ?? ??? ?? ???? ????? ???? CPU? GPU ?? ?? ???? ???? ????. GPUDirect RDMA? ?? ?????? GPU ???? ?? ????? ? ?????, ??? API? ???? GPU ???? ??? CPU ??? ???? ??? ? ????. CPU ?? ???? ??? ????? ??? ??? ????. ? ??? ?? GDRCopy ?????? ?? ???? ? ????. 

    ??? ???? ?? GPU ???? ?? ???? CPU?? ???? ??? ? ??? ?? ? GPU?? ??? ?? ??? ?????. GPU?? ? ? ?? CPU ?? ???? ?? ???? ?? ?? ???, CPU ??? ???? CUDA ?? ??? ? ?? PCIe ???? ???? ?? ?? ??? ??????. 

    ? ?? ???? ?? ???? CUDA ????? ???? ???? ??? ????? ????. GPU ??? ??? ?? ????. ???? ???? ??? ?? ??? ?? ??? ?? ????. ?? ?? ??? ?? ???? ?? CUDA ??, CPU ??, ??? ?? ?? ?? ??? ???? ?? ?? ????.

    ?? GPU? ?? ???? ?? ?? ??? ????? ??? ? ?? GPU ???(?: ???? ??????)? ?????. CUDA ?? ??? ???? ?? ??????? ?? ???? ???.

    ?? 4

    ??? ?? ??? ?? ?? ??? ??? ????? ??????. CUDA ??? ??? ??? ???? ?? ???? ????? ?????? CUDA ????? ??? ?? ??? ??? CUDA ??? ?? ?????.

    ?? 7. ??? ?? ??? ?? ??? ???? ????? ?? ??

    ? ?? ??? GPU ????? GPU ???? ??????? ???? ?? ??? ????? ??(cuStreamWaitValue ??)?? ??? ?? ??? ??? ??? ?? ?????? ???? ????.

    ?? ????, ?? ??? ???? cuStreamWriteValue? ??? ?????? ??? CPU ???? ????. 

    ? ?? ??? ? ?? ??? ??? ??? ?? ?? ? ????? ?? ??? ???? ?? ?? ??????? ??? cuStreamWaitValue + CUDA ?? + cuStreamWriteValue ??? ??? ???? ???? GPU? ?? ??? ??? ??? ????. ?? ?? CUDA ???? ???? ?? ???? ?? ??? ?? ??? ? ????.

    ?????? ??? ?? ?? ??? ??? ?????.

    DPDK? GPUdev

    ??? ??? ?? ??(DPDK)? ??? CPU ????? ?? ?????? ???? ?? ?? ????? ???? ???? ????? ?????.  

    DPDK 21.11?? NVIDIA? DPDK? ???? GPU ??? ???? CPU, ???? ??, GPU ?? ??? ???? ?? GPUdev?? ??? ?????? ??????. GPUdev? DPDK 22.03?? ? ?? ???? ???????.

    ?????? ??? ??? ????.

    • DPDK ?? ??????? ???? GPU ????? ??? ?????.
    • ?? GPU ??? ?? ??? ???? GPU ?? ?? ?? ??? ????. 
    • ???? ??, GPU ????, CPU ?? ??? ?? ??? ?????. 
    • GPU ????????? DPDK ??? ??????.
    • ?? ???? ?? GPU ???? ?? ??? ?????.

    NVIDIA ?? GPU? ?? CUDA ???? DPDK ?????? ?? DPDK ???? ???? GPUdev ????? ??? ?????. NVIDIA GPU? ?? ??? ?? gpudev ??? ?????? CUDA ?????? GDRCopy? ?? ???? DPDK? ???? ???. 

    ? ??? ??????? ???? ??? ???? ??? ??? ?? ??? ?? ???? GPU? ?? ??? ?? ??? ?? ??? ? ????. 

    DPDK? ??? ??? ??? ??? ??? ??? ?????. ??? ??? ???? ???? GPU ???? ??? ?? ????? GPUDirect RDMA? ????? ???? ????? ??? ? ????.

    struct rte_pktmbuf_extmem gpu_mem; 
    
    gpu_mem.buf_ptr = rte_gpu_mem_alloc(gpu_id, gpu_mem.buf_len, alignment)); 
    
    /* Make the GPU memory visible to DPDK */ 
    
    rte_extmem_register(gpu_mem.buf_ptr, gpu_mem.buf_len, 
    
                                NULL, gpu_mem.buf_iova, NV_GPU_PAGE_SIZE); 
    
    /* Create DMA mappings on the NIC */ 
    
    rte_dev_dma_map(rte_eth_devices[PORT_ID].device, gpu_mem.buf_ptr, 
    
                                       gpu_mem.buf_iova, gpu_mem.buf_len)); 
    
    /* Create the actual mempool */ 
    
    struct rte_mempool *mpool = rte_pktmbuf_pool_create_extbuf(... , &gpu_mem, ...);

    ?? 8? ??? ?? ??? ?????. 

    ?? 8. ??? ?? ??? ?? ??? ?? ??

    ?? ??? ?? CPU? GPU ?? ?? ????? ?????? CPU ???? CUDA ?? ?? ?? ??? ??? gpudev ?? ???? ???? ???. ???? ? ??? ??? ??(mbufs)? ??, ??? ?? ??? ?? ??(?? ??, ?? ?? ?)? ?????? ???? ??? ? ????.

    struct rte_pktmbuf_extmem gpu_mem; 
    
    gpu_mem.buf_ptr = rte_gpu_mem_alloc(gpu_id, gpu_mem.buf_len, alignment)); 
    
    /* Make the GPU memory visible to DPDK */ 
    
    rte_extmem_register(gpu_mem.buf_ptr, gpu_mem.buf_len, 
    
                                NULL, gpu_mem.buf_iova, NV_GPU_PAGE_SIZE); 
    
    /* Create DMA mappings on the NIC */ 
    
    rte_dev_dma_map(rte_eth_devices[PORT_ID].device, gpu_mem.buf_ptr, 
    
                                       gpu_mem.buf_iova, gpu_mem.buf_len)); 
    
    /* Create the actual mempool */ 
    
    struct rte_mempool *mpool = rte_pktmbuf_pool_create_extbuf(... , &gpu_mem, ...);

    ??? ?? ?? ?????. 

    struct rte_mbuf * rx_mbufs[MAX_MBUFS]; 
    
    int item_index = 0; 
    
    struct rte_gpu_comm_list *comm_list = rte_gpu_comm_create_list(gpu_id, NUM_ITEMS); 
    
     while(exit_condition) { 
    
    ... 
    
    // Receive and accumulate enough packets 
    
        nb_rx += rte_eth_rx_burst(port_id, queue_id, &(rx_mbufs[0]), rx_pkts); 
    
    // Populate next item in the communication list. 
    
        rte_gpu_comm_populate_list_pkts(&(p_v->comm_list[index]), rx_mbufs, nb_rx); 
    
     ... 
    
        index++; 
    
    }

    ??? ???? ?? ??????? CUDA ?? ?? ????? ???? ???? CUDA ??? ?? ?? ?? ?? ??? ???? ?? ????.

    __global__ void cuda_persistent_kernel(struct rte_gpu_comm_list *comm_list, int comm_list_entries) 
    
    { 
    
        int item_index = 0; 
    
        uint32_t wait_status; 
    
         /* GPU kernel keeps checking exit condition as it can’t be preempted. */ 
    
        while (!exit_condition()) { 
    
            wait_status = RTE_GPU_VOLATILE(comm_list[item_index].status_d[0]); 
    
            if (wait_status != RTE_GPU_COMM_LIST_READY) 
    
                continue; 
    
             if (threadIdx.x < comm_list[item_index]->num_pkts) { 
    
                /* Each CUDA thread processes a different packet. */ 
    
                packet_processing(comm_list[item_index]->addr, comm_list[item_index]->size, ..); 
    
            }
    
            __syncthreads(); 
    
             /* Notify packets in the items have been processed */ 
    
            if (threadIdx.x == 0) { 
    
                RTE_GPU_VOLATILE(comm_list[item_index].status_d[0]) = RTE_GPU_COMM_LIST_DONE; 
    
                __threadfence_system(); 
    
            } 
    
             /* Wait for new packets on the next communication list entry. */ 
    
            item_index = (item_index+1) % comm_list_entries; 
    
        } 
    
    }

    ?? 9. ?? ???? ?? ? ?? ??? ????? ??

    ??? ?? ??? ?? DPDK gpudev ?????? ???? NVIDIA? ???? ?? ??? ????? ?? ??? 5G ??????? ???? ?? Aerial ?????? ?????? ????. ? ???? ??? GPU ???? ???? 5G ?? ?? ??? ?? ?????? ??, ???? ?????? ?? ??? ??? ? ?? ??? ????.

    ?? 10. Aerial 5G ??????? DPDK gpudev? ??? ??? ?? ?? ?? ??

    l2fwd-nv ??????

    ??? ?? ??? ???? DPDK gpudev ?????? ???? ??? ?? ???? ??? ???? ?? l2fwd-nv ?? ??? /NVIDIA/l2fwd-nv GitHub ?????? ????????. ? ?? ??? GPU ???? ??? ??? DPDK l2fwd ??? ?? ?????. ?????? ????? ??? ????, ???? MAC ??(?? ? ??)? ????, ??? ??? ???? ? ?????.

    L2fwd-nv? ??? ?? ? ????? ?? ??? ?? ?? ??? ?? ?? ??? ?????.

    • CPU? ??
    • ?? ??? CUDA ??
    • CUDA ?? ??
    • CUDA ???

    ?? ?? ?? 11? DPDK gpudev ??? ?? CUDA ?? ??? ????? ?????.

    ?? 11. DPDK gpudev ??? ???? CUDA ?? ??? ???? ??

    DPDK testpmd ?? ???? ???? l2fwd-nv ??? ???? ?? ?? 12?? ???? ??? 2?? Gigabyte ??? Intel Xeon Gold 6240R, PCIe Gen3 ?? ???, Ubuntu 20.04, MOFED 5.4, CUDA 11.4 ?? CPU? ?? ???????.

    ?? 12. l2fwd-nv ??? ????? ?? 2?? Gigabyte ?? ??

    ?? 13? ??? CPU ?? GPU ???? ??? ? ?? I/O ???? ????? ? ? ?? ?? ???? ??? ???? ??? ?????. ??? ??? ???? ?? ? ?????.

    ?? 13. ??? ?? I/O ???

    ??? GPU ?? ?? ?? ?? ??? ???? ?? ?? 14? ?? 2(?? ??? CUDA ??)? ?? 3(CUDA ?? ??) ?? ??? ?? ??? ?????. ? ?? ?? ?? ??? 1,024???? ????? ??? ?? ?? ??? ??? GPU ??? ????? ??? MAC ??? ?????.

    ?? 14. GPU ?? ?? ?? ?? ??

    ? ?? ?? ?? ?? ??? 16?? ???? ?? ?? ????? ?? ?? ?? ??? ???? ?? ???? ???? ????. ?? ??? 32?? ??? ???? ?? ??? ?? ???? ??? ? ???, ?? ??? ?? ??? ??? ?? ??? ????? ?? ????. ?? ??? 64? ? 128? ??? ?? ? ?? ?? ?? ?? I/O ???? ??? ? ????. ??? ??? ??? ?? ??? ??? ????.

    ??

    ? ?????? GPU? ???? ??? ?? ??? ????? ? ?? ?? ??? ?????. ?????? ?? ??? ?? ? ?? ????? ??? ???? ?? ??? ???? ??? ??? ? ????. ?? DPDK gpudev ?????? ?? ??? ????? ?? ?? ?? ??? ??? ??? ????.

    ??????? ?? ???? ? ?? ????? ?? ??? ????? ?? ?? ??? ??? ??? ???? ? ??? ??, ?? ?? ?? ?? ??? ??? ???? ?? ??? ? ?? ??? ?, ?? ?? ? ??? ?????? ?? ?? ?? ????.

    ? ???? ??? SDK? ???? ?? ???, ?? ???, ?? ??, ??, ?? ??, ???? NVIDIA ??? ???? ??? ??? ??? ??? ? ????. ?? ??? ???? NVIDIA? ?? ????? ???? ? ??? ??? ??? ?????? ???? ??? ??? ???.

    Discuss (0)
    +1

    Tags

    ?? ???

    人人超碰97caoporen国产