diff --git a/cpp/include/cuml/neighbors/knn.hpp b/cpp/include/cuml/neighbors/knn.hpp index d91a7d035e..5eb208b1ed 100644 --- a/cpp/include/cuml/neighbors/knn.hpp +++ b/cpp/include/cuml/neighbors/knn.hpp @@ -46,6 +46,10 @@ struct knnIndex { ~knnIndex() { delete index; delete gpu_res; + + // to check that destructor is not called twice + index = nullptr; + gpu_res = nullptr; } }; diff --git a/cpp/src_prims/selection/knn.cuh b/cpp/src_prims/selection/knn.cuh index 4d3a0f5dc7..8d91a03cf7 100644 --- a/cpp/src_prims/selection/knn.cuh +++ b/cpp/src_prims/selection/knn.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -270,7 +270,8 @@ void approx_knn_build_index(ML::knnIndex *index, ML::knnIndexParam *params, faiss::gpu::StandardGpuResources *gpu_res = new faiss::gpu::StandardGpuResources(); - gpu_res->noTempMemory(); + //gpu_res->noTempMemory(); + gpu_res->setTempMemory(3000000000); gpu_res->setCudaMallocWarning(false); gpu_res->setDefaultStream(device, userStream); index->gpu_res = gpu_res;