forked from jlgreathouse/BabelStream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stream.h
47 lines (35 loc) · 1016 Bytes
/
Stream.h
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
// Copyright (c) 2015-16 Tom Deakin, Simon McIntosh-Smith,
// University of Bristol HPC
//
// For full license terms please see the LICENSE file distributed with this
// source code
#pragma once
#include <vector>
#include <string>
// Array values
#define startA (0.1)
#define startB (0.2)
#define startC (0.0)
#define startScalar (0.4)
template <class T>
class Stream
{
public:
virtual ~Stream(){}
// Kernels
// These must be blocking calls
virtual float read() = 0;
virtual float write() = 0;
virtual float copy() = 0;
virtual float mul() = 0;
virtual float add() = 0;
virtual float triad() = 0;
virtual T dot() = 0;
// Copy memory between host and device
virtual void init_arrays(T initA, T initB, T initC) = 0;
virtual void read_arrays(std::vector<T>& a, std::vector<T>& b, std::vector<T>& c) = 0;
};
// Implementation specific device functions
void listDevices(void);
std::string getDeviceName(const int);
std::string getDeviceDriver(const int);