From 8de4e3bdd6b24f55a1a6c9acb97233d7a18b021c Mon Sep 17 00:00:00 2001 From: qijun Date: Thu, 10 Aug 2017 12:24:49 +0800 Subject: [PATCH] disable gpu implementation temporarily --- paddle/operators/math/math_function.cu | 6 ++++++ paddle/operators/math/math_function.h | 29 +++++++------------------- paddle/operators/mul_op.cu | 3 ++- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/paddle/operators/math/math_function.cu b/paddle/operators/math/math_function.cu index 3e2aeea1d..b7d2c48a5 100644 --- a/paddle/operators/math/math_function.cu +++ b/paddle/operators/math/math_function.cu @@ -26,6 +26,7 @@ void gemm( platform::DeviceContext* context) { // Note that cublas follows fortran order, so the order is different from // the cblas convention. + /* cublasOperation_t cuTransA = (transA == CblasNoTrans) ? CUBLAS_OP_N : CUBLAS_OP_T; cublasOperation_t cuTransB = @@ -34,6 +35,8 @@ void gemm( PADDLE_ENFORCE(platform::dynload::cublasSgemm( reinterpret_cast(context)->cublas_handle(), cuTransB, cuTransA, N, M, K, &alpha, B, ldb, A, lda, &beta, C, ldc)); + */ + PADDLE_THROW("not implemented now"); } template <> @@ -44,6 +47,7 @@ void gemm( const int ldc, platform::DeviceContext* context) { // Note that cublas follows fortran order, so the order is different from // the cblas convention. + /* cublasOperation_t cuTransA = (transA == CblasNoTrans) ? CUBLAS_OP_N : CUBLAS_OP_T; cublasOperation_t cuTransB = @@ -51,6 +55,8 @@ void gemm( PADDLE_ENFORCE(platform::dynload::cublasDgemm( reinterpret_cast(context)->cublas_handle(), cuTransB, cuTransA, N, M, K, &alpha, B, ldb, A, lda, &beta, C, ldc)); + */ + PADDLE_THROW("not implemented now"); } template <> diff --git a/paddle/operators/math/math_function.h b/paddle/operators/math/math_function.h index f068f4a15..7a214e3a5 100644 --- a/paddle/operators/math/math_function.h +++ b/paddle/operators/math/math_function.h @@ -40,36 +40,23 @@ extern "C" { #include #include "paddle/framework/tensor.h" #include "paddle/platform/device_context.h" +#include "paddle/platform/enforce.h" namespace paddle { namespace operators { namespace math { template -void gemm(const CBLAS_TRANSPOSE transA, - const CBLAS_TRANSPOSE transB, - const int M, - const int N, - const int K, - const T alpha, - const T* A, - const int lda, - const T* B, - const int ldb, - const T beta, - T* C, - const int ldc, - platform::DeviceContext* context); +void gemm(const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, + const int M, const int N, const int K, const T alpha, const T* A, + const int lda, const T* B, const int ldb, const T beta, T* C, + const int ldc, platform::DeviceContext* context); // matrix multiply with continous memory template -void matmul(const framework::Tensor& in1, - bool in1_T, - const framework::Tensor& in2, - bool in2_T, - float alpha, - framework::Tensor* out, - float beta, +void matmul(const framework::Tensor& in1, bool in1_T, + const framework::Tensor& in2, bool in2_T, float alpha, + framework::Tensor* out, float beta, platform::DeviceContext* context); } // namespace math diff --git a/paddle/operators/mul_op.cu b/paddle/operators/mul_op.cu index 7435b74bd..aac5a6936 100644 --- a/paddle/operators/mul_op.cu +++ b/paddle/operators/mul_op.cu @@ -15,4 +15,5 @@ #define EIGEN_USE_GPU #include "paddle/operators/mul_op.h" -REGISTER_OP_GPU_KERNEL(mul, ops::MulKernel); +// REGISTER_OP_GPU_KERNEL(mul, ops::MulKernel); -- GitLab