Commit b91cff79 authored by YdrMaster's avatar YdrMaster
Browse files

issue/63/fix: cleanup code


Signed-off-by: default avatarYdrMaster <ydrml@hotmail.com>
parent 6fc49874
......@@ -47,27 +47,26 @@ struct InfiniopCudaHandle {
int compute_capability_minor;
};
template <typename T>
void use_cublas(std::shared_ptr<Pool<cublasHandle_t>> &cublas_handle_pool, cudaStream_t stream, T const &f) {
auto handle = cublas_handle_pool->pop();
template <class T>
void use_cublas(std::shared_ptr<Pool<cublasHandle_t>> &pool, cudaStream_t stream, T const &f) {
auto handle = pool->pop();
if (!handle) {
cublasCreate(&(*handle));
}
cublasSetStream(*handle, (cudaStream_t)stream);
cublasSetStream(*handle, stream);
f(*handle);
cublas_handle_pool->push(std::move(*handle));
pool->push(std::move(*handle));
}
template <typename T>
cudnnStatus_t use_cudnn(std::shared_ptr<Pool<cudnnHandle_t>> cudnn_handle_pool, int device_id, cudaStream_t stream, T const &f) {
auto handle = cudnn_handle_pool->pop();
template <class T>
void use_cudnn(std::shared_ptr<Pool<cudnnHandle_t>> &pool, cudaStream_t stream, T const &f) {
auto handle = pool->pop();
if (!handle) {
cudnnCreate(&(*handle));
}
cudnnSetStream(*handle, stream);
cudnnStatus_t status = f(*handle);
cudnn_handle_pool->push(std::move(*handle));
return status;
f(*handle);
pool->push(std::move(*handle));
}
inline cudnnDataType_t getCudnnDtype(infiniDtype_t dt) {
......
#include "./matmul_cpu.h"
#include "../../../devices/cpu/common_cpu.h"
#include "../../../devices/cpu/cpu_handle.h"
#include <iostream>
namespace matmul::cpu {
......
......@@ -39,7 +39,7 @@ infiniopStatus_t Descriptor::create(
}
template <typename Tdata>
infiniopStatus_t calculate(
void calculate(
MatmulInfo const &_info,
std::shared_ptr<Pool<cublasHandle_t>> &cublas_handle_pool,
void *c,
......@@ -98,7 +98,6 @@ infiniopStatus_t calculate(
compute_type,
CUBLAS_GEMM_DEFAULT_TENSOR_OP);
});
return INFINIOP_STATUS_SUCCESS;
}
infiniopStatus_t Descriptor::calculate(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment