Skip to content

Commit 84876a8

Browse files
Merge pull request #97 from tgorni/devel
Upgraded cublas interface
2 parents eeb1946 + d4c08de commit 84876a8

28 files changed

+312
-67
lines changed

src/a_module_tests/test_dgemm.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
! along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
program test_dgemm
17+
use allio, only: cublas_handle
1718
implicit none
1819

1920
real*8, allocatable, dimension(:, :) :: A, B, C, C_orig
@@ -59,6 +60,14 @@ program test_dgemm
5960

6061
C = 0
6162

63+
#if defined(_OFFLOAD) && defined(_CUBLAS)
64+
#ifdef RISC
65+
call cublas_handle_init_(cublas_handle)
66+
#else
67+
call cublas_handle_init(cublas_handle)
68+
#endif
69+
#endif
70+
6271
#if defined(_OFFLOAD) && defined(_CUBLAS)
6372
!$omp target data map(to:A,B)
6473
!$omp target data map(from:C)

src/a_module_tests/test_dgemm_b.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
! along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
program test_dgemm_b
17+
use allio, only: cublas_handle
1718
implicit none
1819

1920
real*8, allocatable, dimension(:, :) :: A, B, AB, BB, CB, CB_i
@@ -79,6 +80,14 @@ program test_dgemm_b
7980
BB = 0
8081
CB_i = CB
8182

83+
#if defined(_OFFLOAD) && defined(_CUBLAS)
84+
#ifdef RISC
85+
call cublas_handle_init_(cublas_handle)
86+
#else
87+
call cublas_handle_init(cublas_handle)
88+
#endif
89+
#endif
90+
8291
#if defined(_OFFLOAD) && defined(_CUBLAS)
8392
!$omp target data map(to:A,B)
8493
!$omp target data map(tofrom:AB,BB,CB)

src/a_module_tests/test_dgemv.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
! along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
program test_dgemv
17+
use allio, only: cublas_handle
1718
implicit none
1819

1920
real*8, allocatable, dimension(:, :) :: B
@@ -27,6 +28,11 @@ program test_dgemv
2728

2829
#if defined(_OFFLOAD) && defined(_CUBLAS)
2930
yes_on_target = .true.
31+
#ifdef RISC
32+
call cublas_handle_init_(cublas_handle)
33+
#else
34+
call cublas_handle_init(cublas_handle)
35+
#endif
3036
#endif
3137

3238
! gen = 1 : Generate matrices

src/a_module_tests/test_dgemv_.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
! along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
program test_dgemv_
17+
use allio, only: cublas_handle
1718
implicit none
1819

1920
real*8, allocatable, dimension(:, :) :: B
@@ -27,6 +28,11 @@ program test_dgemv_
2728

2829
#if defined(_OFFLOAD) && defined(_CUBLAS)
2930
yes_on_target = .true.
31+
#ifdef RISC
32+
call cublas_handle_init_(cublas_handle)
33+
#else
34+
call cublas_handle_init(cublas_handle)
35+
#endif
3036
#endif
3137

3238
! gen = 1 : Generate matrices

src/a_module_tests/test_dger.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ program test_dger
1717

1818
#if defined(_OFFLOAD)
1919
use constants, only: yes_ontarget
20+
use allio, only: cublas_handle
2021
#endif
2122

2223
implicit none
@@ -31,6 +32,14 @@ program test_dger
3132
yes_ontarget = .true.
3233
#endif
3334

35+
#if defined(_OFFLOAD) && defined(_CUBLAS)
36+
#ifdef RISC
37+
call cublas_handle_init_(cublas_handle)
38+
#else
39+
call cublas_handle_init(cublas_handle)
40+
#endif
41+
#endif
42+
3443
read (*, *) s
3544

3645
allocate (A(s, s))

src/a_module_tests/test_dger2.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ program test_dger2
1717

1818
#if defined(_OFFLOAD)
1919
use constants, only: yes_ontarget
20+
use allio, only: cublas_handle
2021
#endif
2122

2223
implicit none
@@ -31,6 +32,14 @@ program test_dger2
3132
yes_ontarget = .true.
3233
#endif
3334

35+
#if defined(_OFFLOAD) && defined(_CUBLAS)
36+
#ifdef RISC
37+
call cublas_handle_init_(cublas_handle)
38+
#else
39+
call cublas_handle_init(cublas_handle)
40+
#endif
41+
#endif
42+
3443
read (*, *) s
3544

3645
allocate (A(s, s))

src/a_module_tests/test_dtrsm.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@
1414
! along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
program test_dtrsm
17+
use allio, only: cublas_handle
1718
implicit none
1819

1920
real*8, allocatable, dimension(:, :) :: A, B, C, C_orig
2021
real*8 :: one = 1.d0, zero = 0.d0
2122
integer :: s, gen, ii, jj
2223
character(len=1) :: uplo, side, trans
2324

25+
#if defined(_OFFLOAD) && defined(_CUBLAS)
26+
#ifdef RISC
27+
call cublas_handle_init_(cublas_handle)
28+
#else
29+
call cublas_handle_init(cublas_handle)
30+
#endif
31+
#endif
32+
2433
! gen = 1 : Generate matrices
2534
! gen = 0 : Compare matrices
2635

src/a_module_tests/test_zgemm.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
! along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
program test_zgemm
17+
use allio, only: cublas_handle
1718
implicit none
1819

1920
complex*16, allocatable, dimension(:, :) :: A, B, C, C_orig
@@ -25,6 +26,14 @@ program test_zgemm
2526
character(len=1) :: first, second
2627
character(len=100) :: message, str_tmp1, str_tmp2
2728

29+
#if defined(_OFFLOAD) && defined(_CUBLAS)
30+
#ifdef RISC
31+
call cublas_handle_init_(cublas_handle)
32+
#else
33+
call cublas_handle_init(cublas_handle)
34+
#endif
35+
#endif
36+
2837
! gen = 1 : Generate matrices
2938
! gen = 0 : Compare matrices
3039

src/a_module_tests/test_zgemm_b.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
! along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
program test_zgemm_b
17+
use allio, only: cublas_handle
1718
implicit none
1819

1920
complex*16, allocatable, dimension(:, :) :: A, B, AB, BB, CB, CB_i
@@ -26,6 +27,14 @@ program test_zgemm_b
2627
character(len=1) :: first, second
2728
character(len=100) :: message, str_tmp1, str_tmp2
2829

30+
#if defined(_OFFLOAD) && defined(_CUBLAS)
31+
#ifdef RISC
32+
call cublas_handle_init_(cublas_handle)
33+
#else
34+
call cublas_handle_init(cublas_handle)
35+
#endif
36+
#endif
37+
2938
! gen = 1 : Generate matrices
3039
! gen = 0 : Compare matrices
3140

src/a_module_tests/test_zgemv.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
! along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
program test_zgemv
17+
use allio, only: cublas_handle
1718
implicit none
1819

1920
complex*16, allocatable, dimension(:, :) :: B
@@ -30,6 +31,14 @@ program test_zgemv
3031
yes_on_target = .true.
3132
#endif
3233

34+
#if defined(_OFFLOAD) && defined(_CUBLAS)
35+
#ifdef RISC
36+
call cublas_handle_init_(cublas_handle)
37+
#else
38+
call cublas_handle_init(cublas_handle)
39+
#endif
40+
#endif
41+
3342
! gen = 1 : Generate matrices
3443
! gen = 0 : Compare matrices
3544

0 commit comments

Comments
 (0)