Skip to content

Commit 0055758

Browse files
committed
submitting now
1 parent adad17a commit 0055758

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

GPU/nn.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ int main(int argc, char* argv[]) {
107107
cudaFree(d_query);
108108
cudaFree(d_max_cosine);
109109

110-
end_time = clock(); // Record the ending time
110+
end_time = clock();
111111

112112
total_cosine_GPU_time = static_cast<double>(end_time - start_time) / CLOCKS_PER_SEC;
113113

114-
std::cout << "Total cosine similarity with GPU: " << total_cosine_GPU_time << " seconds." << std::endl;
114+
std::cout << "Total cosine similarity with GPU: " << total_cosine_GPU_time << std::endl;
115115

116116
return 0;
117117
}

Project Document.docx

1.02 KB
Binary file not shown.

hnsw_implementation/hnsw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void HNSWGraph::Insert(Item& query) {
9494
int maxLayer = layerEdgeLists.size() - 1;
9595
int l = 0;
9696
uniform_real_distribution<double> distribution(0.0,1.0);
97-
while(l < ml && (1.0 / ml <= distribution(generator))) {
97+
while(l < max_layers && (1.0 / max_layers <= distribution(generator))) {
9898
l++;
9999
if (layerEdgeLists.size() <= l) {
100100
layerEdgeLists.push_back(unordered_map<int, vector<int>>());
@@ -110,7 +110,7 @@ void HNSWGraph::Insert(Item& query) {
110110
}
111111
#pragma omp parallel for
112112
for (int i = min(l, maxLayer); i >= 0; i--) {
113-
int MM = l == 0 ? MMax0 : MMax;
113+
int MM = l == 0 ? maxNeighboursIn0 : maxNeighbours;
114114
vector<int> neighbours = searchLayer(query, entry_point, efficientConstruction, i);
115115
vector<int> selectedNeighbours = vector<int>(neighbours.begin(), neighbours.begin()+min(int(neighbours.size()), M));
116116
for (size_t j = 0; j < selectedNeighbours.size(); j++) {

hnsw_implementation/hnsw.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ using namespace std;
1111

1212

1313
struct HNSWGraph {
14-
HNSWGraph(int _M, int _MMax, int _MMax0, int _efficientConstruction, int _ml):M(_M),MMax(_MMax),MMax0(_MMax0),efficientConstruction(_efficientConstruction),ml(_ml){
14+
HNSWGraph(int _M, int _maxNeighbours, int _maxNeighboursIn0, int _efficientConstruction, int _max_layers):M(_M),maxNeighbours(_maxNeighbours),maxNeighboursIn0(_maxNeighboursIn0),efficientConstruction(_efficientConstruction),max_layers(_max_layers){
1515
layerEdgeLists.push_back(unordered_map<int, vector<int>>());
1616
}
1717
int M;
18-
int MMax;
19-
int MMax0;
18+
int maxNeighbours;
19+
int maxNeighboursIn0;
2020
int efficientConstruction;
21-
int ml;
21+
int max_layers;
2222
int itemNum;
2323
vector<Item> items;
2424
vector<unordered_map<int, vector<int>>> layerEdgeLists;

run.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
./my_program $1 $2 $3
2-
cd GPU
3-
./nn ../$1
2+
./nn $1

0 commit comments

Comments
 (0)