From 8131e68664e02c8a1bc5a0f5598294fd3bc5b974 Mon Sep 17 00:00:00 2001 From: mcian Date: Mon, 17 Jul 2017 12:00:25 +0200 Subject: Add PSO parameters support and search strategy selection from command line --- src/utilities/utilities.hpp | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'src/utilities') diff --git a/src/utilities/utilities.hpp b/src/utilities/utilities.hpp index 03051354..54214c49 100644 --- a/src/utilities/utilities.hpp +++ b/src/utilities/utilities.hpp @@ -28,6 +28,21 @@ #include "utilities/clblast_exceptions.hpp" #include "utilities/msvc.hpp" +#define FULL_SEARCH_STRATEGY 0 +#define RANDOM_SEARCH_STRATEGY 1 +#define PSO_STRATEGY 2 +#define DVDT_STRATEGY 3 + +#define DEFAULT_STRATEGY 0 + +#define DEFAULT_PSO_SWARM 8 +#define DEFAULT_PSO_G 0.3 +#define DEFAULT_PSO_L 0.6 +#define DEFAULT_PSO_R 0.1 + +#ifdef XGEMM_EXEC +extern bool tStrategyFlag; +#endif namespace clblast { // ================================================================================================= @@ -47,6 +62,12 @@ constexpr auto kUnknownError = -999; // ================================================================================================= +constexpr auto tStrategy = "strategy"; +constexpr auto psoSwarmSize = "psoSwarmSize"; +constexpr auto psoInfG = "psoInfG"; +constexpr auto psoInfL = "psoInfL"; +constexpr auto psoInfR = "psoInfR"; + // The routine-specific arguments in string form constexpr auto kArgM = "m"; constexpr auto kArgN = "n"; @@ -172,13 +193,13 @@ struct Arguments { T beta = ConstantOne(); // Batch-specific arguments size_t batch_count = 1; - std::vector x_offsets; // = {0}; - std::vector y_offsets; // = {0}; - std::vector a_offsets; // = {0}; - std::vector b_offsets; // = {0}; - std::vector c_offsets; // = {0}; - std::vector alphas; // = {ConstantOne()}; - std::vector betas; // = {ConstantOne()}; + std::vector x_offsets = {0}; + std::vector y_offsets = {0}; + std::vector a_offsets = {0}; + std::vector b_offsets = {0}; + std::vector c_offsets = {0}; + std::vector alphas = {ConstantOne()}; + std::vector betas = {ConstantOne()}; // Sizes size_t x_size = 1; size_t y_size = 1; @@ -206,8 +227,16 @@ struct Arguments { bool print_help = false; bool silent = false; bool no_abbrv = false; + + int tStrategy = DEFAULT_STRATEGY; + size_t psoSwarmSize = DEFAULT_PSO_SWARM; + double psoInfG = DEFAULT_PSO_G; + double psoInfL = DEFAULT_PSO_L; + double psoInfR = DEFAULT_PSO_R; }; + + // Structure containing all possible buffers for test clients template struct Buffers { -- cgit v1.2.3