Hermes  0.9.5-beta
Hierarchical Distributed I/O Buffering System
buffer_pool.cc File Reference
#include "buffer_pool.h"
#include "buffer_pool_internal.h"
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <assert.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <cmath>
#include <iostream>
#include <set>
#include <utility>
#include <vector>
#include <glog/logging.h>
#include "mpi.h"
#include "metadata_management.h"
#include "rpc.h"
#include "debug_state.cc"
#include "memory_management.cc"
#include "config_parser.cc"
#include "utils.cc"
#include "traits.cc"
#include "metadata_management.cc"
#include "buffer_organizer.cc"
Include dependency graph for buffer_pool.cc:

Namespaces

 hermes
 

Functions

bool hermes::operator== (const BufferID &lhs, const BufferID &rhs)
 
void hermes::Finalize (SharedMemoryContext *context, CommunicationContext *comm, RpcContext *rpc, const char *shmem_name, Arena *trans_arena, bool is_application_core, bool force_rpc_shutdown)
 
void hermes::LockBuffer (BufferHeader *header)
 
void hermes::UnlockBuffer (BufferHeader *header)
 
BufferPool * hermes::GetBufferPoolFromContext (SharedMemoryContext *context)
 
Device * hermes::GetDeviceFromHeader (SharedMemoryContext *context, BufferHeader *header)
 
Target * hermes::GetTarget (SharedMemoryContext *context, int index)
 
Target * hermes::GetTargetFromId (SharedMemoryContext *context, TargetID id)
 
std::vector< f32 > hermes::GetBandwidths (SharedMemoryContext *context, const std::vector< TargetID > &targets)
 
Device * hermes::GetDeviceById (SharedMemoryContext *context, DeviceID device_id)
 
DeviceID hermes::GetDeviceIdFromTargetId (TargetID target_id)
 
BufferHeader * hermes::GetHeadersBase (SharedMemoryContext *context)
 
BufferHeader * hermes::GetHeaderByIndex (SharedMemoryContext *context, u32 index)
 
BufferHeader * hermes::GetHeaderByBufferId (SharedMemoryContext *context, BufferID id)
 
void hermes::ResetHeader (BufferHeader *header)
 
static void hermes::MakeHeaderDormant (BufferHeader *header)
 
bool hermes::HeaderIsDormant (BufferHeader *header)
 
i32 hermes::GetSlabUnitSize (SharedMemoryContext *context, DeviceID device_id, int slab_index)
 
i32 hermes::GetSlabBufferSize (SharedMemoryContext *context, DeviceID device_id, int slab_index)
 
BufferID * hermes::GetFreeListPtr (SharedMemoryContext *context, DeviceID device_id)
 
int hermes::GetSlabIndexFromHeader (SharedMemoryContext *context, BufferHeader *header)
 
bool hermes::BufferIsRemote (CommunicationContext *comm, BufferID buffer_id)
 
bool hermes::BufferIsRemote (RpcContext *rpc, BufferID buffer_id)
 
bool hermes::IsNullBufferId (BufferID id)
 
bool hermes::BufferIsByteAddressable (SharedMemoryContext *context, BufferID id)
 
BufferID hermes::PeekFirstFreeBufferId (SharedMemoryContext *context, DeviceID device_id, int slab_index)
 
void hermes::SetFirstFreeBufferId (SharedMemoryContext *context, DeviceID device_id, int slab_index, BufferID new_id)
 
std::atomic< u32 > * hermes::GetAvailableBuffersArray (SharedMemoryContext *context, DeviceID device_id)
 
static u32 hermes::GetNumBuffersAvailable (SharedMemoryContext *context, DeviceID device_id, int slab_index)
 
u32 hermes::GetNumBuffersAvailable (SharedMemoryContext *context, DeviceID device_id)
 
static void hermes::DecrementAvailableBuffers (SharedMemoryContext *context, DeviceID device_id, int slab_index)
 
static void hermes::IncrementAvailableBuffers (SharedMemoryContext *context, DeviceID device_id, int slab_index)
 
void hermes::UpdateBufferingCapacities (SharedMemoryContext *context, i64 adjustment, DeviceID device_id)
 
void hermes::LocalReleaseBuffer (SharedMemoryContext *context, BufferID buffer_id)
 
void hermes::ReleaseBuffer (SharedMemoryContext *context, RpcContext *rpc, BufferID buffer_id)
 
void hermes::ReleaseBuffers (SharedMemoryContext *context, RpcContext *rpc, const std::vector< BufferID > &buffer_ids)
 
void hermes::LocalReleaseBuffers (SharedMemoryContext *context, const std::vector< BufferID > &buffer_ids)
 
BufferID hermes::GetFreeBuffer (SharedMemoryContext *context, DeviceID device_id, int slab_index)
 
std::vector< BufferID > hermes::GetBuffers (SharedMemoryContext *context, const PlacementSchema &schema)
 
u32 hermes::LocalGetBufferSize (SharedMemoryContext *context, BufferID id)
 
u32 hermes::GetBufferSize (SharedMemoryContext *context, RpcContext *rpc, BufferID id)
 
size_t hermes::GetBlobSize (SharedMemoryContext *context, RpcContext *rpc, BufferIdArray *buffer_ids)
 
size_t hermes::GetBlobSizeById (SharedMemoryContext *context, RpcContext *rpc, Arena *arena, BlobID blob_id)
 
ptrdiff_t hermes::GetBufferOffset (SharedMemoryContext *context, BufferID id)
 
u8 * hermes::GetRamBufferPtr (SharedMemoryContext *context, BufferID buffer_id)
 
BufferID hermes::MakeBufferId (u32 node_id, u32 header_index)
 
void hermes::PartitionRamBuffers (Arena *arena, i32 buffer_size, i32 buffer_count, int block_size)
 
BufferID hermes::MakeBufferHeaders (Arena *arena, int buffer_size, u32 start_index, u32 end_index, int node_id, DeviceID device_id, ptrdiff_t initial_offset, u8 **header_begin)
 
Device * hermes::InitDevices (Arena *arena, Config *config, f32 &min_bw, f32 &max_bw)
 
Target * hermes::InitTargets (Arena *arena, Config *config, Device *devices, int node_id)
 
void hermes::MergeRamBufferFreeList (SharedMemoryContext *context, int slab_index)
 
void hermes::SplitRamBufferFreeList (SharedMemoryContext *context, int slab_index)
 
ptrdiff_t hermes::InitBufferPool (u8 *shmem_base, Arena *buffer_pool_arena, Arena *scratch_arena, i32 node_id, Config *config)
 
void hermes::SerializeBufferPoolToFile (SharedMemoryContext *context, FILE *file)
 
void hermes::MakeFullShmemName (char *dest, const char *base)
 
FILE * hermes::FopenOrTerminate (const char *fname, const char *mode)
 
int hermes::OpenOrTerminate (const std::string &fname, int flags, mode_t mode=0)
 
void hermes::InitFilesForBuffering (SharedMemoryContext *context, CommunicationContext &comm)
 
u8 * hermes::InitSharedMemory (const char *shmem_name, size_t total_size)
 
SharedMemoryContext hermes::GetSharedMemoryContext (char *shmem_name)
 
void hermes::UnmapSharedMemory (SharedMemoryContext *context)
 
void hermes::CloseBufferingFiles (SharedMemoryContext *context)
 
void hermes::ReleaseSharedMemoryContext (SharedMemoryContext *context)
 
size_t hermes::LocalWriteBufferById (SharedMemoryContext *context, BufferID id, const Blob &blob, size_t offset)
 
void hermes::WriteBlobToBuffers (SharedMemoryContext *context, RpcContext *rpc, const Blob &blob, const std::vector< BufferID > &buffer_ids)
 
size_t hermes::LocalReadBufferById (SharedMemoryContext *context, BufferID id, Blob *blob, size_t read_offset)
 
size_t hermes::ReadBlobFromBuffers (SharedMemoryContext *context, RpcContext *rpc, Blob *blob, BufferIdArray *buffer_ids, u32 *buffer_sizes)
 
size_t hermes::ReadBlobById (SharedMemoryContext *context, RpcContext *rpc, Arena *arena, Blob blob, BlobID blob_id)
 
size_t hermes::ReadBlobById (SharedMemoryContext *context, RpcContext *rpc, Arena *arena, api::Blob &dest, BlobID blob_id)
 
void hermes::OpenSwapFile (SharedMemoryContext *context, u32 node_id)
 
SwapBlob hermes::WriteToSwap (SharedMemoryContext *context, Blob blob, u32 node_id, BucketID bucket_id)
 
SwapBlob hermes::PutToSwap (SharedMemoryContext *context, RpcContext *rpc, const std::string &name, BucketID bucket_id, const u8 *data, size_t size)
 
size_t hermes::ReadFromSwap (SharedMemoryContext *context, Blob blob, SwapBlob swap_blob)
 
api::Status hermes::PlaceBlob (SharedMemoryContext *context, RpcContext *rpc, PlacementSchema &schema, Blob blob, const std::string &name, BucketID bucket_id, const api::Context &ctx, bool called_from_buffer_organizer)
 
api::Status hermes::StdIoPersistBucket (SharedMemoryContext *context, RpcContext *rpc, Arena *arena, BucketID bucket_id, const std::string &file_name, const std::string &open_mode)
 
api::Status hermes::StdIoPersistBlob (SharedMemoryContext *context, RpcContext *rpc, Arena *arena, BlobID blob_id, int fd, const i32 &offset)
 

Detailed Description

Implementation of a BufferPool that lives in shared memory. Other processes interact with the BufferPool by requesting buffers through the GetBuffers call to reserve a set of BufferIDs and then using those IDs for I/O. Remote processes can request remote buffers via the GetBuffers RPC call.