diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2018-05-19 17:06:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-19 17:06:37 +0200 |
commit | 507d7bc729eff888dd499e937bf1a636cbdee75b (patch) | |
tree | 8992e9adf3605da614b2d50a8242d8756e5980e6 /src/tuning | |
parent | 0326c7d559792a13a5d8b042f0c4848d71f09d7f (diff) | |
parent | 76e0079a90d02cd0f371d4f25d37f6817cdada8a (diff) |
Merge pull request #284 from CNugteren/routine_tuners_read_kernel_json_from_disk
Routine tuners read kernel JSON from disk
Diffstat (limited to 'src/tuning')
-rw-r--r-- | src/tuning/routines/xgemm.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tuning/routines/xgemm.cpp b/src/tuning/routines/xgemm.cpp index 0721ad7c..92aab611 100644 --- a/src/tuning/routines/xgemm.cpp +++ b/src/tuning/routines/xgemm.cpp @@ -15,8 +15,10 @@ #include <exception> #include <string> #include <vector> +#include <iostream> #include "utilities/utilities.hpp" +#include "test/test_utilities.hpp" #include "tuning/routines/routine_tuner.hpp" namespace clblast { @@ -101,6 +103,22 @@ void TuneXgemm(int argc, char* argv[]) { const auto context = Context(device); auto queue = Queue(context, device); + // Pre-load GEMM kernel tuning results if they exist + printf("* The GEMM routine tuner requires already tuned kernels\n"); + printf(" Applying tuning results from disk if they exist...\n\n"); + const auto kernel_names = {"xgemm_1", "xgemm_direct_1", "copy", "pad", "transpose", "padtranspose"}; + for (const auto& kernel_name : kernel_names) { + const auto tuner_file_name = "clblast_" + std::string{kernel_name} + "_" + + ToString(static_cast<int>(precision)) + ".json"; + printf("* Looking for tuning results in the current folder: '%s'\n", tuner_file_name.c_str()); + if (std::ifstream(tuner_file_name)) { // Checks if the file exists on disk + OverrideParametersFromJSONFiles({tuner_file_name}, device(), precision); + } + else { + printf(" Not found: assuming the kernel '%s' is already tuned\n\n", kernel_name); + } + } + // Run the tuners for the XGEMM routines TuneKernelSelection<T>(platform, device, context, queue, precision, RunGemmRoutine<T>, 64, 2048, 64, 1, num_runs, |