summaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-03-20 09:51:48 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-03-20 09:51:48 +0000
commitcdbec799d9babdfc9b69d65c0ce052728c01b449 (patch)
treeeeb20b841be5f25fcf659d6cb5cb79e561131fdc /eval
parent0872d6ae54cd64ceb2762a0e326ae962b3834427 (diff)
Stick with one way of getting an accelrator.
Diffstat (limited to 'eval')
-rw-r--r--eval/src/tests/ann/nns-l2.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/eval/src/tests/ann/nns-l2.h b/eval/src/tests/ann/nns-l2.h
index cd8b2569438..82a95741200 100644
--- a/eval/src/tests/ann/nns-l2.h
+++ b/eval/src/tests/ann/nns-l2.h
@@ -1,7 +1,7 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <string.h>
+#include <cstring>
#include <vespa/vespalib/util/arrayref.h>
#include <vespa/vespalib/hwaccelrated/iaccelrated.h>
@@ -34,24 +34,24 @@ static double hw_l2_sq_dist(const T * af, const T * bf, size_t sz)
template <typename FltType = float>
struct L2DistCalc {
- vespalib::hwaccelrated::IAccelrated::UP _hw;
+ const vespalib::hwaccelrated::IAccelrated & _hw;
- L2DistCalc() : _hw(vespalib::hwaccelrated::IAccelrated::createAccelrator()) {}
+ L2DistCalc() : _hw(vespalib::hwaccelrated::IAccelrated::getAccelrator()) {}
using Arr = vespalib::ArrayRef<FltType>;
using ConstArr = vespalib::ConstArrayRef<FltType>;
double product(const FltType *v1, const FltType *v2, size_t sz) {
- return _hw->dotProduct(v1, v2, sz);
+ return _hw.dotProduct(v1, v2, sz);
}
double product(ConstArr v1, ConstArr v2) {
const FltType *p1 = v1.begin();
const FltType *p2 = v2.begin();
- return _hw->dotProduct(p1, p2, v1.size());
+ return _hw.dotProduct(p1, p2, v1.size());
}
double l2sq(ConstArr vector) {
const FltType *v = vector.begin();
- return _hw->dotProduct(v, v, vector.size());
+ return _hw.dotProduct(v, v, vector.size());
}
double l2sq_dist(ConstArr v1, ConstArr v2, Arr tmp) {
for (size_t i = 0; i < v1.size(); ++i) {