<commit_before>/*
 * CLDevice.hpp
 *
 *  Created on: Oct 24, 2009
 *      Author: <NAME>
 */

#ifndef CLDEVICE_HPP_
#define CLDEVICE_HPP_

#include "pv_opencl.h"
#include <stdlib.h>

////////////////////////////////////////////////////////////////////////////////

namespace PV {
   
class CLBuffer;
class CLKernel;

class CLDevice {

protected:
   int device;                           // device id (normally 0 for GPU, 1 for CPU)

public:
   CLDevice(int device);

   int initialize(int device);

   static void print_error_code(int code);

   CLBuffer * createBuffer(cl_mem_flags flags, size_t size, void * host_ptr);

   CLBuffer * createReadBuffer(size_t size)   { return createBuffer(CL_MEM_READ_ONLY, size, NULL); }
   CLBuffer * createWriteBuffer(size_t size)  { return createBuffer(CL_MEM_WRITE_ONLY, size, NULL); }
   CLBuffer * createBuffer(size_t size, void * host_ptr)
                                              { return createBuffer(CL_MEM_USE_HOST_PTR, size, host_ptr); }

   CLKernel * createKernel(const char * filename, const char * name);
   
#ifdef PV_USE_OPENCL

//   int copyResultsBuffer(cl_mem output, void * results, size_t size);

   int query_device_info();
   int query_device_info(int id, cl_device_id device);

protected:

   cl_uint num_devices;                  // number of computing devices

   cl_device_id device_ids[MAX_DEVICES]; // compute device id
   cl_context context;                   // compute context
   cl_command_queue commands;            // compute command queue

   //size_t global;                        // global domain size for our calculation
   //size_t local;                         // local domain size for our calculation

#endif /* PV_USE_OPENCL */
};

} // namespace PV

#endif /* CLDEVICE_HPP_ */<commit_msg>Fixed to build when PV_USE_OPENCL is not defined.<commit_after>/*
 * CLDevice.hpp
 *
 *  Created on: Oct 24, 2009
 *      Author: <NAME>
 */

#ifndef CLDEVICE_HPP_
#define CLDEVICE_HPP_

#include "pv_opencl.h"
#include <stdlib.h>

////////////////////////////////////////////////////////////////////////////////

namespace PV {
   
class CLBuffer;
class CLKernel;

class CLDevice {

protected:
   int device;                           // device id (normally 0 for GPU, 1 for CPU)

public:
   CLDevice(int device);

   int initialize(int device);

   static void print_error_code(int code);

   CLBuffer * createBuffer(cl_mem_flags flags, size_t size, void * host_ptr);

   CLBuffer * createReadBuffer(size_t size)   { return createBuffer(CL_MEM_READ_ONLY, size, NULL); }
   CLBuffer * createWriteBuffer(size_t size)  { return createBuffer(CL_MEM_WRITE_ONLY, size, NULL); }
   CLBuffer * createBuffer(size_t size, void * host_ptr)
                                              { return createBuffer(CL_MEM_USE_HOST_PTR, size, host_ptr); }

   CLKernel * createKernel(const char * filename, const char * name);
   
//   int copyResultsBuffer(cl_mem output, void * results, size_t size);

   int query_device_info();
   int query_device_info(int id, cl_device_id device);

protected:
   cl_uint num_devices;                  // number of computing devices

   cl_device_id device_ids[MAX_DEVICES]; // compute device id
   cl_context context;                   // compute context
   cl_command_queue commands;            // compute command queue
};

} // namespace PV

#endif /* CLDEVICE_HPP_ */
{'fraction_non_alphanumeric': 0.13216513216513218, 'fraction_numerical': 0.004752004752004752, 'mean_word_length': 2.2890625, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5602557', 'n_tokens_mistral': 1010, 'n_tokens_neox': 956, 'n_words': 273}