Hybrid Query Processing Engine for Coprocessing in Database Systems
HyPE
hype.hpp
Go to the documentation of this file.
00001 /***********************************************************************************************************
00002 Copyright (c) 2012, Sebastian Breß, Otto-von-Guericke University of Magdeburg, Germany. All rights reserved.
00003 
00004 This program and accompanying materials are made available under the terms of the 
00005 GNU LESSER GENERAL PUBLIC LICENSE - Version 3, http://www.gnu.org/licenses/lgpl-3.0.txt
00006 ***********************************************************************************************************/
00007 #pragma once
00008 
00009 #include <config/global_definitions.hpp>
00010 #include <core/specification.hpp>
00011 #include <config/exports.hpp>
00012 
00013 #include <core/algorithm_measurement.hpp>
00014 #include <core/time_measurement.hpp>
00015 #include <core/workload_generator.hpp>
00016 #include <core/statistics_gatherer.hpp>
00017 #include <core/scheduling_decision.hpp>
00018 #include <core/report.hpp>
00019 
00020 namespace hype{
00021 
00022    typedef core::AlgorithmMeasurement AlgorithmMeasurement;
00023    typedef core::Tuple Tuple; 
00024    typedef core::SchedulingDecision SchedulingDecision;
00025    typedef core::Offline_Algorithm Offline_Algorithm;
00026    typedef core::WorkloadGenerator WorkloadGenerator;
00027    typedef core::StatisticsGatherer StatisticsGatherer;
00028    typedef core::Report Report;  
00029    typedef core::AlgorithmSpecification AlgorithmSpecification;
00030    typedef core::OperatorSpecification OperatorSpecification;
00031    typedef core::DeviceSpecification DeviceSpecification;
00032    typedef core::DeviceConstraint DeviceConstraint;
00033    //typedef core::MeasurementPair MeasurementPair;      
00034    
00049    class HYPE_EXPORT Scheduler{
00050       public:
00054       static Scheduler& instance();
00055       /* \brief adds an Algorithm to the AlgorithmPool of operation name_of_operation.
00056        * \details If the specified operation does not exist, it is created. Multiple calls to addAlgorithm
00057        *  with the same Operation name will add the respective algorithms to the algorithm pool of the specified Operation    
00058        * \param name_of_operation name of the operation, where the algorithm belongs to 
00059        * \param name_of_algorithm Name of Algorithm to be created
00060        * \param name_of_statistical_method assigns the StatisticalMethod name_of_statistical_method to the new Algorithm
00061        * \param name_of_recomputation_strategy assigns the RecomputationHeuristic name_of_recomputation_strategy to the new Algorithm
00062        * \return returns true on success and false otherwise   
00063        */         
00064 //    bool addAlgorithm(const std::string& name_of_operation, 
00065 //                            const std::string& name_of_algorithm,
00066 //                            ComputeDevice comp_dev,  
00067 //                            const std::string& name_of_statistical_method, 
00068 //                            const std::string& name_of_recomputation_strategy);
00069                               
00077       bool addAlgorithm(const AlgorithmSpecification& alg_spec, const DeviceSpecification& dev_spec);
00078                         
00079       //addAlgorithm(AlgorithmSpecification,DeviceSpecification);
00080       //getOptAlgorithm(Tuple,std::string operation_name,DeviceConstraint dev_constr);                      
00081                               
00082                               
00088       bool setOptimizationCriterion(const std::string& name_of_operation,
00089                                           const std::string& name_of_optimization_criterion);
00095       bool setStatisticalMethod(const std::string& name_of_algorithm,
00096                                       const std::string& name_of_statistical_method);
00102       bool setRecomputationHeuristic(const std::string& name_of_algorithm,
00103                                      const std::string& name_of_recomputation_strategy);
00104          
00105       /* \brief Returns a Scheduling Decision, which contains the name of the estimated optimal Algorithm 
00106        *  w.r.t. the user specified optimization criterion
00107        * \param name_of_operation name of the operation, where the optimal algorithm is requested
00108        * \param input_values features of the input dataset, which is needed to compute estimated execution times 
00109           for all algortihms of the specified operation
00110        * \return SchedulingDecision, which contains the suggested algortihm for the specified information   
00111        */
00112       //const SchedulingDecision getOptimalAlgorithmName(const std::string& name_of_operation, const Tuple& input_values, DeviceTypeConstraint dev_constr = ANY_DEVICE);
00113       
00120       const SchedulingDecision getOptimalAlgorithm(const OperatorSpecification& op_spec, const DeviceConstraint& dev_constr); 
00121 
00122       /* \brief adds an observed MeasurementPair to the algorithm previously choosen by getOptimalAlgorithmName.
00123        * \param name_of_algorithm name of the algorithm the MeasurementPair belongs to
00124        * \param mp the observed MeasurementPair
00125        * \return true on success and false in case an error occured
00126        */
00127       //bool addObservation(const std::string& name_of_algorithm, const MeasurementPair& mp);
00133       bool addObservation(const SchedulingDecision& sched_dec, const double& measured_execution_time);
00134       /* \brief request an Estimated Execution Time from HyPE for an algorithm for a certain operator
00135        * \param op_spec OperatorSpecification, contains all available information about the operator to execute
00136        * \param alg_name algorithm name
00137        * \return estimated execution time
00138        */         
00139       core::EstimatedTime getEstimatedExecutionTime(const OperatorSpecification& op_spec, const std::string& alg_name);
00140       private:
00143       Scheduler();
00147       Scheduler(const Scheduler&);
00151       Scheduler& operator=( const Scheduler& s );
00152    };
00153    
00154 }; //end namespace hype
00155 
00156 //namespace hype = hype;
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines