zero-copy

Zero-copy construction of an Eigen SparseMatrix

回眸只為那壹抹淺笑 提交于 2019-12-10 19:05:31
问题 I have the following problem: I have an Eigen::SparseMatrix I need to send over the network, and my network library only supports sending arrays of primitive types. I can retrieve the pointers to the backing arrays of my SparseMatrix by doing something like (here's the backing object's code): // Get pointers to the indices and values, send data over the network int num_items = sparse_matrix.nonZeros() auto values_ptr = sparse_matrix.data().valuePtr() auto index_ptr = sparse_matrix.data()

How can I use Linux's splice() function to copy a file to another file?

a 夏天 提交于 2019-12-10 03:47:06
问题 here's another question about splice(). I'm hoping to use it to copy files, and am trying to use two splice calls joined by a pipe like the example on splice's Wikipedia page. I wrote a simple test case which only tries to read the first 32K bytes from one file and write them to another: #define _GNU_SOURCE #include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <errno.h> #include <string.h> int main(int argc, char **argv) { int pipefd[2]; int result; FILE *in_file; FILE *out_file;

Does Zero-copy exist in Windows OS?

若如初见. 提交于 2019-12-08 15:59:05
问题 Reading this zero copy article, Does Zero-copy exist in Windows OS (server 2003, 2008, 2008 R2) ? 回答1: Yes, it is supported via the TransmitFile API. I'm pretty sure that IIS uses this as well. Whether or not this method does real zero-copy (i.e. doesn't even copy from the file buffers to the socket buffers) is not explicitly mentioned in the documentation. But given the fact that this method is defined in a way that definitely makes it possible, I'd be highly surprised if this were not the

Linux splice() returning EINVAL (“Invalid argument”)

江枫思渺然 提交于 2019-12-07 10:54:48
问题 I'm trying to experiment with using splice (man 2 splice) to copy data from a UDP socket directly to a file. Unfortunately the first call to splice() returns EINVAL. The man page states: EINVAL Target file system doesn't support splicing; target file is opened in append mode; neither of the descriptors refers to a pipe; or offset given for nonseekable device. However, I believe none of those conditions apply. I'm using Fedora 15 (kernel 2.6.40-4) so I believe splice() is supported on all

Linux sockets: Zero-copy local, TCP/IP remote

百般思念 提交于 2019-12-06 06:09:58
问题 Networking is my worst area in operating systems, so forgive me for asking perhaps an incomplete question. I've been reading about this for a few hours, but it's kinda swimming in my head. (To me, I feel like chip design is easy compared to figuring out networking protocols.) I have some networked services that communicate with each other via sockets. Specifically, the sockets are created with fd = socket(PF_INET, SOCK_STREAM, 0); , which automatically gets TCP/IP. I need this as the base

Linux splice() returning EINVAL (“Invalid argument”)

随声附和 提交于 2019-12-05 12:29:14
I'm trying to experiment with using splice ( man 2 splice ) to copy data from a UDP socket directly to a file. Unfortunately the first call to splice() returns EINVAL. The man page states: EINVAL Target file system doesn't support splicing; target file is opened in append mode; neither of the descriptors refers to a pipe; or offset given for nonseekable device. However, I believe none of those conditions apply. I'm using Fedora 15 (kernel 2.6.40-4) so I believe splice() is supported on all filesystems. The target file should be irrelevant in the first call to splice, but for completeness I'm

FileChannel zero-copy transferTo fails to copy bytes to SocketChannel

落爺英雄遲暮 提交于 2019-12-05 10:33:56
I'm seeing some strange behavior when transferring large files from file to socket using zero-copy in Java. My environments: Windows 7 64-bit JDK 1.6.0_45 and 1.7.0_79. Centos 6.6 64-bit JDK 1.6.0_35 What the program does: client copies an input file into a socket, and server copies socket to output file using zero-copy methods: transferFrom and transferTo. Not all bytes are reaching the server if file size is relatively large, 100Mb+ in case of Windows and 2GB+ in case of Centos. Client and server reside on the same machine and localhost address is used to transfer data. The behavior is

Using Java to perform Zero Copy data transfers between two or more sockets

旧巷老猫 提交于 2019-12-04 18:05:58
问题 Does any one know of any good java libraries/API packages that performs zero copy data transfers between two or more sockets? I know that Java's NIO API can perform zero copy data transfers from disk to socket and vice versa using java.nio.channels.FileChannel.transferTo and java.nio.channels.FileChannel.transferFrom methods respectively. However, there doesn't appear to be support for java socket to socket zero copy transfers. In addition any java libraries/API that can perform the system

How do I store a result using Serde Zero-copy deserialization of a Futures-enabled Hyper Chunk?

丶灬走出姿态 提交于 2019-12-04 03:54:52
问题 I'm using futures, tokio, hyper, and serde_json to request and deserialize some data that I need to hold until my next request. My initial thought was to make a struct containing the hyper::Chunk and the deserialized data that borrows from the Chunk , but couldn't get the lifetimes right. I tried using the rental crate, but I can't get this to work either. Perhaps I'm using the 'buffer lifetime before declaring the buffer Vec , but maybe I've messed something else up: #[rental] pub struct

Cuda zero-copy performance

大憨熊 提交于 2019-12-02 06:52:17
问题 Does anyone have experience with analyzing the performance of CUDA applications utilizing the zero-copy (reference here: Default Pinned Memory Vs Zero-Copy Memory) memory model? I have a kernel that uses the zero-copy feature and with NVVP I see the following: Running the kernel on an average problem size I get instruction replay overhead of 0.7%, so nothing major. And all of this 0.7% is global memory replay overhead. When I really jack up the problem size, I get an instruction replay

工具导航Map