|
|
@ -15,32 +15,16 @@ |
|
|
|
#include "statuscode-tostring.hpp"
|
|
|
|
#include "task-data.hpp"
|
|
|
|
|
|
|
|
double avg(const std::vector<uint64_t>& v) { |
|
|
|
return static_cast<long double>(std::accumulate(v.begin(), v.end(), 0)) / static_cast<long double>(v.size()); |
|
|
|
} |
|
|
|
|
|
|
|
double stdev(const std::vector<uint64_t>& v, const double mean) { |
|
|
|
std::vector<double> diff(v.size()); |
|
|
|
std::transform(v.begin(), v.end(), diff.begin(), [mean](double x) { return x - mean; }); |
|
|
|
const double sq_sum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0); |
|
|
|
const double stdev = std::sqrt(sq_sum / static_cast<double>(v.size())); |
|
|
|
return stdev; |
|
|
|
} |
|
|
|
|
|
|
|
#define LOG_CODE_INFO "Location: " << __FILE__ << "@" << __LINE__ << "::" << __FUNCTION__ << std::endl
|
|
|
|
#define LOG_ERR { pthread_t t = pthread_self(); std::cerr << "--- BEGIN ERROR MSG ---" << std::endl << "Physical: [Node " << args->numa_node << " | Thread " << t << "]" << std::endl; } std::cerr << LOG_CODE_INFO
|
|
|
|
#define CHECK_STATUS(status,msg) { if (status != dml::status_code::ok) { LOG_ERR << "Status Code: " << StatusCodeToString(status) << std::endl << msg << std::endl; args->status = status; return nullptr; }}
|
|
|
|
|
|
|
|
#define ADD_TIMING_MESSUREMENT { if (i >= 5) { submission_durations.emplace_back(std::chrono::duration_cast<std::chrono::microseconds>(se - st).count()); completion_durations.emplace_back(std::chrono::duration_cast<std::chrono::microseconds>(et - se).count()); combined_durations.emplace_back(std::chrono::duration_cast<std::chrono::microseconds>(et - st).count());}}
|
|
|
|
#define ADD_TIMING_MESSUREMENT { if (i >= 5) { args->submit_duration.emplace_back(std::chrono::duration_cast<std::chrono::microseconds>(se - st).count()); args->complete_duration.emplace_back(std::chrono::duration_cast<std::chrono::microseconds>(et - se).count()); args->combined_duration.emplace_back(std::chrono::duration_cast<std::chrono::microseconds>(et - st).count());}}
|
|
|
|
|
|
|
|
template <typename path> |
|
|
|
void* thread_function(void* argp) { |
|
|
|
TaskData* args = reinterpret_cast<TaskData*>(argp); |
|
|
|
|
|
|
|
std::vector<uint64_t> submission_durations; |
|
|
|
std::vector<uint64_t> completion_durations; |
|
|
|
std::vector<uint64_t> combined_durations; |
|
|
|
|
|
|
|
// set numa node and core affinity of the current thread
|
|
|
|
numa_run_on_node(args->numa_node); |
|
|
|
|
|
|
@ -151,13 +135,6 @@ void* thread_function(void* argp) { |
|
|
|
numa_free(src, args->size); |
|
|
|
numa_free(dst, args->size); |
|
|
|
|
|
|
|
args->combined_duration = avg(combined_durations); |
|
|
|
args->complete_duration = avg(completion_durations); |
|
|
|
args->submit_duration = avg(submission_durations); |
|
|
|
args->combined_duration_stdev = stdev(combined_durations, args->combined_duration); |
|
|
|
args->complete_duration_stdev = stdev(completion_durations, args->complete_duration); |
|
|
|
args->submit_duration_stdev = stdev(submission_durations, args->submit_duration); |
|
|
|
|
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
|
|
|
|