diff options
-rw-r--r-- | src/graph/expression_operators.cpp | 2 | ||||
-rw-r--r-- | src/graph/node_operators_binary.h | 7 | ||||
-rw-r--r-- | src/graph/node_operators_unary.h | 6 | ||||
-rw-r--r-- | src/layers/convolution.cpp | 4 | ||||
-rw-r--r-- | src/layers/convolution.h | 3 |
5 files changed, 20 insertions, 2 deletions
diff --git a/src/graph/expression_operators.cpp b/src/graph/expression_operators.cpp index aaf8cb7e..d7e25b5a 100644 --- a/src/graph/expression_operators.cpp +++ b/src/graph/expression_operators.cpp @@ -441,6 +441,7 @@ Expr shift(Expr a, Shape shift) { //} #ifdef CUDA_FOUND +#ifdef CUDNN Expr avg_pooling(Expr x, int height, @@ -505,4 +506,5 @@ Expr pooling_with_masking(Expr x, Expr mask, int width, bool isEven) { } #endif +#endif } diff --git a/src/graph/node_operators_binary.h b/src/graph/node_operators_binary.h index dfc75542..b5476e68 100644 --- a/src/graph/node_operators_binary.h +++ b/src/graph/node_operators_binary.h @@ -4,9 +4,12 @@ #include "functional/functional.h" #include "graph/node.h" -#include "tensors/gpu/cudnn_wrappers.h" #include "tensors/tensor_operators.h" +#ifdef CUDNN +#include "tensors/gpu/cudnn_wrappers.h" +#endif + namespace marian { class DotNodeOp : public NaryNodeOp { @@ -737,6 +740,7 @@ struct HighwayNodeOp : public NaryNodeOp { const std::string type() { return "highway"; } }; +#ifdef CUDNN class ConvolutionOp : public NaryNodeOp { public: ConvolutionOp(const std::vector<Expr>& nodes, @@ -773,4 +777,5 @@ public: protected: ConvolutionWrapper conv_; }; +#endif } diff --git a/src/graph/node_operators_unary.h b/src/graph/node_operators_unary.h index 1e0c71e6..acc84c9c 100644 --- a/src/graph/node_operators_unary.h +++ b/src/graph/node_operators_unary.h @@ -7,7 +7,9 @@ #include "graph/node.h" #include "tensors/tensor_operators.h" -//#include "tensors/gpu/cudnn_wrappers.h" +#ifdef CUDNN +#include "tensors/gpu/cudnn_wrappers.h" +#endif namespace marian { @@ -1068,6 +1070,7 @@ struct ShiftNodeOp : public UnaryNodeOp { // Ptr<sparse::CSR> lf_; //}; +#ifdef CUDNN class PoolingOp : public UnaryNodeOp { public: PoolingOp(Expr x, @@ -1101,6 +1104,7 @@ public: protected: PoolingWrapper pooling_; }; +#endif class PoolingWithMaskingOp : public UnaryNodeOp { public: diff --git a/src/layers/convolution.cpp b/src/layers/convolution.cpp index eb1b0554..d4298e0b 100644 --- a/src/layers/convolution.cpp +++ b/src/layers/convolution.cpp @@ -2,6 +2,8 @@ #include "graph/node_operators_binary.h" namespace marian { + +#ifdef CUDNN Convolution::Convolution(Ptr<ExpressionGraph> graph) : Factory(graph) {} Expr Convolution::apply(Expr x) { @@ -29,4 +31,6 @@ Expr Convolution::apply(const std::vector<Expr>&) { ABORT("Can't apply convolution on many inputs at once"); return nullptr; } +#endif + } diff --git a/src/layers/convolution.h b/src/layers/convolution.h index ae2c5c74..24ee6dd3 100644 --- a/src/layers/convolution.h +++ b/src/layers/convolution.h @@ -7,6 +7,7 @@ namespace marian { +#ifdef CUDNN class Convolution : public Factory { protected: Ptr<Options> getOptions() { return options_; } @@ -82,4 +83,6 @@ protected: std::vector<int> kernelNums_; int stride_; }; +#endif + } |