faiss/gpu/GpuResources.cpp

55 lines
1.2 KiB
C++
Raw Normal View History

2017-02-23 06:26:44 +08:00
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
2017-07-30 15:18:45 +08:00
* This source code is licensed under the BSD+Patents license found in the
2017-02-23 06:26:44 +08:00
* LICENSE file in the root directory of this source tree.
*/
// Copyright 2004-present Facebook. All Rights Reserved.
#include "GpuResources.h"
#include "utils/DeviceUtils.h"
namespace faiss { namespace gpu {
GpuResources::~GpuResources() {
}
cublasHandle_t
GpuResources::getBlasHandleCurrentDevice() {
return getBlasHandle(getCurrentDevice());
}
cudaStream_t
GpuResources::getDefaultStreamCurrentDevice() {
return getDefaultStream(getCurrentDevice());
}
std::vector<cudaStream_t>
GpuResources::getAlternateStreamsCurrentDevice() {
return getAlternateStreams(getCurrentDevice());
}
DeviceMemory&
GpuResources::getMemoryManagerCurrentDevice() {
return getMemoryManager(getCurrentDevice());
}
cudaStream_t
GpuResources::getAsyncCopyStreamCurrentDevice() {
return getAsyncCopyStream(getCurrentDevice());
}
void
GpuResources::syncDefaultStream(int device) {
CUDA_VERIFY(cudaStreamSynchronize(getDefaultStream(device)));
}
void
GpuResources::syncDefaultStreamCurrentDevice() {
syncDefaultStream(getCurrentDevice());
}
2017-02-23 06:26:44 +08:00
} } // namespace