// ================================================================================================= // This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This // project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- // width of 100 characters per line. // // Author(s): // Cedric Nugteren // // This file provides common function declarations to be used with the test clients. // // ================================================================================================= #ifndef CLBLAST_TEST_PERFORMANCE_CLIENT_H_ #define CLBLAST_TEST_PERFORMANCE_CLIENT_H_ #include #include // The libraries to test #include #include "clblast.h" #include "internal/utilities.h" namespace clblast { // ================================================================================================= // Types of devices to consider const cl_device_type kDeviceType = CL_DEVICE_TYPE_ALL; // ================================================================================================= // Shorthand for a BLAS routine with 2 or 3 OpenCL buffers as argument template using Routine2 = std::function&, const Buffer&, const Buffer&, CommandQueue&)>; template using Routine3 = std::function&, const Buffer&, const Buffer&, const Buffer&, CommandQueue&)>; // ================================================================================================= // These are the main client functions, setting-up arguments, matrices, OpenCL buffers, etc. After // set-up, they call the client routine, passed as argument to this function. template void ClientXY(int argc, char *argv[], Routine2 client_routine, const std::vector &options); template void ClientAXY(int argc, char *argv[], Routine3 client_routine, const std::vector &options); template void ClientABC(int argc, char *argv[], Routine3 client_routine, const std::vector &options); // ================================================================================================= // Parses all command-line arguments, filling in the arguments structure. If no command-line // argument is given for a particular argument, it is filled in with a default value. template Arguments ParseArguments(int argc, char *argv[], const std::vector &options, const std::function)> default_ld_a); // Retrieves only the precision command-line argument, since the above function is templated based // on the precision Precision GetPrecision(int argc, char *argv[]); // ================================================================================================= // Runs a function a given number of times and returns the execution time of the shortest instance double TimedExecution(const size_t num_runs, std::function main_computation); // ================================================================================================= // Prints the header of a performance-data table void PrintTableHeader(const bool silent, const std::vector &args); // Prints a row of performance data, including results of two libraries void PrintTableRow(const std::vector &args_int, const std::vector &args_string, const bool abbreviations, const double ms_clblast, const double ms_clblas, const unsigned long long flops, const unsigned long long bytes); // ================================================================================================= } // namespace clblast // CLBLAST_TEST_PERFORMANCE_CLIENT_H_ #endif