tp_memory_interface.hpp 1.35 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
52
#ifndef TP_MEMORY_INTERFACE_H
#define TP_MEMORY_INTERFACE_H

#include <stdio.h>
#include <stdlib.h>

typedef enum { DDR, HBM, SSD, HDD } mem_t;

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

  /************************/
  /*  |-- I/O             */
  /************************/
  //virtual int memWrite  ( iMemory srcMem, int64_t srcSize, int64_t offset );
  //virtual int memRead   ( iMemory srcMem, int64_t srcSize, int64_t offset );
  virtual int memWrite  ( void* srcBuffer, int64_t srcSize, int64_t offset );
  virtual int memRead   ( void* srcBuffer, int64_t srcSize, int64_t offset );
  virtual int memFlush ( );

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

  /************************/
  /*  |-- Characteristics */
  /************************/
  virtual int64_t memBandwidth ( );
  virtual int64_t memLatency   ( );
  virtual int64_t memCapacity  ( );

protected:
  mem_t mem_;
  int masterRank_;
  MPI_Comm comm_;

  void *buffer_;
  int64_t buffSize_;
  MPI_Win RMAWin_;
  
  MPI_File fileHandle_;
  char fileName_[4096];
};

#endif // TP_MEMORY_INTERFACE_H