forked from thesiddharth/dpsvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cache.hpp
45 lines (34 loc) · 859 Bytes
/
cache.hpp
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
#ifndef CACHE_H
#define CACHE_H
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cuda.h>
#include <cblas.h>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/copy.h>
#include <thrust/fill.h>
#include <thrust/sequence.h>
#include <thrust/for_each.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/inner_product.h>
#include <thrust/extrema.h>
#include <map>
#include <list>
#include <vector>
#include <iostream>
class myCache {
private:
int line_size;
int max_size;
int size;
std::vector< thrust::device_vector<float> > lines;
std::map<int, int> my_map;
std::list<int> order;
public:
void dump_map_contents();
myCache(int max_size, int line_size);
thrust::device_vector<float>* lookup(int key);
thrust::device_vector<float>& get_new_cache_line(int key);
};
#endif