forked from Yujaeseo/ICDM-2021_MASCOT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon_struct.h
More file actions
116 lines (97 loc) · 2.66 KB
/
common_struct.h
File metadata and controls
116 lines (97 loc) · 2.66 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#ifndef COMMON_STRUCT_H
#include <map>
#include <vector>
#include <cuda_fp16.h>
using namespace std;
#define COMMON_STRUCT_H
struct Node{
float r;
unsigned int u;
unsigned int i;
};
struct Index_info_node{
unsigned int g;
unsigned int v;
};
struct Parameter{
Parameter(){}
float lambda;
float learning_rate;
float decay;
float mean_val;
float std_val;
float sample_ratio;
unsigned int interval;
float error_threshold;
unsigned int user_group_num;
unsigned int item_group_num;
unsigned int k;
unsigned int num_workers;
unsigned int epoch;
unsigned int thread_block_size;
};
struct Mf_info{
Mf_info():max_user(0), max_item(0), n(0), test_n(0) {}
Node* R;
Node* d_R;
Node* test_COO;
Node* d_test_COO;
Index_info_node* user_index_info;
Index_info_node* item_index_info;
Index_info_node* d_user_index_info;
Index_info_node* d_item_index_info;
unsigned int* d_user2cnt;
unsigned int* d_item2cnt;
unsigned int* d_user2idx;
unsigned int* d_item2idx;
unsigned int* user2cnt;
unsigned int* item2cnt;
unsigned int* user2idx;
unsigned int* item2idx;
unsigned int* user_group_idx;
unsigned int* item_group_idx;
unsigned int* user_group_size;
unsigned int* item_group_size;
unsigned char* user_group_prec_info;
unsigned char* item_group_prec_info;
unsigned char* d_user_group_prec_info;
unsigned char* d_item_group_prec_info;
unsigned int* user_group_end_idx;
unsigned int* item_group_end_idx;
unsigned int* d_user_group_end_idx;
unsigned int* d_item_group_end_idx;
unsigned int* user2sorted_idx;
unsigned int* item2sorted_idx;
unsigned int* sorted_idx2user;
unsigned int* sorted_idx2item;
unsigned int* d_user2sorted_idx;
unsigned int* d_item2sorted_idx;
float* user_group_error;
float* item_group_error;
float* d_user_group_error;
float* d_item_group_error;
bool is_yahoo;
unsigned int version;
map<unsigned int, unsigned int> user_map, item_map, user_map2orig, item_map2orig;
vector<map<unsigned int, float>> test_R;
unsigned int max_user, max_item, n, test_n;
Parameter params;
};
struct SGD{
SGD(){}
float* p;
float* q;
float* d_p;
float* d_q;
short* half_p;
short* half_q;
__half* d_half_p;
__half* d_half_q;
void** user_group_ptr;
void** item_group_ptr;
void** user_group_d_ptr;
void** item_group_d_ptr;
void** d_user_group_ptr;
void** d_item_group_ptr;
};
#endif