Poplar and PopLibs
poplar::program::Copy Class Reference

A program that copies data. More...

#include <Program.hpp>

Inheritance diagram for poplar::program::Copy:
poplar::program::Program

Public Member Functions

 Copy (Tensor src, Tensor dst, bool dontOutline=false, const DebugContext &debugContext={})
 Construct a program to copy data from one tensor to another. More...
 
 Copy (const DataStream &stream, Tensor dst, bool optimiseMemory=false, const DebugContext &debugContext={})
 Construct a program to copy from a data stream to a tensor. More...
 
 Copy (Tensor src, const DataStream &stream, bool optimiseMemory=false, const DebugContext &debugContext={})
 Construct a program to copy a tensor to a data stream. More...
 
 Copy (const RemoteBuffer &buffer, Tensor dst, const DebugContext &debugContext={})
 Construct a program to copy a remote buffer to a tensor. More...
 
 Copy (const RemoteBuffer &buffer, Tensor dst, Tensor offset, const DebugContext &debugContext={})
 Construct a program to copy a remote buffer to a tensor. More...
 
 Copy (Tensor src, const RemoteBuffer &buffer, const DebugContext &debugContext={})
 Construct a program to copy a tensor to a remote buffer. More...
 
 Copy (Tensor src, const RemoteBuffer &buffer, Tensor offset, const DebugContext &debugContext={})
 Construct a program to copy a tensor to a remote buffer. More...
 
 Copy (const FunctionBuffer &buffer, const Function &function, const DebugContext &debugContext={})
 Construct a program to copy the contents of a FunctionBuffer to a Function. More...
 

Detailed Description

A program that copies data.

Constructor & Destructor Documentation

◆ Copy() [1/8]

poplar::program::Copy::Copy ( Tensor  src,
Tensor  dst,
bool  dontOutline = false,
const DebugContext debugContext = {} 
)

Construct a program to copy data from one tensor to another.

This constructor creates a program that will copy data from the src tensor to the dst tensor.

Parameters
srcThe tensor to copy from.
dstThe tensor to copy to.
dontOutlineDo not outline this copy as a function call. Default is false (the copy will be outlined).
debugContextOptional DebugId and program name.

◆ Copy() [2/8]

poplar::program::Copy::Copy ( const DataStream stream,
Tensor  dst,
bool  optimiseMemory = false,
const DebugContext debugContext = {} 
)

Construct a program to copy from a data stream to a tensor.

See also
See the Poplar User Guide for more information about prefetching.
Parameters
streamThe stream to copy from.
dstThe tensor to copy to.
optimiseMemoryIf set to true, Poplar will sacrifice speed to reduce memory use. For example, it may rearrange data on the host and outline writes. Setting this will disable prefetch.
debugContextOptional DebugId and program name.

◆ Copy() [3/8]

poplar::program::Copy::Copy ( Tensor  src,
const DataStream stream,
bool  optimiseMemory = false,
const DebugContext debugContext = {} 
)

Construct a program to copy a tensor to a data stream.

See also
See the Poplar User Guide for more information about prefetching.
Parameters
srcThe tensor to copy from.
streamThe stream to copy to.
optimiseMemoryIf set to true, Poplar will sacrifice speed to reduce memory use. For example, it may rearrange data on the host and outline writes. Setting this will disable prefetch.
debugContextOptional DebugId and program name.

◆ Copy() [4/8]

poplar::program::Copy::Copy ( const RemoteBuffer buffer,
Tensor  dst,
const DebugContext debugContext = {} 
)

Construct a program to copy a remote buffer to a tensor.

Parameters
bufferThe remote buffer to copy from.
dstThe tensor to copy to.
debugContextOptional DebugId and program name.

◆ Copy() [5/8]

poplar::program::Copy::Copy ( const RemoteBuffer buffer,
Tensor  dst,
Tensor  offset,
const DebugContext debugContext = {} 
)

Construct a program to copy a remote buffer to a tensor.

The data to be transferred is controlled by the definition of the buffer and the offset parameter.

The buffer has repeat data-transfer "rows" each containing numElements data items (these are not necessarily the same as rows in the destination tensor.) The size of offset defines the number of rows to copy. The rows to be copied are defined by offset: each element of offset is the index of a row to be copied.

The size of dst must be equal to the data transfer size: sizeof(offset) * numElements.

If the offset tensor has more than one element then the dst must be a rank 2 tensor with dimensions [offset.numElements(), remoteBuffer.numElements()].

Multiple values in the offset tensor with the same value will result in undefined behaviour because the order of writes to the buffer is not guaranteed.

See also
Graph::addRemoteBuffer()
Parameters
bufferThe remote buffer to copy from.
dstThe tensor to copy to.
offsetThe "rows"" in the remote buffer to copy from.
debugContextOptional DebugId and program name.

◆ Copy() [6/8]

poplar::program::Copy::Copy ( Tensor  src,
const RemoteBuffer buffer,
const DebugContext debugContext = {} 
)

Construct a program to copy a tensor to a remote buffer.

Parameters
srcThe tensor to copy from.
bufferThe remote buffer buffer to copy to.
debugContextOptional DebugId and program name.

◆ Copy() [7/8]

poplar::program::Copy::Copy ( Tensor  src,
const RemoteBuffer buffer,
Tensor  offset,
const DebugContext debugContext = {} 
)

Construct a program to copy a tensor to a remote buffer.

The data that is transferred is controlled by the definition of the buffer and the offset parameter.

The buffer has repeat data transfer "rows" each containing numElements data items. (These are not necessarily the same as rows in the source tensor) The rows to be copied are defined by offset. The size of offset defines the number of rows to copy. Each element of offset is the index of a row to be copied.

The size of src must be equal to the data transfer size: sizeof(offset) * numElements.

If the offset tensor has more than one element then the src must be a rank 2 tensor with dimensions [offset.numElements(), remoteBuffer.numElements()].

Multiple values in the offset tensor with the same value will result in undefined behaviour.

See also
Graph::addRemoteBuffer()
Parameters
srcThe tensor to copy from.
bufferThe remote buffer buffer to copy to.
offsetThe "rows" in the remote buffer to copy to.
debugContextOptional DebugId and program name.

◆ Copy() [8/8]

poplar::program::Copy::Copy ( const FunctionBuffer buffer,
const Function function,
const DebugContext debugContext = {} 
)

Construct a program to copy the contents of a FunctionBuffer to a Function.

Note that there is no Copy program for the inverse direction i.e. Function to FunctionBuffer because no mutable state is stored in a FunctionBuffer.

See also
Graph::addFunctionBuffer()
Parameters
bufferThe FunctionBuffer to copy from.
functionThe Function to copy to.
debugContextOption DebugId and program name.

The documentation for this class was generated from the following file: