Skip to content

Commit 6885a65

Browse files
author
Jared Frazier
committed
ignore with condgit branch
1 parent 5534ed0 commit 6885a65

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

config/intel_ubuntu_spblas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cmake -S . -B build-spblas\
77
-DCMAKE_Fortran_COMPILER=ifx\
88
-DBUILD_TESTING=ON\
99
-DENABLE_SPBLAS=ON\
10-
-DENABLE_FIND_INTEL_MKL=OFF
10+
-DENABLE_FIND_INTEL_MKL=ON
1111
cmake --build build-spblas
1212
./build-spblas/test/test_spblas
1313
[[ -n $builddocs ]] && cmake --build build-spblas --target doxygen_docs

src/mo_square.f90

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
!> @file mo_square.f90
22
!! @brief Defines a module of simple mathematical operations.
3+
4+
!! \cond
5+
#ifdef INTEL_SPBLAS
6+
INCLUDE "mkl_spblas.f90"
7+
#endif
8+
!! \endcond
9+
310
MODULE mo_square
411

512
#ifdef FFTPACK
613
USE fftpack
714
#endif
815

916
#ifdef INTEL_SPBLAS
10-
USE mkl_spblas
17+
USE mkl_spblas
1118
#endif
1219

1320
IMPLICIT NONE

test/test_spblas.f90

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818
! solved... could use that also as a reference.
1919
include "mkl_spblas.f90" ! TODO: remove this!
2020
PROGRAM TEST_SPBLAS
21-
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_FLOAT, C_INT, C_LONG
22-
USE mkl_spblas, ONLY: sparse_matrix_t, matrix_descr, &
23-
mkl_sparse_s_create_csr, mkl_sparse_s_create_coo, mkl_sparse_s_mv, &
24-
SPARSE_INDEX_BASE_ONE, SPARSE_MATRIX_TYPE_GENERAL, &
25-
SPARSE_OPERATION_NON_TRANSPOSE
21+
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_FLOAT, C_INT, C_LONG, C_DOUBLE
22+
USE MKL_SPBLAS
2623

2724
IMPLICIT NONE
2825

@@ -31,15 +28,15 @@ PROGRAM TEST_SPBLAS
3128

3229
INTEGER(KIND=C_INT), PARAMETER :: nnz = 8
3330

34-
!INTEGER(KIND=C_INT) :: ia(rows+1), ja(nnz)
35-
INTEGER(KIND=C_LONG) :: ia(rows+1), ja(nnz)
31+
!INTEGER(KIND=C_INT) :: ia(rows+1), ja(nnz) ! include->segfault,w/o include->type err
32+
INTEGER(KIND=C_LONG) :: ia(rows+1), ja(nnz) ! works with include 'mkl_spblas.f90'
3633
INTEGER :: stat
37-
REAL(KIND=C_FLOAT) :: values(nnz), x(6), y(4), y_coo(4)
34+
REAL(KIND=C_DOUBLE) :: values(nnz), x(6), y(4), y_coo(4), alpha, beta
3835

39-
TYPE(sparse_matrix_t) :: a
40-
TYPE(matrix_descr) :: descr
36+
TYPE(SPARSE_MATRIX_T) :: a
37+
TYPE(MATRIX_DESCR) :: descr
4138

42-
TYPE(sparse_matrix_t) :: A_coo
39+
TYPE(SPARSE_MATRIX_T) :: A_coo
4340

4441
INTEGER(KIND=C_INT), ALLOCATABLE :: row_indx(:)
4542
INTEGER(KIND=C_INT), ALLOCATABLE :: col_indx(:)
@@ -58,7 +55,7 @@ PROGRAM TEST_SPBLAS
5855
ja = [1,2,2,4,3,4,5,6]
5956
values = [10, 20, 30, 40, 50, 60, 70, 80]
6057

61-
stat = mkl_sparse_s_create_csr(&
58+
stat = MKL_SPARSE_D_CREATE_CSR(&
6259
a,SPARSE_INDEX_BASE_ONE,rows,cols,ia(1:4),ia(2:5),ja,values)
6360

6461
print *, "stat create = ", stat
@@ -73,15 +70,17 @@ PROGRAM TEST_SPBLAS
7370

7471
! spmv:
7572
x = [1,1,1,1,1,1]
73+
beta = 0
74+
alpha = 1
7675
! spmv csr
77-
stat = mkl_sparse_s_mv(SPARSE_OPERATION_NON_TRANSPOSE,1.0,a,descr,x,0.0,y)
76+
stat = MKL_SPARSE_D_MV(SPARSE_OPERATION_NON_TRANSPOSE,alpha,a,descr,x,beta,y)
7877
print *, "stat mv = ", stat
7978
print *, "result csr = ", y
8079
print *, "expected = ", [30., 70., 180., 80.]
8180

8281
!! spmv coo
8382
!stat = mkl_sparse_d_mv(&
84-
!SPARSE_OPERATION_NON_TRANSPOSE, 1.0, A_coo, descr, x, 0.0, y_coo)
83+
!SPARSE_OPERATION_NON_TRANSPOSE, alpha, A_coo, descr, x, beta, y_coo)
8584
!print *, "result coo = ", y_coo
8685

8786
END PROGRAM TEST_SPBLAS

0 commit comments

Comments
 (0)