Loading benchmark/_common/CMakeLists.txt +2 −2 Original line number Diff line number Diff line Loading @@ -15,13 +15,13 @@ endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(THREADS_PREFER_PTHREAD_FLAG ON) set(CMAKE_CUDA_STANDARD 14) set(CMAKE_CUDA_STANDARD 17) set(CMAKE_CUDA_STANDARD_REQUIRED ON) set(CMAKE_CUDA_EXTENSIONS OFF) Loading benchmark/_common/benchmark.hpp +24 −1 Original line number Diff line number Diff line Loading @@ -3,16 +3,25 @@ #include <algorithm> #include <chrono> #include <cstdlib> #include <filesystem> #include <fstream> #include <iostream> #include <limits.h> #include <map> #include <numeric> #include <random> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> #ifdef WINDOWS #include <windows.h> #else #include <unistd.h> #endif #include "zipf.hpp" namespace Benchmark { Loading Loading @@ -168,6 +177,19 @@ std::map<std::string, double> runner(Code &&code, std::vector<Type> input, return result; } std::filesystem::path getExecutablePath() { std::string res; #ifdef WINDOWS char result[MAX_PATH]; res = std::string(result, GetModuleFileName(nullptr, result, MAX_PATH)); #else char result[PATH_MAX]; ssize_t count = readlink("/proc/self/exe", result, PATH_MAX); res = std::string(result, (count > 0) ? count : 0); #endif return std::filesystem::path(res).remove_filename(); } template <typename Device, typename Type, typename Code> void execRun(const std::string &dataName, Code &&code, int attempts, std::map<std::string, std::map<std::string, double>> &row, Loading Loading @@ -233,7 +255,8 @@ void execute(const std::string name, Code &&code, int from = 10, int to = 17, } for (auto const &it : result) { std::ofstream file("_results/" + it.first + ".csv"); std::ofstream file(getExecutablePath() / "../" / "_results" / (it.first + ".csv")); file << it.second.str(); } } Loading Loading
benchmark/_common/CMakeLists.txt +2 −2 Original line number Diff line number Diff line Loading @@ -15,13 +15,13 @@ endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(THREADS_PREFER_PTHREAD_FLAG ON) set(CMAKE_CUDA_STANDARD 14) set(CMAKE_CUDA_STANDARD 17) set(CMAKE_CUDA_STANDARD_REQUIRED ON) set(CMAKE_CUDA_EXTENSIONS OFF) Loading
benchmark/_common/benchmark.hpp +24 −1 Original line number Diff line number Diff line Loading @@ -3,16 +3,25 @@ #include <algorithm> #include <chrono> #include <cstdlib> #include <filesystem> #include <fstream> #include <iostream> #include <limits.h> #include <map> #include <numeric> #include <random> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> #ifdef WINDOWS #include <windows.h> #else #include <unistd.h> #endif #include "zipf.hpp" namespace Benchmark { Loading Loading @@ -168,6 +177,19 @@ std::map<std::string, double> runner(Code &&code, std::vector<Type> input, return result; } std::filesystem::path getExecutablePath() { std::string res; #ifdef WINDOWS char result[MAX_PATH]; res = std::string(result, GetModuleFileName(nullptr, result, MAX_PATH)); #else char result[PATH_MAX]; ssize_t count = readlink("/proc/self/exe", result, PATH_MAX); res = std::string(result, (count > 0) ? count : 0); #endif return std::filesystem::path(res).remove_filename(); } template <typename Device, typename Type, typename Code> void execRun(const std::string &dataName, Code &&code, int attempts, std::map<std::string, std::map<std::string, double>> &row, Loading Loading @@ -233,7 +255,8 @@ void execute(const std::string name, Code &&code, int from = 10, int to = 17, } for (auto const &it : result) { std::ofstream file("_results/" + it.first + ".csv"); std::ofstream file(getExecutablePath() / "../" / "_results" / (it.first + ".csv")); file << it.second.str(); } } Loading