iblis17 commented on a change in pull request #7741: New operators linalg_syrk, 
linalg_gelqf
URL: https://github.com/apache/incubator-mxnet/pull/7741#discussion_r137577886
 
 

 ##########
 File path: src/operator/linalg_impl.h
 ##########
 @@ -719,4 +719,137 @@ LINALG_GPU_BATCH_POTRI(double)
 
 #endif
 
+//////////////////////////////// SYRK 
////////////////////////////////////////////
+
+// CPU/GPU-versions of BLAS3 function "syrk". Please refer to the 
BLAS3-documentation
+// for further information about the function and its parameters.
+// Note that this is B = syrk(A, B), so B is input and output parameter.
+
+#if MSHADOW_USE_CBLAS == 1
+
+template<typename xpu, typename DType> inline
+void check_syrk(const Tensor<xpu, 2, DType>& A, const Tensor<xpu, 2, DType>& B,
+                DType alpha, DType beta, bool tA) {
+  // Any checking that helps user debug potential problems.
+  CHECK_EQ(B.size(0), B.size(1))
+    << "B must be square symmetric matrix for syrk";
+  CHECK_EQ((tA ? A.size(1) : A.size(0)), B.size(0))
+    << "Non compatible matrix dimensions between inputs A and B for syrk";
+}
+
+#define LINALG_CPU_SYRK(fname, DType) \
+template<> inline \
+void linalg_syrk<cpu, DType>(const Tensor<cpu, 2, DType>& A, \
+                             const Tensor<cpu, 2, DType>& B, DType alpha, \
+                             DType beta, bool tA, Stream<cpu> *s) { \
+  check_syrk(A, B, alpha, beta, tA); \
+  cblas_##fname(CblasRowMajor, CblasLower, (tA ? CblasTrans : CblasNoTrans), \
 
 Review comment:
   Hi, MXNet.jl got compilation error when build from MXNet's master:
   https://travis-ci.org/dmlc/MXNet.jl/jobs/272939237#L1213
   
   any idea?
   ```cpp
   src/operator/contrib/./../linalg_impl.h:782:1: note: in expansion of macro 
?LINALG_CPU_SYRK?
   
    LINALG_CPU_SYRK(ssyrk, float)
   
    ^
   
   src/operator/contrib/./../linalg_impl.h: In function ?void linalg_syrk(const 
mshadow::Tensor<Device, 2, DType>&, const mshadow::Tensor<Device, 2, DType>&, 
DType, DType, bool, mshadow::Stream<Device>*) [with xpu = mshadow::cpu; DType = 
double]?:
   
   src/operator/contrib/./../linalg_impl.h:748:61: error: ?cblas_dsyrk? was not 
declared in this scope
   
                    A.dptr_, A.stride_, beta, B.dptr_, B.stride_); \
   
                                                                ^
   
   src/operator/contrib/./../linalg_impl.h:783:1: note: in expansion of macro 
?LINALG_CPU_SYRK?
   
    LINALG_CPU_SYRK(dsyrk, double)
   
    ^
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to