hl_sparse_stub.h 7.8 KB
Newer Older
1
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
Z
zhangjinchao01 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

#ifndef HL_SPARSE_STUB_H_
#define HL_SPARSE_STUB_H_

#include "hl_sparse.h"

inline void hl_malloc_sparse_matrix(hl_sparse_matrix_s *A_d,
                                    hl_matrix_format_t format,
22
                                    hl_matrix_value_t value_type,
Z
zhangjinchao01 已提交
23 24 25 26 27 28 29
                                    int dimM,
                                    int dimN,
                                    int nnz) {}

inline void hl_free_sparse_matrix(hl_sparse_matrix_s A_d) {}

inline void hl_construct_sparse_matrix(hl_sparse_matrix_s *A_d,
30
                                       void *dest_d,
Z
zhangjinchao01 已提交
31 32
                                       size_t size,
                                       hl_matrix_format_t format,
33
                                       hl_matrix_value_t value_type,
Z
zhangjinchao01 已提交
34 35 36 37 38
                                       int dimM,
                                       int dimN,
                                       int nnz) {}

inline void hl_construct_sparse_matrix(hl_sparse_matrix_s *A_d,
39 40 41
                                       real *value_d,
                                       int *rows_d,
                                       int *cols_d,
Z
zhangjinchao01 已提交
42
                                       hl_matrix_format_t format,
43
                                       hl_matrix_value_t value_type,
Z
zhangjinchao01 已提交
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
                                       int dimM,
                                       int dimN,
                                       int nnz) {}

inline void hl_destruct_sparse_matrix(hl_sparse_matrix_s A_d) {}

inline void hl_memcpy_csr_matrix(hl_sparse_matrix_s csr_matrix,
                                 real *csr_val,
                                 int *csr_row,
                                 int *csr_col,
                                 hl_stream_t stream) {}

inline void hl_memcpy_csc_matrix(hl_sparse_matrix_s csc_matrix,
                                 real *csc_val,
                                 int *csc_row,
                                 int *csc_col,
                                 hl_stream_t stream) {}

inline void hl_memcpy_sparse_matrix(hl_sparse_matrix_s dst,
                                    hl_sparse_matrix_s src,
                                    hl_stream_t stream) {}

inline void hl_matrix_csr2dense(hl_sparse_matrix_s A_d,
                                real *C_d,
                                int dimM,
                                int dimN) {}

inline void hl_matrix_csc2dense(hl_sparse_matrix_s A_d,
                                real *C_d,
                                int dimM,
                                int dimN) {}

inline void hl_matrix_csr_mul_dense(hl_sparse_matrix_s A_d,
                                    hl_trans_op_t transa,
                                    real *B_d,
                                    hl_trans_op_t transb,
                                    real *C_d,
                                    int dimM,
                                    int dimN,
                                    int dimK,
                                    real alpha,
                                    real beta) {}

inline void hl_matrix_csc_mul_dense(hl_sparse_matrix_s A_d,
                                    hl_trans_op_t transa,
89 90
                                    real *B_d,
                                    hl_trans_op_t transb,
Z
zhangjinchao01 已提交
91
                                    real *C_d,
92 93 94 95 96
                                    int dimM,
                                    int dimN,
                                    int dimK,
                                    real alpha,
                                    real beta) {}
Z
zhangjinchao01 已提交
97 98 99 100 101 102 103 104 105 106 107 108

inline void hl_matrix_dense_mul_csc(real *A_d,
                                    hl_trans_op_t transa,
                                    hl_sparse_matrix_s B_d,
                                    hl_trans_op_t transb,
                                    real *C_d,
                                    int dimM,
                                    int dimN,
                                    int dimK,
                                    real alpha,
                                    real beta) {}

109 110 111 112
inline void hl_sparse_matrix_mul(real *A_d,
                                 hl_trans_op_t transa,
                                 real *B_d,
                                 hl_trans_op_t transb,
Z
zhangjinchao01 已提交
113
                                 hl_sparse_matrix_s C_d,
114 115 116 117 118
                                 int dimM,
                                 int dimN,
                                 int dimK,
                                 real alpha,
                                 real beta) {}
Z
zhangjinchao01 已提交
119

120 121
inline void hl_matrix_dense_mul_csr(real *A_d,
                                    hl_trans_op_t transa,
Z
zhangjinchao01 已提交
122 123 124
                                    hl_sparse_matrix_s B_d,
                                    hl_trans_op_t transb,
                                    real *C_d,
125 126 127 128 129
                                    int dimM,
                                    int dimN,
                                    int dimK,
                                    real alpha,
                                    real beta) {}
Z
zhangjinchao01 已提交
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148

inline void hl_memcpy_from_csc_matrix(real *csc_val,
                                      size_t val_size,
                                      int *csc_row,
                                      size_t row_size,
                                      int *csc_col,
                                      size_t col_size,
                                      hl_sparse_matrix_s csc_matrix,
                                      hl_stream_t stream) {}

inline void hl_memcpy_from_csr_matrix(real *csr_val,
                                      size_t val_size,
                                      int *csr_row,
                                      size_t row_size,
                                      int *csr_col,
                                      size_t col_size,
                                      hl_sparse_matrix_s csr_matrix,
                                      hl_stream_t stream) {}

149 150
inline void hl_sparse_matrix_column_sum(
    real *A_d, hl_sparse_matrix_s B_d, int dimM, int dimN, real scale) {}
Z
zhangjinchao01 已提交
151

152 153
inline void hl_matrix_csr_column_sum(
    real *A_d, hl_sparse_matrix_s B_d, int dimM, int dimN, real scale) {}
Z
zhangjinchao01 已提交
154 155

inline void hl_sparse_matrix_add_bias(hl_sparse_matrix_s A_d,
156
                                      real *B_d,
Z
zhangjinchao01 已提交
157 158 159
                                      real scale) {}

inline void hl_matrix_csr_add_bias(hl_sparse_matrix_s A_d,
160
                                   real *B_d,
Z
zhangjinchao01 已提交
161 162 163
                                   real scale) {}

inline void hl_sparse_matrix_add_dense(hl_sparse_matrix_s A_d,
164
                                       real *B_d,
Z
zhangjinchao01 已提交
165 166 167 168 169 170
                                       int dimM,
                                       int dimN,
                                       real alpha,
                                       real beta) {}

inline void hl_matrix_csr_add_dense(hl_sparse_matrix_s A_d,
171
                                    real *B_d,
Z
zhangjinchao01 已提交
172 173 174 175 176
                                    int dimM,
                                    int dimN,
                                    real alpha,
                                    real beta) {}

177
inline int *hl_sparse_matrix_get_rows(hl_sparse_matrix_s sMat) { return NULL; }
Z
zhangjinchao01 已提交
178

179
inline int *hl_sparse_matrix_get_cols(hl_sparse_matrix_s sMat) { return NULL; }
Z
zhangjinchao01 已提交
180

181
inline real *hl_sparse_matrix_get_value(hl_sparse_matrix_s sMat) {
Z
zhangjinchao01 已提交
182 183 184 185
  return NULL;
}

#endif  // HL_SPARSE_STUB_H_