tp_memory.hpp 1.19 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#ifndef TP_MEMORY_H
#define TP_MEMORY_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <mpi.h>

#include "tp_utils.hpp"
#include "tp_memory_interface.hpp"

class Memory: public iMemory {
public:
  Memory ( );
  ~Memory ( );
  /**********************/
  /*  |-- Allocation    */
  /**********************/
  void memAlloc ( int64_t buffSize, mem_t mem, bool masterRank, char* fileName, MPI_Comm comm );
  void memFree  ( );

  /**********************/
  /*  |-- I/O           */
  /**********************/
  int memWrite ( void* srcBuffer, int64_t srcSize, int64_t offset, int destRank );
  int memRead  ( void* srcBuffer, int64_t srcSize, int64_t offset, int destRank ); 
  int memFlush ( );
  int memUncache ( );

  /**********************/
  /*  |-- Utils         */
  /**********************/
  char* memName  ( );
  mem_t memType  ( char* name );

  /************************/
  /*  |-- Characteristics */
  /************************/
  int64_t memBandwidth   ( );
  int64_t memLatency     ( );
  int64_t memCapacity    ( );
  bool    memPersistency ( );
};

#endif // TP_MEMORY_H