1 #ifndef _COMPADRE_LINEAR_ALGEBRA_DECLARATIONS_HPP_
2 #define _COMPADRE_LINEAR_ALGEBRA_DECLARATIONS_HPP_
4 #include "Compadre_Config.h"
8 #ifdef COMPADRE_USE_CUDA
9 #include <cuda_runtime.h>
10 #include <cublas_v2.h>
11 #include <cublas_api.h>
12 #include <cusolverDn.h>
15 #ifdef COMPADRE_USE_LAPACK
16 extern "C" int dgels_(
char* trans,
int *m,
int *n,
int *k,
double *a,
17 int *lda,
double *c,
int *ldc,
double *work,
int *lwork,
int *info);
19 extern "C" void dgelsd_(
int* m,
int* n,
int* nrhs,
double* a,
int* lda,
20 double* b,
int* ldb,
double* s,
double* rcond,
int* rank,
21 double* work,
int* lwork,
int* iwork,
int* info );
24 extern "C" void dgetrf_(
int* m,
int* n,
double* a,
25 int* lda,
int* ipiv,
int* info);
28 extern "C" void dgetrs_(
char* trans,
int* n,
int* nrhs,
double* a,
int* lda,
29 int* ipiv,
double* b,
int* ldb,
int* info );
30 #endif // COMPADRE_USE_LAPACK
34 namespace GMLS_LinearAlgebra {
43 KOKKOS_INLINE_FUNCTION
52 KOKKOS_INLINE_FUNCTION
73 void batchQRFactorize(ParallelManager pm,
double *P,
int lda,
int nda,
double *RHS,
int ldb,
int ndb,
int M,
int N,
int NRHS,
const int num_matrices,
const size_t max_neighbors = 0,
const int initial_index_of_batch = 0,
int * neighbor_list_sizes = NULL);
95 void batchSVDFactorize(ParallelManager pm,
bool swap_layout_P,
double *P,
int lda,
int nda,
bool swap_layout_RHS,
double *RHS,
int ldb,
int ndb,
int M,
int N,
int NRHS,
const int num_matrices,
const size_t max_neighbors = 0,
const int initial_index_of_batch = 0,
int * neighbor_list_sizes = NULL);
115 void batchLUFactorize(ParallelManager pm,
double *P,
int lda,
int nda,
double *RHS,
int ldb,
int ndb,
int M,
int N,
int NRHS,
const int num_matrices,
const size_t max_neighbors = 0,
const int initial_index_of_batch = 0,
int * neighbor_list_sizes = NULL);
team_policy::member_type member_type
KOKKOS_INLINE_FUNCTION void largestTwoEigenvectorsThreeByThreeSymmetric(const member_type &teamMember, scratch_matrix_right_type V, scratch_matrix_right_type PtP, const int dimensions, pool_type &random_number_pool)
Calculates two eigenvectors corresponding to two dominant eigenvalues.
void batchLUFactorize(ParallelManager pm, double *P, int lda, int nda, double *RHS, int ldb, int ndb, int M, int N, int NRHS, const int num_matrices, const size_t max_neighbors, const int initial_index_of_batch, int *neighbor_list_sizes)
Calls LAPACK or CUBLAS to solve a batch of LU problems.
Kokkos::View< double **, layout_right, Kokkos::MemoryTraits< Kokkos::Unmanaged > > scratch_matrix_right_type
void batchSVDFactorize(ParallelManager pm, bool swap_layout_P, double *P, int lda, int nda, bool swap_layout_RHS, double *RHS, int ldb, int ndb, int M, int N, int NRHS, const int num_matrices, const size_t max_neighbors, const int initial_index_of_batch, int *neighbor_list_sizes)
Calls LAPACK or CUBLAS to solve a batch of SVD problems.
void batchQRFactorize(ParallelManager pm, double *P, int lda, int nda, double *RHS, int ldb, int ndb, int M, int N, int NRHS, const int num_matrices, const size_t max_neighbors, const int initial_index_of_batch, int *neighbor_list_sizes)
Calls LAPACK or CUBLAS to solve a batch of QR problems.
Kokkos::Random_XorShift64_Pool pool_type
KOKKOS_INLINE_FUNCTION void createM(const member_type &teamMember, scratch_matrix_right_type M_data, scratch_matrix_right_type weighted_P, const int columns, const int rows)
Creates a matrix M=A^T*A from a matrix A.