-
Notifications
You must be signed in to change notification settings - Fork 0
/
recommendations_kernel.h
25 lines (18 loc) · 1.56 KB
/
recommendations_kernel.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
#include "ratings_util.h"
#define BLOCK_DIM_X 32
#define BLOCK_DIM_Y 32
#define BLOCK_SIZE_SIMILARITY 256 // chosen for 100% occupancy
#define BLOCK_SIZE_RECOMMENDATION 1024 // chosen for 100% occupancy
#define BLOCK_SIZE_DENORMALIZATION 1024
#define TILE_SIZE_SIMILARITY 1024 // assumption max TILE_SIZE ratings per row for SIMILARITY
#define TILE_SIZE_RECOMMENDATION 4096 // assumption max TILE_SIZE ratings per row for RECOMMENDATIONS
SimilarityMatrix computeSimilarityParallel(unsigned int dim, unsigned int *csrRowPtr_d, unsigned int *csrColIdx_d,
float *csrData_d, float *userEuclideanNorm_d);
void allocateMemoryToDevicePtrs(unsigned int dim, unsigned int **csrRowPtr_d, unsigned int **csrColIdx_d,
float **csrData_d, float **userEuclideanNorm_d, RatingsMatrixCSR &ratingMatrix);
void copyRatingsMatrixToDevicePtrs(unsigned int dim, unsigned int *csrRowPtr_d, unsigned int *csrColIdx_d, float *csrData_d,
float *userEuclideanNorm_d, RatingsMatrixCSR &ratingMatrix);
void freeDevicePtrs(unsigned int *csrRowPtr_d, unsigned int *csrColIdx_d, float *csrData_d, float *userEuclideanNorm_d);
vector<ItemRating> calculateTopNRecommendationsForUserParallel(unsigned int *csrRowPtr_d, unsigned int *csrColIdx_d, float *csrData_d,
SimilarityMatrix similarityMatrix, vector<unsigned int> movieIds,
RatingsMatrixCSR &ratingMatrix, unsigned int user_id, unsigned int N);