2 #ifndef FRECHET_VIEW_CONCURRENCY_H 3 #define FRECHET_VIEW_CONCURRENCY_H 5 #include <tbb/task_scheduler_init.h> 10 namespace frechet {
namespace app {
42 cl_command_queue
queue =
nullptr;
44 cl_event
event =
nullptr;
67 void setup(
int max_threads);
98 static cl_command_queue
clQueue();
121 static void cpuid(
int leaf,
unsigned int regs[4]);
123 static void cpuid(
int leaf,
int level,
unsigned int regs[4]);
132 typedef std::chrono::high_resolution_clock
Clock;
171 #endif //FRECHET_VIEW_CONCURRENCY_H a singleton class managing concurrency settings for the application.
cl_uint gpu_units
number of GPU units (if known)
time_point printTimer(std::string label, bool do_print=true)
clock benchmark
std::chrono::high_resolution_clock Clock
clock with high resolution; used for performing benchmark measurements
size_t size2_t[2]
tow-dimensional size; used for various OpenCL parameters
cl_command_queue queue
OpenCL command queue.
static void cpuid(int leaf, unsigned int regs[4])
retrieve CPU factory info
static tbb::tbb_thread::id currentThread()
global definitions for all algorithms.
int num_threads
number of logical threads (always known)
static int countThreads()
static const char * findKernelDirectory(const char *subdir)
look up directory containing OpenCL source files ("kernels")
static void maxMaxtrixTile(size2_t &)
set tile size for cubic matrix multiplication. Tiles adapt to local memory and/or compute units....
Clock::time_point time_point
timestamp with high resolution
std::string device_name
name of OpenCL device
int num_cores
number of physical cores (if known)
void findCacheSizes()
retrieve CPU cache sizes
cl_device_id device
OpenCL device.
tbb::task_scheduler_init * tbb_context
controls the number of parallel threads that are used by TBB functions.
cl_platform_id platform
OpenCL platform identifier.
time_point printDebugTimer(std::string label)
clock benchmark and print elapsed time
static bool hasGpuSupport()
static ConcurrencyContext instance
singleton instance
~ConcurrencyContext()
destructor; releases all OpenCL resources
time_point popTimer(std::string label, bool do_print=true)
clock benchmark and remove from stack
bool setupGpu(size2_t max_tile)
set up OpenCL context
static std::string gpuName()
time_point popDebugTimer(std::string label)
clock benchmark and remove from stack
size2_t max_tile
maximum tile size for Boolean matrix multiplication
ConcurrencyContext()
default constructor; does no initialisation
void close()
release all OpenCL resources.
cl_context ctx
OpenCL platform identifier.
static int cacheSize(int level)
size of CPU cache memory
static cl_context clContext()
static cl_uint countGpuUnits()
static cl_command_queue clQueue()
void pushTimer()
start a new benchmark timer and push it to stack
void setup(int max_threads)
set up TBB thread count
cl_int clerr
last OpenCL return code