INLA_DIST
Loading...
Searching...
No Matches
CWC_utility.H
1#include <cuda_runtime.h>
2#include <stdio.h>
3#include "Types.H"
4#include "magma_v2.h"
5
6extern "C" {
7
8 void set_gpu(int,char*);
9 void cublas_init(void**);
10 void cublas_finalize(void*);
11 void cusparse_init(void**);
12 void cusparse_finalize(void*);
13 size_t allocate_data_on_device(void**,size_t);
14 void deallocate_data_on_device(void*);
15 size_t deallocate_data_on_dev(void*,size_t);
16 void copy_data_to_device(void*,void*,int,int,size_t);
17 void memcpy_to_device( void*, void*, size_t, cudaStream_t );
18 void copy_data_to_host(void*,void*,int,int,size_t);
19 void memcpy_to_host( void*, void*, size_t, cudaStream_t );
20 void dgemm_on_dev(void*,char,char,int,int,int,double,double*,\
21 int,double*,int,double,double*,int);
22 void zgemm_on_dev(void*,char,char,int,int,int,CPX,CPX*,\
23 int,CPX*,int,CPX,CPX*,int);
24 void daxpy_on_dev(void*,int,double,double*,int,double*,int);
25 void saxpy_on_dev(void*,int,float ,float *,int,float*,int);
26 void zaxpy_on_dev(void*,int,CPX,CPX*,int,CPX*,int);
27 void dasum_on_dev(void *handle,int n,double *x,int incx,double *result);
28 void zasum_on_dev(void *handle,int n,CPX *x,int incx,double *result);
29 void dsum_on_dev(int n,double *x,int incx,double *result,magma_queue_t queue);
30 void ssum_on_dev(int n,float *x,int incx,float *result,magma_queue_t queue);
31 void zsum_on_dev(int n,CPX *x,int incx,CPX *result,magma_queue_t queue);
32 void d_copy_csr_to_device(int,int,int*,int*,double*,int*,int*,double*);
33 void s_copy_csr_to_device(int,int,int*,int*,float* ,int*,int*,float*);
34 void z_copy_csr_to_device(int,int,int*,int*,CPX*,int*,int*,CPX*);
35 void d_csr_mult_f(void*,int,int,int,int,int*,int*,double*,double,\
36 double*,double,double*);
37 void z_csr_mult_f(void*,int,int,int,int,int*,int*,CPX*,CPX,\
38 CPX*,CPX,CPX*);
39 void z_csr_mult_fo(void*,int,int,int,int,int*,int*,CPX*,CPX,\
40 CPX*,CPX,CPX*);
41 void d_transpose_matrix(double*,double*,int,int);
42 void z_transpose_matrix(CPX*,CPX*,int,int);
43 void d_init_var_on_dev(double*,int,cudaStream_t);
44 void d_init_eye_on_dev(double*,int,cudaStream_t);
45 void s_init_eye_on_dev(float*,int,cudaStream_t);
46 void z_init_eye_on_dev(CPX*,int,cudaStream_t);
47 void z_init_var_on_dev(CPX*,int,cudaStream_t);
48 void correct_diag_on_dev(CPX*,int,cudaStream_t);
49 void change_var_type_on_dev(double*,CPX*,int,cudaStream_t);
50 void change_sign_imag_on_dev(CPX*,int);
51 void d_extract_diag_on_dev(double*,int*,int*,double*,int,int,int,int,int,\
52 cudaStream_t);
53 void s_extract_diag_on_dev(float*,int*,int*,float*,int,int,int,int,int,\
54 cudaStream_t);
55 void d_extract_not_diag_on_dev(double*,int*,int*,double*,int,int,int,int,\
56 int,int,int,cudaStream_t);
57 void d_symmetrize_matrix(double*,int,cudaStream_t);
58 void z_extract_diag_on_dev(CPX*,int*,int*,CPX*,int,int,int,int,int,\
59 cudaStream_t);
60 void z_extract_not_diag_on_dev(CPX*,int*,int*,CPX*,int,int,int,int,\
61 int,int,int,cudaStream_t);
62 void z_symmetrize_matrix(CPX*,int,cudaStream_t);
63 void z_symmetrize_matrix_2(CPX*,int,cudaStream_t);
64 void d_tril_on_dev(double *A, int lda, int N);
65 void s_tril_on_dev(float *A, int lda, int N);
66 void z_tril_on_dev(CPX *A, int lda, int N);
67 void d_indexed_copy_on_dev(double *src, double *dst, size_t *index, size_t N);
68 void z_indexed_copy_on_dev(CPX *src, CPX *dst, size_t *index, size_t N);
69 void d_indexed_copy_offset_on_dev(double *src, double *dst, size_t *index, size_t N, size_t offset);
70 void s_indexed_copy_offset_on_dev(float *src, float *dst, size_t *index, size_t N, size_t offset);
71 void z_indexed_copy_offset_on_dev(CPX *src, CPX *dst, size_t *index, size_t N, size_t offset);
72 void d_log_on_dev(double *x, size_t N);
73 void z_log_on_dev(CPX *x, size_t N);
74 void d_fill_on_dev(double *x, const double value, size_t N);
75 void s_fill_on_dev(float *x, const float value, size_t N);
76 void z_fill_on_dev(CPX *x, const CPX value, size_t N);
77 void d_init_block_matrix_on_dev(double *M, size_t *ia, size_t *ja, double *a, size_t nnz, size_t ns, size_t nt, size_t nd);
78 void z_init_block_matrix_on_dev(CPX *M, size_t *ia, size_t *ja, CPX *a, size_t nnz, size_t ns, size_t nt, size_t nd);
79 void d_init_supernode_on_dev(double *M, size_t *ia, size_t *ja, double *a, size_t supernode, size_t supernode_nnz, size_t supernode_offset, size_t ns, size_t nt, size_t nd, cudaStream_t stream);
80 void s_init_supernode_on_dev(float *M, size_t *ia, size_t *ja, float *a, size_t supernode, size_t supernode_nnz, size_t supernode_offset, size_t ns, size_t nt, size_t nd, cudaStream_t stream);
81 void z_init_supernode_on_dev(CPX *M, size_t *ia, size_t *ja, CPX *a, size_t supernode, size_t supernode_nnz, size_t supernode_offset, size_t ns, size_t nt, size_t nd, cudaStream_t stream );
82 //void d_init_supernode_on_dev(double *M, size_t *ia, size_t *ja, double *a, size_t supernode, size_t supernode_nnz, size_t supernode_offset, size_t ns, size_t nt, size_t nd);
83 //void z_init_supernode_on_dev(CPX *M, size_t *ia, size_t *ja, CPX *a, size_t supernode, size_t supernode_nnz, size_t supernode_offset, size_t ns, size_t nt, size_t nd);
84
85 // new
86 void d_extract_nnzA_on_dev(double *a, size_t *ia, size_t *ja, double *M, size_t supernode, size_t supernode_nnz, size_t supernode_offset, size_t ns, size_t nt, size_t nd);
87 void s_extract_nnzA_on_dev(float *a, size_t *ia, size_t *ja, float *M, size_t supernode, size_t supernode_nnz, size_t supernode_offset, size_t ns, size_t nt, size_t nd);
88}