-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathComputePlatform.h
More file actions
63 lines (43 loc) · 1.39 KB
/
ComputePlatform.h
File metadata and controls
63 lines (43 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// ComputePlatform.hpp
// ParallelDTM
//
// Created by Thales Sabino on 8/25/16.
// Copyright © 2016 Thales Sabino. All rights reserved.
//
#pragma once
#define __CL_ENABLE_EXCEPTIONS
#ifdef _WIN32
# include <CL/cl.hpp>
#else
# include "CL/cl.hpp"
#endif
#include <vector>
#include <mutex>
#include <map>
#include "Point.h"
#define PRINT_DEVICE_NAMES 0
#define DEBUG_OPERATION \
ThePlatform.PrintDeviceName(__FUNCTION__, Queue)
class ComputePlatform
{
public:
static int GetPlatformCount();
static double GetEventElapsedTime(cl::Event Event);
explicit ComputePlatform(int PlatformIndex = 0, int NumDevices = -1);
cl::Program CreateProgram(const std::string& SourceFilepath);
cl::CommandQueue GetNextCommandQueue();
void PrintDeviceName(const std::string& Description, cl::CommandQueue Queue);
void RecordEvent(const std::vector<std::string>& Tags, cl::Event Event);
void RecordTime(const std::vector<std::string>& Tags, long int Time);
public:
cl::Platform Platform;
cl::Context Context;
std::vector<cl::Device> Devices;
std::vector<cl::CommandQueue> CommandQueues;
std::mutex CommandQueuesMutex;
std::mutex RecordEventMutex;
bool bProfile;
std::map<std::string, long int> ProfilingMap;
};
std::ostream& operator<< (std::ostream& out, const ComputePlatform& aComputingPlatorm);