"git@developer.sourcefind.cn:tsoc/superbenchmark.git" did not exist on "25db1115259536a69022e75cbe84c56cd8d477cf"
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 { ...@@ -47,27 +47,26 @@ struct InfiniopCudaHandle {
int compute_capability_minor; int compute_capability_minor;
}; };
template <typename T> template <class T>
void use_cublas(std::shared_ptr<Pool<cublasHandle_t>> &cublas_handle_pool, cudaStream_t stream, T const &f) { void use_cublas(std::shared_ptr<Pool<cublasHandle_t>> &pool, cudaStream_t stream, T const &f) {
auto handle = cublas_handle_pool->pop(); auto handle = pool->pop();
if (!handle) { if (!handle) {
cublasCreate(&(*handle)); cublasCreate(&(*handle));
} }
cublasSetStream(*handle, (cudaStream_t)stream); cublasSetStream(*handle, stream);
f(*handle); f(*handle);
cublas_handle_pool->push(std::move(*handle)); pool->push(std::move(*handle));
} }
template <typename T> template <class T>
cudnnStatus_t use_cudnn(std::shared_ptr<Pool<cudnnHandle_t>> cudnn_handle_pool, int device_id, cudaStream_t stream, T const &f) { void use_cudnn(std::shared_ptr<Pool<cudnnHandle_t>> &pool, cudaStream_t stream, T const &f) {
auto handle = cudnn_handle_pool->pop(); auto handle = pool->pop();
if (!handle) { if (!handle) {
cudnnCreate(&(*handle)); cudnnCreate(&(*handle));
} }
cudnnSetStream(*handle, stream); cudnnSetStream(*handle, stream);
cudnnStatus_t status = f(*handle); f(*handle);
cudnn_handle_pool->push(std::move(*handle)); pool->push(std::move(*handle));
return status;
} }
inline cudnnDataType_t getCudnnDtype(infiniDtype_t dt) { inline cudnnDataType_t getCudnnDtype(infiniDtype_t dt) {
......
#include "./matmul_cpu.h" #include "./matmul_cpu.h"
#include "../../../devices/cpu/common_cpu.h" #include "../../../devices/cpu/common_cpu.h"
#include "../../../devices/cpu/cpu_handle.h" #include "../../../devices/cpu/cpu_handle.h"
#include <iostream>
namespace matmul::cpu { namespace matmul::cpu {
......
...@@ -39,7 +39,7 @@ infiniopStatus_t Descriptor::create( ...@@ -39,7 +39,7 @@ infiniopStatus_t Descriptor::create(
} }
template <typename Tdata> template <typename Tdata>
infiniopStatus_t calculate( void calculate(
MatmulInfo const &_info, MatmulInfo const &_info,
std::shared_ptr<Pool<cublasHandle_t>> &cublas_handle_pool, std::shared_ptr<Pool<cublasHandle_t>> &cublas_handle_pool,
void *c, void *c,
...@@ -98,7 +98,6 @@ infiniopStatus_t calculate( ...@@ -98,7 +98,6 @@ infiniopStatus_t calculate(
compute_type, compute_type,
CUBLAS_GEMM_DEFAULT_TENSOR_OP); CUBLAS_GEMM_DEFAULT_TENSOR_OP);
}); });
return INFINIOP_STATUS_SUCCESS;
} }
infiniopStatus_t Descriptor::calculate( 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