SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
|
3 #include "smaug/core/datatypes.h"
5 #include "smaug/utility/utils.h"
11 int err = posix_memalign(
12 (
void**)&ptr, CACHELINE_SIZE,
next_multiple(size, CACHELINE_SIZE));
13 assert(err == 0 &&
"Failed to allocate memory!");
21 case DataLayout::NCHW:
23 case DataLayout::NHWC:
30 assert(
false &&
"Unknown data layout!");
36 if (alignment == 0 || value % alignment == 0)
38 return (alignment - (value % alignment));
51 m5_dump_stats(0, period, msg);
56 m5_dump_reset_stats(0, period, msg);
75 void dumpStats(
const char* msg,
int period) {}
86 ScopedStats::ScopedStats(
const char* _startLabel,
87 const char* _endLabel,
89 : startLabel(_startLabel), endLabel(_endLabel),
90 resetStats(_resetStats) {
97 ScopedStats::~ScopedStats() {
int getCpuId()
Returns the logical CPU number.
void * malloc_aligned(size_t size, bool zeroOut)
Return heap-allocated cacheline-aligned memory.
void wakeCpu(int id)
Wakes up a quiesced CPU.
bool runningInSimulation
This is true if the user chooses to run the network in gem5 simulation.
The smaug namespace is the parent namespace of all C++ code in SMAUG.
int calc_padding(int value, unsigned alignment)
Return the difference between value and the next multiple of alignment.
Utilities for writing and invoking Aladdin kernels from Operators.
std::string dataLayoutToStr(DataLayout layout)
Get the string version of DataLayout.
void quiesce()
Puts the CPU to sleep.
void dumpStats(const char *msg, int period)
Dumps gem5 stats to the stats.txt file.
void switchCpu()
Switches to the next CPU type.
size_t next_multiple(size_t request, size_t align)
Returns the smallest multiple of align that is >= request.
void dumpResetStats(const char *msg, int period)
Dumps gem5 stats to the stats.txt file and resets all stats.