Skip to content

I/O Unit #53

Description

@s-cavalier

Write a dedicated iostream style class for interacting with IO because it's not entirely obvious how we're going to have to deal with input and output. So the goal is that we can write classes that derive from a base I/O stream class to easily configure this later on.

Action items:

  • Write a dedicated CRTP base class IStream and OStream.
  • These should allow for both a templated size_t for the underlying buffer size and an allocator to get the actual memory from, and then just use that memory as buffer space. There should be space for a Derived as well. I recommend writing a concept for this to specify the expectations of what a Derived must implement to avoid getting insane error messages.
  • For both I and O stream, implement << and >> functions based on "expected" implemented functions by using an upcast. Look into CRTP and how istream/ostream work under the hood and replace the dynamic-inheritance style implementations with static-inheritance implementations.
  • Optional: write a small IOStream class inheriting from both I and O stream for convenience.

I recommend testing this with the network.h class used for TCP sockets in the MVP. The TCP protocol is incredibly simple, 4 bytes which is batch number N, then N Tensors (float) of size ( i believe 3, 128. So total 4 * 3 * 128 bytes ). Then we just send a single byte 0-11 which is argmax of the result for each of the Tensors we process.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions