tp_memory.hpp 1.21 KB
Newer Older
1 2 3 4 5
#ifndef TP_MEMORY_H
#define TP_MEMORY_H

#include <stdio.h>
#include <stdlib.h>
6
#include <string.h>
7 8 9 10 11
#include <sys/mman.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
12 13
#include <mpi.h>
#include <hbwmalloc.h>
14 15 16 17 18 19

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

class Memory: public iMemory {
public:
20 21
  Memory ( );
  ~Memory ( );
22 23 24
  /**********************/
  /*  |-- Allocation    */
  /**********************/
25 26
  void memAlloc ( int64_t buffSize, mem_t mem, bool masterRank, char* fileName, MPI_Comm comm );
  void memFree  ( );
27 28 29 30

  /**********************/
  /*  |-- I/O           */
  /**********************/
31 32 33 34
  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 ( );
35 36 37 38

  /**********************/
  /*  |-- Utils         */
  /**********************/
39 40
  char* memName  ( );
  mem_t memType  ( char* name );
41 42 43 44

  /************************/
  /*  |-- Characteristics */
  /************************/
45 46 47 48
  int64_t memBandwidth   ( );
  int64_t memLatency     ( );
  int64_t memCapacity    ( );
  bool    memPersistency ( );
49 50 51 52
};

#endif // TP_MEMORY_H