13 #ifndef HERMES_UTILS_H_
14 #define HERMES_UTILS_H_
29 #if HERMES_ENABLE_TIMING
31 #define HERMES_BEGIN_TIMED_BLOCK(func_name) \
32 auto hermes_timed_block_start_ = std::chrono::high_resolution_clock::now(); \
33 const char *hermes_timed_block_func_name_ = (func_name);
36 #define HERMES_END_TIMED_BLOCK() \
37 auto hermes_timed_block_end_ = std::chrono::high_resolution_clock::now(); \
38 auto hermes_timed_block_elapsed_ = \
39 hermes_timed_block_end_ - hermes_timed_block_start_; \
40 double hermes_timed_block_seconds_ = \
41 std::chrono::duration<double>(hermes_timed_block_elapsed_).count(); \
42 VLOG(1) << hermes_timed_block_func_name_ << " took " \
43 << hermes_timed_block_seconds_ << " seconds\n";
46 #define HERMES_BEGIN_TIMED_BLOCK(func_name)
47 #define HERMES_END_TIMED_BLOCK()
156 std::vector<TargetID> GetDefaultTargets(
size_t n);
167 std::vector<size_t> GenFixedTotalBlobSize(
size_t total_size,
Definition: adapter_utils.cc:35
size_t RoundUpToMultiple(size_t val, size_t multiple)
Definition: utils.cc:22
void FailedLibraryCall(std::string func)
Definition: utils.cc:132
size_t RoundDownToMultiple(size_t val, size_t multiple)
Definition: utils.cc:37
std::vector< std::pair< size_t, TargetID > > PlacementSchema
Definition: hermes_types.h:226
void InitDefaultConfig(Config *config)
Definition: utils.cc:49
uint64_t u64
Definition: hermes_types.h:43
std::vector< hermes::u64 > bytes_available
Definition: utils.h:114
int num_devices
Definition: utils.h:116
std::vector< hermes::f32 > bandwidth
Definition: utils.h:115
std::vector< hermes::u64 > bytes_capacity
Definition: utils.h:113
BlobSizeRange
Definition: utils.h:101