forked from kaldi-asr/kaldi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cu-kernels.h
1559 lines (1544 loc) · 78.2 KB
/
cu-kernels.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// cudamatrix/cu-kernels.h
// Copyright 2009-2012 Karel Vesely
// 2013 Ehsan Variani
// 2014 Johns Hopkins University (author: Daniel Povey)
// 2013 Hainan Xu
// 2013 Xiaohui Zhang
// 2013-2015 Guoguo Chen
// 2016-2018 Shiyin Kang
// See ../../COPYING for clarification regarding multiple authors
//
// 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
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing permissions and
// limitations under the License.
#ifndef KALDI_CUDAMATRIX_CU_KERNELS_H_
#define KALDI_CUDAMATRIX_CU_KERNELS_H_
#if HAVE_CUDA == 1
#include "base/kaldi-error.h"
#include "cudamatrix/cu-kernels-ansi.h"
/*
* In this file are C++ templated wrappers
* of the ANSI-C CUDA kernels
*/
namespace kaldi {
inline void cuda_add_col_sum_mat(int Gr, int Bl, double* result,
const double* mat, const MatrixDim d,
const double alpha, const double beta) {
cudaD_add_col_sum_mat(Gr, Bl, result, mat, d, alpha, beta);
}
inline void cuda_add_col_sum_mat(int Gr, int Bl, float* result,
const float* mat, const MatrixDim d,
const float alpha, const float beta) {
cudaF_add_col_sum_mat(Gr, Bl, result, mat, d, alpha, beta);
}
inline void cuda_add_cols(dim3 Gr, dim3 Bl, double* dst, const double* src,
const MatrixIndexT_cuda* reorder, MatrixDim dst_dim,
int src_stride) {
cudaD_add_cols(Gr, Bl, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_add_cols(dim3 Gr, dim3 Bl, float* dst, const float* src,
const MatrixIndexT_cuda* reorder, MatrixDim dst_dim,
int src_stride) {
cudaF_add_cols(Gr, Bl, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_add_diag_mat_mat_MN(dim3 Gr, dim3 Bl, const double alpha,
const double* M, const int stride_M,
const double* N, const MatrixDim dim_N,
const double beta, double* v) {
cudaD_add_diag_mat_mat_MN(Gr, Bl, alpha, M, stride_M, N, dim_N, beta, v);
}
inline void cuda_add_diag_mat_mat_MN(dim3 Gr, dim3 Bl, const float alpha,
const float* M, const int stride_M,
const float* N, const MatrixDim dim_N,
const float beta, float* v) {
cudaF_add_diag_mat_mat_MN(Gr, Bl, alpha, M, stride_M, N, dim_N, beta, v);
}
inline void cuda_add_diag_mat_mat_MNT(int Gr, int Bl, const double alpha,
const double* M, const MatrixDim dim_M,
const double* N, const int stride_N,
const double beta, double* v) {
cudaD_add_diag_mat_mat_MNT(Gr, Bl, alpha, M, dim_M, N, stride_N, beta, v);
}
inline void cuda_add_diag_mat_mat_MNT(int Gr, int Bl, const float alpha,
const float* M, const MatrixDim dim_M,
const float* N, const int stride_N,
const float beta, float* v) {
cudaF_add_diag_mat_mat_MNT(Gr, Bl, alpha, M, dim_M, N, stride_N, beta, v);
}
inline void cuda_add_diag_mat_mat_MTN(dim3 Gr, dim3 Bl, const double alpha,
const double* M, const int stride_M,
const double* N, const MatrixDim dim_N,
const double beta, double* v,
const int stride_v) {
cudaD_add_diag_mat_mat_MTN(Gr, Bl, alpha, M, stride_M, N, dim_N, beta, v,
stride_v);
}
inline void cuda_add_diag_mat_mat_MTN(dim3 Gr, dim3 Bl, const float alpha,
const float* M, const int stride_M,
const float* N, const MatrixDim dim_N,
const float beta, float* v,
const int stride_v) {
cudaF_add_diag_mat_mat_MTN(Gr, Bl, alpha, M, stride_M, N, dim_N, beta, v,
stride_v);
}
inline void cuda_add_diag_packed(int Gr, int Bl, double* mat, double value,
int dim) {
cudaD_add_diag_packed(Gr, Bl, mat, value, dim);
}
inline void cuda_add_diag_packed(int Gr, int Bl, float* mat, float value,
int dim) {
cudaF_add_diag_packed(Gr, Bl, mat, value, dim);
}
inline void cuda_add_diag_vec_mat(dim3 Gr, dim3 Bl, double alpha, double *mat,
MatrixDim mat_dim, const double *vec,
const double *mat2, int mat2_row_stride,
int mat2_col_stride, double beta) {
cudaD_add_diag_vec_mat(Gr, Bl, alpha, mat, mat_dim, vec, mat2,
mat2_row_stride, mat2_col_stride, beta);
}
inline void cuda_add_diag_vec_mat(dim3 Gr, dim3 Bl, float alpha, float *mat,
MatrixDim mat_dim, const float *vec,
const float *mat2, int mat2_row_stride,
int mat2_col_stride, float beta) {
cudaF_add_diag_vec_mat(Gr, Bl, alpha, mat, mat_dim, vec, mat2,
mat2_row_stride, mat2_col_stride, beta);
}
inline void cuda_add(dim3 Gr, dim3 Bl, double *mat, double value, MatrixDim d) {
cudaD_add(Gr, Bl, mat, value, d);
}
inline void cuda_add(dim3 Gr, dim3 Bl, float *mat, float value, MatrixDim d) {
cudaF_add(Gr, Bl, mat, value, d);
}
inline void cuda_add_mat_blockmat(dim3 Gr, dim3 Bl, double *data, MatrixDim d,
const double *Adata, int A_num_rows,
int A_num_cols, int A_row_stride,
int A_col_stride,
const CuBlockMatrixData *B_cu_data,
int B_num_blocks, double alpha, double beta,
int B_trans) {
cudaD_add_mat_blockmat(Gr, Bl, data, d, Adata, A_num_rows, A_num_cols,
A_row_stride, A_col_stride, B_cu_data, B_num_blocks,
alpha, beta, B_trans);
}
inline void cuda_add_mat_blockmat(dim3 Gr, dim3 Bl, float *data, MatrixDim d,
const float *Adata, int A_num_rows,
int A_num_cols, int A_row_stride,
int A_col_stride,
const CuBlockMatrixData *B_cu_data,
int B_num_blocks, float alpha, float beta,
int B_trans) {
cudaF_add_mat_blockmat(Gr, Bl, data, d, Adata, A_num_rows, A_num_cols,
A_row_stride, A_col_stride, B_cu_data, B_num_blocks,
alpha, beta, B_trans);
}
inline void cuda_add_mat_blocks(dim3 Gr, dim3 Bl, double alpha,
const double *src, int32_cuda num_row_blocks,
int32_cuda num_col_blocks, double *dst,
MatrixDim d, int src_stride, int A_trans) {
cudaD_add_mat_blocks(Gr, Bl, alpha, src, num_row_blocks, num_col_blocks, dst,
d, src_stride, A_trans);
}
inline void cuda_add_mat_blocks(dim3 Gr, dim3 Bl, float alpha, const float *src,
int32_cuda num_row_blocks,
int32_cuda num_col_blocks, float *dst,
MatrixDim d, int src_stride, int A_trans) {
cudaF_add_mat_blocks(Gr, Bl, alpha, src, num_row_blocks, num_col_blocks, dst,
d, src_stride, A_trans);
}
inline void cuda_add_mat_repeated(dim3 Gr, dim3 Bl, double alpha,
const double *src, MatrixDim src_dim,
double *dst, MatrixDim dst_dim) {
cudaD_add_mat_repeated(Gr, Bl, alpha, src, src_dim, dst, dst_dim);
}
inline void cuda_add_mat_repeated(dim3 Gr, dim3 Bl, float alpha,
const float *src, MatrixDim src_dim,
float *dst, MatrixDim dst_dim) {
cudaF_add_mat_repeated(Gr, Bl, alpha, src, src_dim, dst, dst_dim);
}
inline void cuda_add_mat_diag_vec(dim3 Gr, dim3 Bl, double alpha, double *mat,
MatrixDim mat_dim, const double *mat2,
int mat2_row_stride, int mat2_col_stride,
const double *vec, double beta) {
cudaD_add_mat_diag_vec(Gr, Bl, alpha, mat, mat_dim, mat2, mat2_row_stride,
mat2_col_stride, vec, beta);
}
inline void cuda_add_mat_diag_vec(dim3 Gr, dim3 Bl, float alpha, float *mat,
MatrixDim mat_dim, const float *mat2,
int mat2_row_stride, int mat2_col_stride,
const float *vec, float beta) {
cudaF_add_mat_diag_vec(Gr, Bl, alpha, mat, mat_dim, mat2, mat2_row_stride,
mat2_col_stride, vec, beta);
}
inline void cuda_add_mat(dim3 Gr, dim3 Bl, double alpha, const double *src,
double *dst, MatrixDim d, int src_stride,
int A_trans) {
cudaD_add_mat(Gr, Bl, alpha, src, dst, d, src_stride, A_trans);
}
inline void cuda_add_mat(dim3 Gr, dim3 Bl, float alpha, const float *src,
float *dst, MatrixDim d, int src_stride, int A_trans) {
cudaF_add_mat(Gr, Bl, alpha, src, dst, d, src_stride, A_trans);
}
inline void cuda_add_mat_mat_elements(dim3 Gr, dim3 Bl, double *data,
const double *srcA_data,
const double *srcB_data, MatrixDim dim,
int srcA_stride, int srcB_stride,
double alpha, double beta) {
cudaD_add_mat_mat_elements(Gr, Bl, data, srcA_data, srcB_data, dim,
srcA_stride, srcB_stride, alpha, beta);
}
inline void cuda_add_mat_mat_elements(dim3 Gr, dim3 Bl, float *data,
const float *srcA_data,
const float *srcB_data, MatrixDim dim,
int srcA_stride, int srcB_stride,
float alpha, float beta) {
cudaF_add_mat_mat_elements(Gr, Bl, data, srcA_data, srcB_data, dim,
srcA_stride, srcB_stride, alpha, beta);
}
inline void cuda_add_row_ranges(dim3 Gr, dim3 Bl, double *data, MatrixDim dim,
const double *src_data, MatrixDim src_dim,
const Int32Pair *indexes) {
cudaD_add_row_ranges(Gr, Bl, data, dim, src_data, src_dim, indexes);
}
inline void cuda_add_row_ranges(dim3 Gr, dim3 Bl, float *data, MatrixDim dim,
const float *src_data, MatrixDim src_dim,
const Int32Pair *indexes) {
cudaF_add_row_ranges(Gr, Bl, data, dim, src_data, src_dim, indexes);
}
inline void cuda_add_rows(dim3 Gr, dim3 Bl, double alpha, double* dst,
const double* const * src, MatrixDim dst_dim) {
cudaD_add_rows_direct(Gr, Bl, alpha, dst, src, dst_dim);
}
inline void cuda_add_rows(dim3 Gr, dim3 Bl, float alpha, float* dst,
const float* const * src, MatrixDim dst_dim) {
cudaF_add_rows_direct(Gr, Bl, alpha, dst, src, dst_dim);
}
inline void cuda_add_rows(dim3 Gr, dim3 Bl, double alpha, double* dst,
const double* src, const MatrixIndexT_cuda* reorder,
MatrixDim dst_dim, int src_stride) {
cudaD_add_rows(Gr, Bl, alpha, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_add_rows(dim3 Gr, dim3 Bl, float alpha, float* dst,
const float* src, const MatrixIndexT_cuda* reorder,
MatrixDim dst_dim, int src_stride) {
cudaF_add_rows(Gr, Bl, alpha, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_mul_rows(dim3 Gr, dim3 Bl, double* dst,
const double* src, const MatrixIndexT_cuda* reorder,
MatrixDim dst_dim, int src_stride) {
cudaD_mul_rows(Gr, Bl, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_mul_rows(dim3 Gr, dim3 Bl, float* dst,
const float* src, const MatrixIndexT_cuda* reorder,
MatrixDim dst_dim, int src_stride) {
cudaF_mul_rows(Gr, Bl, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_add_smat(dim3 Gr, dim3 Bl, double* mat, MatrixDim mat_dim,
double alpha, const int* smat_row_ptr,
const int* smat_col_idx, const double* smat_val) {
cudaD_add_smat(Gr, Bl, mat, mat_dim, alpha, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_add_smat(dim3 Gr, dim3 Bl, float* mat, MatrixDim mat_dim,
float alpha, const int* smat_row_ptr,
const int* smat_col_idx, const float* smat_val) {
cudaF_add_smat(Gr, Bl, mat, mat_dim, alpha, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_add_smat_trans(dim3 Gr, dim3 Bl, double* mat,
MatrixDim mat_dim, double alpha,
const int* smat_row_ptr,
const int* smat_col_idx,
const double* smat_val) {
cudaD_add_smat_trans(Gr, Bl, mat, mat_dim, alpha, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_add_smat_trans(dim3 Gr, dim3 Bl, float* mat, MatrixDim mat_dim,
float alpha, const int* smat_row_ptr,
const int* smat_col_idx,
const float* smat_val) {
cudaF_add_smat_trans(Gr, Bl, mat, mat_dim, alpha, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_add_to_rows(dim3 Gr, dim3 Bl, double alpha,
double* const * dst, const double* src,
MatrixDim src_dim) {
cudaD_add_to_rows_direct(Gr, Bl, alpha, dst, src, src_dim);
}
inline void cuda_add_to_rows(dim3 Gr, dim3 Bl, float alpha, float* const * dst,
const float* src, MatrixDim src_dim) {
cudaF_add_to_rows_direct(Gr, Bl, alpha, dst, src, src_dim);
}
inline void cuda_add_to_rows(dim3 Gr, dim3 Bl, double alpha,
double* dst, const double* src,
const MatrixIndexT_cuda* reorder,
MatrixDim src_dim, int dst_stride) {
cudaD_add_to_rows(Gr, Bl, alpha, dst, src, reorder, src_dim, dst_stride);
}
inline void cuda_add_to_rows(dim3 Gr, dim3 Bl, float alpha,
float* dst, const float* src,
const MatrixIndexT_cuda* reorder,
MatrixDim src_dim, int dst_stride) {
cudaF_add_to_rows(Gr, Bl, alpha, dst, src, reorder, src_dim, dst_stride);
}
inline void cuda_add_vec2(dim3 Gr, dim3 Bl, double *mat, const double *vec,
const double alpha, int dim) {
cudaD_add_vec2(Gr, Bl, mat, vec, alpha, dim);
}
inline void cuda_add_vec2(dim3 Gr, dim3 Bl, float *mat, const float *vec,
const float alpha, int dim) {
cudaF_add_vec2(Gr, Bl, mat, vec, alpha, dim);
}
inline void cuda_add_vec_to_cols(dim3 Gr, dim3 Bl, double alpha,
const double *col, double beta, double *dst,
MatrixDim d) {
cudaD_add_vec_to_cols(Gr, Bl, alpha, col, beta, dst, d);
}
inline void cuda_add_vec_to_cols(dim3 Gr, dim3 Bl, float alpha,
const float *col, float beta, float *dst,
MatrixDim d) {
cudaF_add_vec_to_cols(Gr, Bl, alpha, col, beta, dst, d);
}
inline void cuda_add_vec_to_rows(dim3 Gr, dim3 Bl, double alpha,
const double *row, double beta, double *dst,
MatrixDim d) {
cudaD_add_vec_to_rows(Gr, Bl, alpha, row, beta, dst, d);
}
inline void cuda_add_vec_to_rows(dim3 Gr, dim3 Bl, float alpha,
const float *row, float beta, float *dst,
MatrixDim d) {
cudaF_add_vec_to_rows(Gr, Bl, alpha, row, beta, dst, d);
}
inline void cuda_add_vec_vec(int Gr, int Bl, double alpha, double* v,
const double* x, const double* y, double beta,
int dim) {
cudaD_add_vec_vec(Gr, Bl, alpha, v, x, y, beta, dim);
}
inline void cuda_add_vec_vec(int Gr, int Bl, float alpha, float* v,
const float* x, const float* y, float beta,
int dim) {
cudaF_add_vec_vec(Gr, Bl, alpha, v, x, y, beta, dim);
}
inline void cuda_apply_ceiling(dim3 Gr, dim3 Bl, double* mat,
double ceiling_val, MatrixDim dim) {
cudaD_apply_ceiling(Gr, Bl, mat, ceiling_val, dim);
}
inline void cuda_apply_ceiling(dim3 Gr, dim3 Bl, float* mat, float ceiling_val,
MatrixDim dim) {
cudaF_apply_ceiling(Gr, Bl, mat, ceiling_val, dim);
}
inline void cuda_apply_exp(dim3 Gr, dim3 Bl, double* mat, MatrixDim d) {
cudaD_apply_exp(Gr, Bl, mat, d);
}
inline void cuda_apply_exp(dim3 Gr, dim3 Bl, float* mat, MatrixDim d) {
cudaF_apply_exp(Gr, Bl, mat, d);
}
inline void cuda_apply_exp_limited(dim3 Gr, dim3 Bl, double* mat, MatrixDim d,
double lower_limit, double upper_limit) {
cudaD_apply_exp_limited(Gr, Bl, mat, d, lower_limit, upper_limit);
}
inline void cuda_apply_exp_limited(dim3 Gr, dim3 Bl, float* mat, MatrixDim d,
float lower_limit, float upper_limit) {
cudaF_apply_exp_limited(Gr, Bl, mat, d, lower_limit, upper_limit);
}
inline void cuda_apply_exp_special(dim3 Gr, dim3 Bl, double* out,
MatrixDim out_dim, const double* in,
int in_stride) {
cudaD_apply_exp_special(Gr, Bl, out, out_dim, in, in_stride);
}
inline void cuda_apply_exp_special(dim3 Gr, dim3 Bl, float* out,
MatrixDim out_dim, const float* in,
int in_stride) {
cudaF_apply_exp_special(Gr, Bl, out, out_dim, in, in_stride);
}
inline void cuda_apply_floor(dim3 Gr, dim3 Bl, double* mat, double floor_val,
MatrixDim dim) {
cudaD_apply_floor(Gr, Bl, mat, floor_val, dim);
}
inline void cuda_apply_floor(dim3 Gr, dim3 Bl, float* mat, float floor_val,
MatrixDim dim) {
cudaF_apply_floor(Gr, Bl, mat, floor_val, dim);
}
inline void cuda_apply_heaviside(dim3 Gr, dim3 Bl, double* mat, MatrixDim dim) {
cudaD_apply_heaviside(Gr, Bl, mat, dim);
}
inline void cuda_apply_heaviside(dim3 Gr, dim3 Bl, float* mat, MatrixDim dim) {
cudaF_apply_heaviside(Gr, Bl, mat, dim);
}
inline void cuda_apply_log(dim3 Gr, dim3 Bl, double *mat, MatrixDim d) {
cudaD_apply_log(Gr, Bl, mat, d);
}
inline void cuda_apply_log(dim3 Gr, dim3 Bl, float *mat, MatrixDim d) {
cudaF_apply_log(Gr, Bl, mat, d);
}
inline void cuda_apply_pow_abs(dim3 Gr, dim3 Bl, double* mat, double power,
bool include_sign, MatrixDim dim) {
cudaD_apply_pow_abs(Gr, Bl, mat, power, include_sign, dim);
}
inline void cuda_apply_pow_abs(dim3 Gr, dim3 Bl, float* mat, float power,
bool include_sign, MatrixDim dim) {
cudaF_apply_pow_abs(Gr, Bl, mat, power, include_sign, dim);
}
inline void cuda_apply_pow(dim3 Gr, dim3 Bl, double* mat, double power,
MatrixDim dim) {
cudaD_apply_pow(Gr, Bl, mat, power, dim);
}
inline void cuda_apply_pow(dim3 Gr, dim3 Bl, float* mat, float power,
MatrixDim dim) {
cudaF_apply_pow(Gr, Bl, mat, power, dim);
}
inline cublasStatus_t cuda_axpy(cublasHandle_t handle, int n, double alpha,
const double *x, int incx, double *y,
int incy) {
return cublasDaxpy_v2(handle, n, &alpha, x, incx, y, incy);
}
inline cublasStatus_t cuda_axpy(cublasHandle_t handle, int n, float alpha,
const float *x, int incx, float *y, int incy) {
return cublasSaxpy_v2(handle, n, &alpha, x, incx, y, incy);
}
inline void cuda_block_add_mat_mat(dim3 Gr, dim3 Bl,
CuBlockMatrixData *B_cu_data, int num_blocks,
const double *C_data, int C_num_cols,
int C_row_stride, int C_col_stride,
const double *D_data, int D_row_stride,
int D_col_stride, double alpha,
double beta) {
cudaD_block_add_mat_mat(Gr, Bl, B_cu_data, num_blocks, C_data, C_num_cols,
C_row_stride, C_col_stride, D_data, D_row_stride,
D_col_stride, alpha, beta);
}
inline void cuda_block_add_mat_mat(dim3 Gr, dim3 Bl,
CuBlockMatrixData *B_cu_data, int num_blocks,
const float *C_data, int C_num_cols,
int C_row_stride, int C_col_stride,
const float *D_data, int D_row_stride,
int D_col_stride, float alpha, float beta) {
cudaF_block_add_mat_mat(Gr, Bl, B_cu_data, num_blocks, C_data, C_num_cols,
C_row_stride, C_col_stride, D_data, D_row_stride,
D_col_stride, alpha, beta);
}
inline void cuda_calc_group_max_deriv(dim3 Gr, dim3 Bl, double *y,
const double *x1, const double *x2,
MatrixDim y_dim, int x1_stride,
int x2_stride, int group_size) {
cudaD_calc_group_max_deriv(Gr, Bl, y, x1, x2, y_dim, x1_stride, x2_stride,
group_size);
}
inline void cuda_calc_group_max_deriv(dim3 Gr, dim3 Bl, float *y,
const float *x1, const float *x2,
MatrixDim y_dim, int x1_stride,
int x2_stride, int group_size) {
cudaF_calc_group_max_deriv(Gr, Bl, y, x1, x2, y_dim, x1_stride, x2_stride,
group_size);
}
inline void cuda_comp_obj_deriv(dim3 Gr, dim3 Bl, MatrixElement<double>* x,
int32 size, const double* z, MatrixDim d,
double* z2, MatrixDim d2, double* t) {
cudaD_comp_obj_deriv(Gr, Bl, x, size, z, d, z2, d2, t);
}
inline void cuda_comp_obj_deriv(dim3 Gr, dim3 Bl, MatrixElement<float>* x,
int32 size, const float* z, MatrixDim d,
float* z2, MatrixDim d2, float* t) {
cudaF_comp_obj_deriv(Gr, Bl, x, size, z, d, z2, d2, t);
}
inline void cuda_copy_col_from_mat_df(int Gr, int Bl, double* v, int col,
const double* mat, MatrixDim dmat,
int dim) {
cudaD_copy_col_from_mat_df(Gr, Bl, v, col, mat, dmat, dim);
}
inline void cuda_copy_col_from_mat_df(int Gr, int Bl, double* v, int col,
const float* mat, MatrixDim dmat,
int dim) {
cudaF_copy_col_from_mat_df(Gr, Bl, v, col, mat, dmat, dim);
}
inline void cuda_copy_col_from_mat_fd(int Gr, int Bl, float* v, int col,
const double* mat, MatrixDim dmat,
int dim) {
cudaD_copy_col_from_mat_fd(Gr, Bl, v, col, mat, dmat, dim);
}
inline void cuda_copy_col_from_mat_fd(int Gr, int Bl, float* v, int col,
const float* mat, MatrixDim dmat,
int dim) {
cudaF_copy_col_from_mat_fd(Gr, Bl, v, col, mat, dmat, dim);
}
inline void cuda_copy_cols(dim3 Gr, dim3 Bl, double* dst, const double* src,
const MatrixIndexT_cuda* reorder, MatrixDim dst_dim,
int src_stride) {
cudaD_copy_cols(Gr, Bl, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_copy_cols(dim3 Gr, dim3 Bl, float* dst, const float* src,
const MatrixIndexT_cuda* reorder, MatrixDim dst_dim,
int src_stride) {
cudaF_copy_cols(Gr, Bl, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_copy_cols_from_vec(dim3 Gr, dim3 Bl, double *mat_out,
MatrixDim d_out, const double *v_in) {
cudaD_copy_cols_from_vec(Gr, Bl, mat_out, d_out, v_in);
}
inline void cuda_copy_cols_from_vec(dim3 Gr, dim3 Bl, float *mat_out,
MatrixDim d_out, const float *v_in) {
cudaF_copy_cols_from_vec(Gr, Bl, mat_out, d_out, v_in);
}
inline void cuda_copy(dim3 Gr, dim3 Bl, double *y, const double *x,
const int32_cuda *copy_from, MatrixDim d_out,
MatrixDim d_in) {
cudaD_copy(Gr, Bl, y, x, copy_from, d_out, d_in);
}
inline void cuda_copy(dim3 Gr, dim3 Bl, float *y, const float *x,
const int32_cuda *copy_from, MatrixDim d_out,
MatrixDim d_in) {
cudaF_copy(Gr, Bl, y, x, copy_from, d_out, d_in);
}
inline void cuda_copy_from_mat(dim3 Gr, dim3 Bl, double* mat_out,
const double* mat_in, MatrixDim d_out,
MatrixDim d_in) {
cuda_copy_from_mat_dd(Gr, Bl, mat_out, mat_in, d_out, d_in);
}
inline void cuda_copy_from_mat(dim3 Gr, dim3 Bl, double* mat_out,
const float* mat_in, MatrixDim d_out,
MatrixDim d_in) {
cuda_copy_from_mat_df(Gr, Bl, mat_out, mat_in, d_out, d_in);
}
inline void cuda_copy_from_mat(dim3 Gr, dim3 Bl, float* mat_out,
const double* mat_in, MatrixDim d_out,
MatrixDim d_in) {
cuda_copy_from_mat_fd(Gr, Bl, mat_out, mat_in, d_out, d_in);
}
inline void cuda_copy_from_mat(dim3 Gr, dim3 Bl, float* mat_out,
const float* mat_in, MatrixDim d_out,
MatrixDim d_in) {
cuda_copy_from_mat_ff(Gr, Bl, mat_out, mat_in, d_out, d_in);
}
inline void cuda_copy_from_mat_trans(dim3 Gr, dim3 Bl, double* mat_out,
const double* mat_in, MatrixDim d_out,
MatrixDim d_in) {
cuda_copy_from_mat_dd_trans(Gr, Bl, mat_out, mat_in, d_out, d_in);
}
inline void cuda_copy_from_mat_trans(dim3 Gr, dim3 Bl, double* mat_out,
const float* mat_in, MatrixDim d_out,
MatrixDim d_in) {
cuda_copy_from_mat_df_trans(Gr, Bl, mat_out, mat_in, d_out, d_in);
}
inline void cuda_copy_from_mat_trans(dim3 Gr, dim3 Bl, float* mat_out,
const double* mat_in, MatrixDim d_out,
MatrixDim d_in) {
cuda_copy_from_mat_fd_trans(Gr, Bl, mat_out, mat_in, d_out, d_in);
}
inline void cuda_copy_from_mat_trans(dim3 Gr, dim3 Bl, float* mat_out,
const float* mat_in, MatrixDim d_out,
MatrixDim d_in) {
cuda_copy_from_mat_ff_trans(Gr, Bl, mat_out, mat_in, d_out, d_in);
}
inline void cuda_copy_from_smat(dim3 Gr, dim3 Bl, double* mat,
MatrixDim mat_dim, const int* smat_row_ptr,
const int* smat_col_idx,
const double* smat_val) {
cuda_copy_from_smat_dd(Gr, Bl, mat, mat_dim, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_copy_from_smat(dim3 Gr, dim3 Bl, double* mat,
MatrixDim mat_dim, const int* smat_row_ptr,
const int* smat_col_idx,
const float* smat_val) {
cuda_copy_from_smat_df(Gr, Bl, mat, mat_dim, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_copy_from_smat(dim3 Gr, dim3 Bl, float* mat, MatrixDim mat_dim,
const int* smat_row_ptr,
const int* smat_col_idx,
const double* smat_val) {
cuda_copy_from_smat_fd(Gr, Bl, mat, mat_dim, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_copy_from_smat(dim3 Gr, dim3 Bl, float* mat, MatrixDim mat_dim,
const int* smat_row_ptr,
const int* smat_col_idx,
const float* smat_val) {
cuda_copy_from_smat_ff(Gr, Bl, mat, mat_dim, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_copy_from_smat_trans(dim3 Gr, dim3 Bl, double* mat,
MatrixDim mat_dim,
const int* smat_row_ptr,
const int* smat_col_idx,
const double* smat_val) {
cuda_copy_from_smat_dd_trans(Gr, Bl, mat, mat_dim, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_copy_from_smat_trans(dim3 Gr, dim3 Bl, double* mat,
MatrixDim mat_dim,
const int* smat_row_ptr,
const int* smat_col_idx,
const float* smat_val) {
cuda_copy_from_smat_df_trans(Gr, Bl, mat, mat_dim, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_copy_from_smat_trans(dim3 Gr, dim3 Bl, float* mat,
MatrixDim mat_dim,
const int* smat_row_ptr,
const int* smat_col_idx,
const double* smat_val) {
cuda_copy_from_smat_fd_trans(Gr, Bl, mat, mat_dim, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_copy_from_smat_trans(dim3 Gr, dim3 Bl, float* mat,
MatrixDim mat_dim,
const int* smat_row_ptr,
const int* smat_col_idx,
const float* smat_val) {
cuda_copy_from_smat_ff_trans(Gr, Bl, mat, mat_dim, smat_row_ptr, smat_col_idx,
smat_val);
}
inline void cuda_copy_from_sp(dim3 Gr, dim3 Bl, const double* x, double* y,
MatrixDim d_out) {
cudaD_copy_from_sp(Gr, Bl, x, y, d_out);
}
inline void cuda_copy_from_sp(dim3 Gr, dim3 Bl, const float* x, float* y,
MatrixDim d_out) {
cudaF_copy_from_sp(Gr, Bl, x, y, d_out);
}
inline void cuda_copy_from_tp(dim3 Gr, dim3 Bl, double* A, const double* B,
MatrixDim dmat) {
cudaD_copy_from_tp(Gr, Bl, A, B, dmat);
}
inline void cuda_copy_from_tp(dim3 Gr, dim3 Bl, double* A, const float* B,
MatrixDim dmat) {
cudaDF_copy_from_tp(Gr, Bl, A, B, dmat);
}
inline void cuda_copy_from_tp(dim3 Gr, dim3 Bl, float* A, const double* B,
MatrixDim dmat) {
cudaFD_copy_from_tp(Gr, Bl, A, B, dmat);
}
inline void cuda_copy_from_tp(dim3 Gr, dim3 Bl, float* A, const float* B,
MatrixDim dmat) {
cudaF_copy_from_tp(Gr, Bl, A, B, dmat);
}
inline void cuda_copy_from_tp_trans(dim3 Gr, dim3 Bl, double* A,
const double* B, MatrixDim dmat) {
cudaD_copy_from_tp_trans(Gr, Bl, A, B, dmat);
}
inline void cuda_copy_from_tp_trans(dim3 Gr, dim3 Bl, double* A, const float* B,
MatrixDim dmat) {
cudaDF_copy_from_tp_trans(Gr, Bl, A, B, dmat);
}
inline void cuda_copy_from_tp_trans(dim3 Gr, dim3 Bl, float* A, const double* B,
MatrixDim dmat) {
cudaFD_copy_from_tp_trans(Gr, Bl, A, B, dmat);
}
inline void cuda_copy_from_tp_trans(dim3 Gr, dim3 Bl, float* A, const float* B,
MatrixDim dmat) {
cudaF_copy_from_tp_trans(Gr, Bl, A, B, dmat);
}
inline void cuda_copy_low_upp(dim3 Gr, dim3 Bl, double* A, MatrixDim dimA) {
cudaD_copy_low_upp(Gr, Bl, A, dimA);
}
inline void cuda_copy_low_upp(dim3 Gr, dim3 Bl, float* A, MatrixDim dimA) {
cudaF_copy_low_upp(Gr, Bl, A, dimA);
}
inline void cuda_copy_rows(dim3 Gr, dim3 Bl, double* dst,
const double* const * src, MatrixDim dst_dim) {
cudaD_copy_rows_direct(Gr, Bl, dst, src, dst_dim);
}
inline void cuda_copy_rows(dim3 Gr, dim3 Bl, double* dst, const double* src,
const MatrixIndexT_cuda* reorder, MatrixDim dst_dim,
int src_stride) {
cudaD_copy_rows(Gr, Bl, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_copy_rows(dim3 Gr, dim3 Bl, float* dst,
const float* const * src, MatrixDim dst_dim) {
cudaF_copy_rows_direct(Gr, Bl, dst, src, dst_dim);
}
inline void cuda_copy_rows(dim3 Gr, dim3 Bl, float* dst, const float* src,
const MatrixIndexT_cuda* reorder, MatrixDim dst_dim,
int src_stride) {
cudaF_copy_rows(Gr, Bl, dst, src, reorder, dst_dim, src_stride);
}
inline void cuda_copy_rows_from_vec(dim3 Gr, dim3 Bl, double *mat_out,
MatrixDim d_out, const double *v_in) {
cudaD_copy_rows_from_vec(Gr, Bl, mat_out, d_out, v_in);
}
inline void cuda_copy_rows_from_vec(dim3 Gr, dim3 Bl, float *mat_out,
MatrixDim d_out, const float *v_in) {
cudaF_copy_rows_from_vec(Gr, Bl, mat_out, d_out, v_in);
}
inline void cuda_copy_to_rows(dim3 Gr, dim3 Bl, double* const * dst,
const double* src, MatrixDim src_dim) {
cudaD_copy_to_rows_direct(Gr, Bl, dst, src, src_dim);
}
inline void cuda_copy_to_rows(dim3 Gr, dim3 Bl, float* const * dst,
const float* src, MatrixDim src_dim) {
cudaF_copy_to_rows_direct(Gr, Bl, dst, src, src_dim);
}
inline void cuda_copy_upp_low(dim3 Gr, dim3 Bl, double* A, MatrixDim dimA) {
cudaD_copy_upp_low(Gr, Bl, A, dimA);
}
inline void cuda_copy_upp_low(dim3 Gr, dim3 Bl, float* A, MatrixDim dimA) {
cudaF_copy_upp_low(Gr, Bl, A, dimA);
}
inline void cuda_diff_group_pnorm(dim3 Gr, dim3 Bl, double *id,
const double *iv, const double *ov,
const double* od, MatrixDim id_dim,
int iv_stride, int ov_stride, int od_stride,
int group_size, double power) {
cudaD_diff_group_pnorm(Gr, Bl, id, iv, ov, od, id_dim, iv_stride, ov_stride,
od_stride, group_size, power);
}
inline void cuda_diff_group_pnorm(dim3 Gr, dim3 Bl, float *id, const float *iv,
const float *ov, const float* od,
MatrixDim id_dim, int iv_stride,
int ov_stride, int od_stride, int group_size,
float power) {
cudaF_diff_group_pnorm(Gr, Bl, id, iv, ov, od, id_dim, iv_stride, ov_stride,
od_stride, group_size, power);
}
inline void cuda_diff_log_softmax(dim3 Gr, dim3 Bl,
const MatrixDim in_deriv_dim,
const double* out_value,
const int out_value_stride,
const double* out_deriv,
const int out_deriv_stride,
double* in_deriv) {
cudaD_diff_log_softmax(Gr, Bl, in_deriv_dim, out_value, out_value_stride,
out_deriv, out_deriv_stride, in_deriv);
}
inline void cuda_diff_log_softmax(dim3 Gr, dim3 Bl,
const MatrixDim in_deriv_dim,
const float* out_value,
const int out_value_stride,
const float* out_deriv,
const int out_deriv_stride, float* in_deriv) {
cudaF_diff_log_softmax(Gr, Bl, in_deriv_dim, out_value, out_value_stride,
out_deriv, out_deriv_stride, in_deriv);
}
inline void cuda_diff_lstm_nonlinearity(dim3 Gr, dim3 Bl, const int cell_dim,
const int have_dropout_mask,
const int num_rows, const double* input,
const int input_stride,
const double* params,
const int params_stride,
const double* output_deriv,
const int output_deriv_stride,
const double* deriv_sum_in,
const int deriv_sum_in_stride,
const double* self_repair_config,
double count, double* input_deriv,
const int input_deriv_stride,
double* params_deriv,
const int params_deriv_stride,
double* value_sum_out,
const int value_sum_out_stride,
double* deriv_sum_out,
const int deriv_sum_out_stride,
double* self_repair_sum_out,
const int self_repair_sum_out_stride) {
cudaD_diff_lstm_nonlinearity(Gr, Bl, cell_dim, have_dropout_mask, num_rows,
input, input_stride,
params, params_stride, output_deriv,
output_deriv_stride, deriv_sum_in,
deriv_sum_in_stride, self_repair_config, count,
input_deriv, input_deriv_stride, params_deriv,
params_deriv_stride, value_sum_out,
value_sum_out_stride, deriv_sum_out,
deriv_sum_out_stride, self_repair_sum_out,
self_repair_sum_out_stride);
}
inline void cuda_diff_lstm_nonlinearity(dim3 Gr, dim3 Bl, const int cell_dim,
const int have_dropout_mask,
const int num_rows, const float* input,
const int input_stride,
const float* params,
const int params_stride,
const float* output_deriv,
const int output_deriv_stride,
const double* deriv_sum_in,
const int deriv_sum_in_stride,
const float* self_repair_config,
double count, float* input_deriv,
const int input_deriv_stride,
float* params_deriv,
const int params_deriv_stride,
double* value_sum_out,
const int value_sum_out_stride,
double* deriv_sum_out,
const int deriv_sum_out_stride,
float* self_repair_sum_out,
const int self_repair_sum_out_stride) {
cudaF_diff_lstm_nonlinearity(Gr, Bl, cell_dim, have_dropout_mask,
num_rows, input, input_stride,
params, params_stride, output_deriv,
output_deriv_stride, deriv_sum_in,
deriv_sum_in_stride, self_repair_config, count,
input_deriv, input_deriv_stride, params_deriv,
params_deriv_stride, value_sum_out,
value_sum_out_stride, deriv_sum_out,
deriv_sum_out_stride, self_repair_sum_out,
self_repair_sum_out_stride);
}
inline void cuda_diff_normalize_per_row(size_t Gr, size_t Bl, double *id,
int id_stride, const double *iv,
MatrixDim iv_dim, const double* od,
int od_stride, double target_rms,
bool add_log_stddev) {
cudaD_diff_normalize_per_row(Gr, Bl, id, id_stride, iv, iv_dim, od, od_stride,
target_rms, add_log_stddev);
}
inline void cuda_diff_normalize_per_row(size_t Gr, size_t Bl, float *id,
int id_stride, const float *iv,
MatrixDim iv_dim, const float* od,
int od_stride, float target_rms,
bool add_log_stddev) {
cudaF_diff_normalize_per_row(Gr, Bl, id, id_stride, iv, iv_dim, od, od_stride,
target_rms, add_log_stddev);
}
inline void cuda_diff_parametric_relu(dim3 Gr, dim3 Bl, double *eout,
const double *e, const double *y,
MatrixDim d, int e_stride, int y_stride,
const double *a, const double *b) {
cudaD_diff_parametric_relu(Gr, Bl, eout, e, y, d, e_stride, y_stride, a, b);
}
inline void cuda_diff_parametric_relu(dim3 Gr, dim3 Bl, float *eout,
const float *e, const float *y,
MatrixDim d, int e_stride, int y_stride,
const float *a, const float *b) {
cudaF_diff_parametric_relu(Gr, Bl, eout, e, y, d, e_stride, y_stride, a, b);
}
inline void cuda_diff_sigmoid(dim3 Gr, dim3 Bl, double *eout, const double *e,
const double *y, MatrixDim d, int e_stride,
int y_stride) {
cudaD_diff_sigmoid(Gr, Bl, eout, e, y, d, e_stride, y_stride);
}
inline void cuda_diff_sigmoid(dim3 Gr, dim3 Bl, float *eout, const float *e,
const float *y, MatrixDim d, int e_stride,
int y_stride) {
cudaF_diff_sigmoid(Gr, Bl, eout, e, y, d, e_stride, y_stride);
}
inline void cuda_diff_softmax(dim3 Gr, dim3 Bl, double* x, const MatrixDim dim,
const double* value, const int value_stride,
const double* diff, const int diff_stride) {
cudaD_diff_softmax(Gr, Bl, x, dim, value, value_stride, diff, diff_stride);
}
inline void cuda_diff_softmax(dim3 Gr, dim3 Bl, float* x, const MatrixDim dim,
const float* value, const int value_stride,
const float* diff, const int diff_stride) {
cudaF_diff_softmax(Gr, Bl, x, dim, value, value_stride, diff, diff_stride);
}
inline void cuda_diff_tanh(dim3 Gr, dim3 Bl, double *eout, const double *e,
const double *y, MatrixDim d, int e_stride,
int y_stride) {
cudaD_diff_tanh(Gr, Bl, eout, e, y, d, e_stride, y_stride);
}
inline void cuda_diff_tanh(dim3 Gr, dim3 Bl, float *eout, const float *e,
const float *y, MatrixDim d, int e_stride,
int y_stride) {
cudaF_diff_tanh(Gr, Bl, eout, e, y, d, e_stride, y_stride);
}
inline void cuda_ensure_nonzero(dim3 Gr, dim3 Bl, const double *x, MatrixDim d,
double epsilon, int y_stride, double *y) {
cudaD_ensure_nonzero(Gr, Bl, x, d, epsilon, y_stride, y);
}
inline void cuda_ensure_nonzero(dim3 Gr, dim3 Bl, const float *x, MatrixDim d,
float epsilon, int y_stride, float *y) {
cudaF_ensure_nonzero(Gr, Bl, x, d, epsilon, y_stride, y);
}
inline void cuda_diff_xent(dim3 Gr, dim3 Bl, const int32_cuda *vec_tgt,
double *mat_net_out, double *vec_log_post,
MatrixDim d) {
cudaD_diff_xent(Gr, Bl, vec_tgt, mat_net_out, vec_log_post, d);
}
inline void cuda_diff_xent(dim3 Gr, dim3 Bl, const int32_cuda *vec_tgt,
float *mat_net_out, float *vec_log_post,
MatrixDim d) {
cudaF_diff_xent(Gr, Bl, vec_tgt, mat_net_out, vec_log_post, d);
}
inline void cuda_div_elements(dim3 Gr, dim3 Bl, double *mat, const double *A,
MatrixDim dst_d, int src_stride) {
cudaD_div_elements(Gr, Bl, mat, A, dst_d, src_stride);
}
inline void cuda_div_elements(dim3 Gr, dim3 Bl, float *mat, const float *A,
MatrixDim dst_d, int src_stride) {
cudaF_div_elements(Gr, Bl, mat, A, dst_d, src_stride);
}
inline void cuda_div_rows_vec(dim3 Gr, dim3 Bl, double *mat,
const double *vec_div, MatrixDim d) {
cudaD_div_rows_vec(Gr, Bl, mat, vec_div, d);
}
inline void cuda_div_rows_vec(dim3 Gr, dim3 Bl, float *mat,
const float *vec_div, MatrixDim d) {
cudaF_div_rows_vec(Gr, Bl, mat, vec_div, d);
}
inline void cuda_equal_element_mask(dim3 Gr, dim3 Bl, const double *mat1,
const double *mat2, double *mask,
MatrixDim mat1_dim, int mat2_stride,
int mask_stride) {
cudaD_equal_element_mask(Gr, Bl, mat1, mat2, mask, mat1_dim, mat2_stride,
mask_stride);
}
inline void cuda_equal_element_mask(dim3 Gr, dim3 Bl, const float *mat1,
const float *mat2, float *mask,
MatrixDim mat1_dim, int mat2_stride,
int mask_stride) {
cudaF_equal_element_mask(Gr, Bl, mat1, mat2, mask, mat1_dim, mat2_stride,
mask_stride);
}
inline void cuda_find_row_max_id(dim3 Gr, dim3 Bl, const double *mat,
double *vec_val, int32_cuda *vec_id,
MatrixDim d) {
cudaD_find_row_max_id(Gr, Bl, mat, vec_val, vec_id, d);
}
inline void cuda_find_row_max_id(dim3 Gr, dim3 Bl, const float *mat,
float *vec_val, int32_cuda *vec_id,
MatrixDim d) {
cudaF_find_row_max_id(Gr, Bl, mat, vec_val, vec_id, d);
}
inline void cuda_group_max(dim3 Gr, dim3 Bl, double *y, const double *x,
MatrixDim d, int src_stride, int group_size) {
cudaD_group_max(Gr, Bl, y, x, d, src_stride, group_size);
}
inline void cuda_group_max(dim3 Gr, dim3 Bl, float *y, const float *x,
MatrixDim d, int src_stride, int group_size) {
cudaF_group_max(Gr, Bl, y, x, d, src_stride, group_size);
}
inline void cuda_group_pnorm(dim3 Gr, dim3 Bl, double *y, const double *x,
MatrixDim d, int src_stride, int group_size,
double power) {
cudaD_group_pnorm(Gr, Bl, y, x, d, src_stride, group_size, power);
}
inline void cuda_group_pnorm(dim3 Gr, dim3 Bl, float *y, const float *x,
MatrixDim d, int src_stride, int group_size,
float power) {
cudaF_group_pnorm(Gr, Bl, y, x, d, src_stride, group_size, power);
}
inline void cuda_group_spec_pnorm(dim3 Gr, dim3 Bl, double *y, const double *x,
MatrixDim d, int src_stride, int group_size,
double power) {
cudaD_group_spec_pnorm(Gr, Bl, y, x, d, src_stride, group_size, power);
}
inline void cuda_group_spec_pnorm(dim3 Gr, dim3 Bl, float *y, const float *x,
MatrixDim d, int src_stride, int group_size,
float power) {
cudaF_group_spec_pnorm(Gr, Bl, y, x, d, src_stride, group_size, power);
}
inline void cuda_heaviside(dim3 Gr, dim3 Bl, double *y, const double *x,
MatrixDim d, int src_stride) {
cudaD_heaviside(Gr, Bl, y, x, d, src_stride);
}
inline void cuda_heaviside(dim3 Gr, dim3 Bl, float *y, const float *x,
MatrixDim d, int src_stride) {
cudaF_heaviside(Gr, Bl, y, x, d, src_stride);
}
inline void cuda_invert_elements(dim3 Gr, dim3 Bl, double *data, MatrixDim d) {
cudaD_invert_elements(Gr, Bl, data, d);
}
inline void cuda_invert_elements(dim3 Gr, dim3 Bl, float *data, MatrixDim d) {
cudaF_invert_elements(Gr, Bl, data, d);
}
inline void cuda_log_softmax_reduce(size_t Gr, size_t Bl, double *y,
const double *x, MatrixDim y_dim,
int x_stride) {
cudaD_log_softmax_reduce(Gr, Bl, y, x, y_dim, x_stride);
}
inline void cuda_log_softmax_reduce(size_t Gr, size_t Bl, float *y,
const float *x, MatrixDim y_dim,
int x_stride) {
cudaF_log_softmax_reduce(Gr, Bl, y, x, y_dim, x_stride);
}
inline void cuda_lstm_nonlinearity(dim3 Gr, dim3 Bl, const double* in,
const int in_stride, const double* params,
const int params_stride,
const int out_stride, const int cell_dim,
const int have_dropout_mask,
const int num_rows, double* out) {
cudaD_lstm_nonlinearity(Gr, Bl, in, in_stride, params, params_stride,
out_stride, cell_dim, have_dropout_mask,
num_rows, out);
}
inline void cuda_lstm_nonlinearity(dim3 Gr, dim3 Bl, const float* in,
const int in_stride, const float* params,
const int params_stride,
const int out_stride, const int cell_dim,
const int have_dropout_mask,
const int num_rows, float* out) {
cudaF_lstm_nonlinearity(Gr, Bl, in, in_stride, params, params_stride,
out_stride, cell_dim, have_dropout_mask,
num_rows, out);
}
inline void cuda_matrix_add_elements(dim3 Gr, dim3 Bl, double *data,
MatrixDim dim, double alpha,
MatrixElement<double>* x,
int num_elements) {
cudaD_matrix_add_elements(Gr, Bl, data, dim, alpha, x, num_elements);
}
inline void cuda_matrix_add_elements(dim3 Gr, dim3 Bl, float *data,
MatrixDim dim, float alpha,
MatrixElement<float>* x,
int num_elements) {
cudaF_matrix_add_elements(Gr, Bl, data, dim, alpha, x, num_elements);
}
inline void cuda_matrix_add_indexed_values(dim3 Gr, dim3 Bl, MatrixDim dim,
double alpha,
const Int32Pair* indices,
const double* x, int s,
double* data) {
cudaD_matrix_add_indexed_values(Gr, Bl, dim, alpha, indices, x, s, data);
}
inline void cuda_matrix_add_indexed_values(dim3 Gr, dim3 Bl, MatrixDim dim,