/**
 * Copyright (c) 2011, 2012
 * Claudio Kopper <claudio.kopper@icecube.wisc.edu>
 * and the IceCube Collaboration <http://www.icecube.wisc.edu>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 *
 * $Id$
 *
 * @file I3CLSimTesterBase.h
 * @version $Revision$
 * @date $Date$
 * @author Claudio Kopper
 */

#ifndef I3CLSIMTESTERBASE_H_INCLUDED
#define I3CLSIMTESTERBASE_H_INCLUDED

#include "dataclasses/I3Vector.h"
#include "clsim/random_value/I3CLSimRandomValue.h"

#include "clsim/I3CLSimOpenCLDevice.h"

#include "boost/python/tuple.hpp"
#include "boost/python/extract.hpp"

#include <vector>
#include <string>

#define __CL_ENABLE_EXCEPTIONS
#include "clsim/cl.hpp"

class I3CLSimTesterBase
{
public:
    I3CLSimTesterBase();
    
    inline uint64_t GetMaxWorkgroupSize() const {return maxWorkgroupSize;}
    
protected:
    void DoSetup(const I3CLSimOpenCLDevice &device,
                 uint64_t workgroupSize_,
                 uint64_t workItemsPerIteration_,
                 const std::vector<std::string> &source,
                 const std::string compilerOptions="");
    
    std::vector<std::string> sourceStrings_;
    
    boost::shared_ptr<cl::Context> context;
    boost::shared_ptr<cl::Program> program;
    
    boost::shared_ptr<cl::Kernel> kernel;
    uint64_t workgroupSize;
    uint64_t workItemsPerIteration;
    
    boost::shared_ptr<cl::CommandQueue> queue;

private:
    uint64_t maxWorkgroupSize;
    
public:    
    SET_LOGGER("I3CLSimTesterBase");
   
};



#endif //I3CLSIMTESTERBASE_H_INCLUDED
