(E-Mail Removed) <(E-Mail Removed)> wrote:
> Hi all,
> I would like to know if there are any ways to increase the rate at
> which packets can be read/copied into a buffer.
Don't copy them

(Or at least, not as often)
> I'm writing a program that reads a large pcap file using pcap_loop,
> puts the packets into a 100MB buffer and then processes this 100MB
> buffer on a GPU. As the program is currently single thread, it will
> fill up the buffer, copy the buffer to GPU, process on GPU, copy the
> results back to CPU, then repeat the process again by filling up the
> buffer until no more packets are read. The way the buffer is filled
> is by memcpy-ing every packet into this buffer.
> The transferring of data to/from CPU/GPU and the GPU processing is
> very fast (multi-Gbps). The bottleneck lies in the memcpy-ing
> packets to buffer portion, which can reach only up to 1
> Gbps. Therefore, the whole program can never exceed 1 Gbps.
It seems very odd that you can transfer data to/from the GPU very fast
but can copy internally via the CPU at only 1 Gbps.
> Is there anyway I can speed up this process?
Can your GPU do DMA? Or must you copy data into/out of it with the
processor? If it can do DMA, I believe that there is an mmap()
interface for libpcap and you would use that, and "double buffer."
Allocate two buffers, point libpcap at one, fill it, point libpcap at
the second one, hand the first to the GPU for it to DMA and process,
and then taking at face value the assertion about the speed of the
GPU, check the completion status once the second buffer has filled via
libpcap. Hand the second buffer to the GPU and go back to libpcap
with the first. lather, rinse, repeat.
rick jones
--
portable adj, code that compiles under more than one compiler
these opinions are mine, all mine; HP might not want them anyway...

feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...