Skip to content

Commit edfeb59

Browse files
committed
OpenMP: replace cpp macros with !$ conditional compilation
1 parent 2ae057f commit edfeb59

10 files changed

+53
-149
lines changed

example/io/example.dat

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/stdlib_linalg_constants.fypp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
module stdlib_linalg_constants
33
use stdlib_kinds, only: sp, dp, qp, int32, int64, lk
44
use, intrinsic :: ieee_arithmetic, only: ieee_is_nan
5-
#if defined(_OPENMP)
6-
use omp_lib
7-
#endif
5+
!$ use omp_lib
86
implicit none(type,external)
97
public
108

src/stdlib_linalg_lapack_aux.fypp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,12 +1762,9 @@ module stdlib_linalg_lapack_aux
17621762
endif
17631763
! get the number of threads
17641764
nthreads = 1
1765-
#if defined(_OPENMP)
1766-
!$OMP PARALLEL
1767-
nthreads = omp_get_num_threads()
1768-
!$OMP END PARALLEL
1769-
#endif
1770-
! write(*,*) 'iparam voici nthreads ispec ',nthreads, ispec
1765+
!$ nthreads = omp_get_num_threads()
1766+
1767+
! write(*,*) 'iparam voici nthreads ispec ',nthreads, ispec
17711768
if( ispec /= 19 ) then
17721769
! convert name to upper case if the first character is lower case.
17731770
stdlib_iparam2stage = -1

src/stdlib_linalg_lapack_c.fypp

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36221,8 +36221,6 @@ module stdlib_linalg_lapack_c
3622136221

3622236222
pure subroutine stdlib_chetrd_hb2st( stage1, vect, uplo, n, kd, ab, ldab,d, e, hous, lhous, &
3622336223
work, lwork, info )
36224-
#if defined(_OPENMP)
36225-
#endif
3622636224
! -- lapack computational routine --
3622736225
! -- lapack is a software package provided by univ. of tennessee, --
3622836226
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
@@ -36400,15 +36398,13 @@ module stdlib_linalg_lapack_c
3640036398
call stdlib_clacpy( "A", kd+1, n, ab, ldab, work( apos ), lda )
3640136399
call stdlib_claset( "A", kd, n, czero, czero, work( awpos ), lda )
3640236400
! openmp parallelisation start here
36403-
#if defined(_OPENMP)
3640436401
!$OMP PARALLEL PRIVATE( TID, THGRID, BLKLASTIND )
3640536402
!$OMP$ PRIVATE( THED, I, M, K, ST, ED, STT, SWEEPID )
3640636403
!$OMP$ PRIVATE( MYID, TTYPE, COLPT, STIND, EDIND )
3640736404
!$OMP$ SHARED ( UPLO, WANTQ, INDV, INDTAU, HOUS, WORK)
3640836405
!$OMP$ SHARED ( N, KD, IB, NBTILES, LDA, LDV, INDA )
3640936406
!$OMP$ SHARED ( STEPERCOL, THGRNB, THGRSIZ, GRSIZ, SHIFT )
3641036407
!$OMP MASTER
36411-
#endif
3641236408
! main bulge chasing loop
3641336409
loop_100: do thgrid = 1, thgrnb
3641436410
stt = (thgrid-1)*thgrsiz+1
@@ -36442,30 +36438,24 @@ module stdlib_linalg_lapack_c
3644236438
endif
3644336439
endif
3644436440
! call the kernel
36445-
#if defined(_OPENMP) && _OPENMP >= 201307
36446-
if( ttype/=1 ) then
36441+
!$ if( ttype/=1 ) then
3644736442
!$OMP TASK DEPEND(in:WORK(MYID+SHIFT-1))
3644836443
!$OMP$ DEPEND(in:WORK(MYID-1))
3644936444
!$OMP$ DEPEND(out:WORK(MYID))
36450-
tid = omp_get_thread_num()
36451-
call stdlib_chb2st_kernels( uplo, wantq, ttype,stind, edind, &
36452-
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
36453-
indtau ), ldv,work( indw + tid*kd ) )
36445+
!$ tid = omp_get_thread_num()
36446+
!$ call stdlib_chb2st_kernels( uplo, wantq, ttype,stind, edind, &
36447+
!$ sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
36448+
!$ indtau ), ldv,work( indw + tid*kd ) )
3645436449
!$OMP END TASK
36455-
else
36450+
!$ else
3645636451
!$OMP TASK DEPEND(in:WORK(MYID+SHIFT-1))
3645736452
!$OMP$ DEPEND(out:WORK(MYID))
36458-
tid = omp_get_thread_num()
36453+
!$ tid = omp_get_thread_num()
3645936454
call stdlib_chb2st_kernels( uplo, wantq, ttype,stind, edind, &
3646036455
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
36461-
indtau ), ldv,work( indw + tid*kd ) )
36456+
indtau ), ldv,work( indw + tid*kd ) )
3646236457
!$OMP END TASK
36463-
endif
36464-
#else
36465-
call stdlib_chb2st_kernels( uplo, wantq, ttype,stind, edind, &
36466-
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( indtau ),&
36467-
ldv,work( indw + tid*kd ) )
36468-
#endif
36458+
!$ endif
3646936459
if ( blklastind>=(n-1) ) then
3647036460
stt = stt + 1
3647136461
exit
@@ -36475,10 +36465,8 @@ module stdlib_linalg_lapack_c
3647536465
end do loop_120
3647636466
end do loop_110
3647736467
end do loop_100
36478-
#if defined(_OPENMP)
3647936468
!$OMP END MASTER
3648036469
!$OMP END PARALLEL
36481-
#endif
3648236470
! copy the diagonal from a to d. note that d is real thus only
3648336471
! the real part is needed, the imaginary part should be czero.
3648436472
do i = 1, n

src/stdlib_linalg_lapack_d.fypp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41294,8 +41294,6 @@ module stdlib_linalg_lapack_d
4129441294

4129541295
pure subroutine stdlib_dsytrd_sb2st( stage1, vect, uplo, n, kd, ab, ldab,d, e, hous, lhous, &
4129641296
work, lwork, info )
41297-
#if defined(_OPENMP)
41298-
#endif
4129941297
! -- lapack computational routine --
4130041298
! -- lapack is a software package provided by univ. of tennessee, --
4130141299
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
@@ -41446,15 +41444,13 @@ module stdlib_linalg_lapack_d
4144641444
call stdlib_dlacpy( "A", kd+1, n, ab, ldab, work( apos ), lda )
4144741445
call stdlib_dlaset( "A", kd, n, zero, zero, work( awpos ), lda )
4144841446
! openmp parallelisation start here
41449-
#if defined(_OPENMP)
4145041447
!$OMP PARALLEL PRIVATE( TID, THGRID, BLKLASTIND )
4145141448
!$OMP$ PRIVATE( THED, I, M, K, ST, ED, STT, SWEEPID )
4145241449
!$OMP$ PRIVATE( MYID, TTYPE, COLPT, STIND, EDIND )
4145341450
!$OMP$ SHARED ( UPLO, WANTQ, INDV, INDTAU, HOUS, WORK)
4145441451
!$OMP$ SHARED ( N, KD, IB, NBTILES, LDA, LDV, INDA )
4145541452
!$OMP$ SHARED ( STEPERCOL, THGRNB, THGRSIZ, GRSIZ, SHIFT )
4145641453
!$OMP MASTER
41457-
#endif
4145841454
! main bulge chasing loop
4145941455
loop_100: do thgrid = 1, thgrnb
4146041456
stt = (thgrid-1)*thgrsiz+1
@@ -41488,30 +41484,24 @@ module stdlib_linalg_lapack_d
4148841484
endif
4148941485
endif
4149041486
! call the kernel
41491-
#if defined(_OPENMP) && _OPENMP >= 201307
41492-
if( ttype/=1 ) then
41487+
!$ if( ttype/=1 ) then
4149341488
!$OMP TASK DEPEND(in:WORK(MYID+SHIFT-1))
4149441489
!$OMP$ DEPEND(in:WORK(MYID-1))
4149541490
!$OMP$ DEPEND(out:WORK(MYID))
41496-
tid = omp_get_thread_num()
41497-
call stdlib_dsb2st_kernels( uplo, wantq, ttype,stind, edind, &
41498-
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
41499-
indtau ), ldv,work( indw + tid*kd ) )
41491+
!$ tid = omp_get_thread_num()
41492+
!$ call stdlib_dsb2st_kernels( uplo, wantq, ttype,stind, edind, &
41493+
!$ sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
41494+
!$ indtau ), ldv,work( indw + tid*kd ) )
4150041495
!$OMP END TASK
41501-
else
41496+
!$ else
4150241497
!$OMP TASK DEPEND(in:WORK(MYID+SHIFT-1))
4150341498
!$OMP$ DEPEND(out:WORK(MYID))
41504-
tid = omp_get_thread_num()
41499+
!$ tid = omp_get_thread_num()
4150541500
call stdlib_dsb2st_kernels( uplo, wantq, ttype,stind, edind, &
4150641501
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
4150741502
indtau ), ldv,work( indw + tid*kd ) )
4150841503
!$OMP END TASK
41509-
endif
41510-
#else
41511-
call stdlib_dsb2st_kernels( uplo, wantq, ttype,stind, edind, &
41512-
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( indtau ),&
41513-
ldv,work( indw + tid*kd ) )
41514-
#endif
41504+
!$ endif
4151541505
if ( blklastind>=(n-1) ) then
4151641506
stt = stt + 1
4151741507
exit
@@ -41521,10 +41511,8 @@ module stdlib_linalg_lapack_d
4152141511
end do loop_120
4152241512
end do loop_110
4152341513
end do loop_100
41524-
#if defined(_OPENMP)
4152541514
!$OMP END MASTER
4152641515
!$OMP END PARALLEL
41527-
#endif
4152841516
! copy the diagonal from a to d. note that d is real thus only
4152941517
! the real part is needed, the imaginary part should be zero.
4153041518
do i = 1, n

src/stdlib_linalg_lapack_q.fypp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72658,8 +72658,6 @@ module stdlib_linalg_lapack_q
7265872658

7265972659
pure subroutine stdlib_qsytrd_sb2st( stage1, vect, uplo, n, kd, ab, ldab,d, e, hous, lhous, &
7266072660
work, lwork, info )
72661-
#if defined(_OPENMP)
72662-
#endif
7266372661
! -- lapack computational routine --
7266472662
! -- lapack is a software package provided by univ. of tennessee, --
7266572663
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
@@ -72810,15 +72808,13 @@ module stdlib_linalg_lapack_q
7281072808
call stdlib_qlacpy( "A", kd+1, n, ab, ldab, work( apos ), lda )
7281172809
call stdlib_qlaset( "A", kd, n, zero, zero, work( awpos ), lda )
7281272810
! openmp parallelisation start here
72813-
#if defined(_OPENMP)
7281472811
!$OMP PARALLEL PRIVATE( TID, THGRID, BLKLASTIND )
7281572812
!$OMP$ PRIVATE( THED, I, M, K, ST, ED, STT, SWEEPID )
7281672813
!$OMP$ PRIVATE( MYID, TTYPE, COLPT, STIND, EDIND )
7281772814
!$OMP$ SHARED ( UPLO, WANTQ, INDV, INDTAU, HOUS, WORK)
7281872815
!$OMP$ SHARED ( N, KD, IB, NBTILES, LDA, LDV, INDA )
7281972816
!$OMP$ SHARED ( STEPERCOL, THGRNB, THGRSIZ, GRSIZ, SHIFT )
7282072817
!$OMP MASTER
72821-
#endif
7282272818
! main bulge chasing loop
7282372819
loop_100: do thgrid = 1, thgrnb
7282472820
stt = (thgrid-1)*thgrsiz+1
@@ -72852,30 +72848,24 @@ module stdlib_linalg_lapack_q
7285272848
endif
7285372849
endif
7285472850
! call the kernel
72855-
#if defined(_OPENMP) && _OPENMP >= 201307
72856-
if( ttype/=1 ) then
72851+
!$ if( ttype/=1 ) then
7285772852
!$OMP TASK DEPEND(in:WORK(MYID+SHIFT-1))
7285872853
!$OMP$ DEPEND(in:WORK(MYID-1))
7285972854
!$OMP$ DEPEND(out:WORK(MYID))
72860-
tid = omp_get_thread_num()
72861-
call stdlib_qsb2st_kernels( uplo, wantq, ttype,stind, edind, &
72862-
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
72863-
indtau ), ldv,work( indw + tid*kd ) )
72855+
!$ tid = omp_get_thread_num()
72856+
!$ call stdlib_qsb2st_kernels( uplo, wantq, ttype,stind, edind, &
72857+
!$ sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
72858+
!$ indtau ), ldv,work( indw + tid*kd ) )
7286472859
!$OMP END TASK
72865-
else
72860+
!$ else
7286672861
!$OMP TASK DEPEND(in:WORK(MYID+SHIFT-1))
7286772862
!$OMP$ DEPEND(out:WORK(MYID))
72868-
tid = omp_get_thread_num()
72863+
!$ tid = omp_get_thread_num()
7286972864
call stdlib_qsb2st_kernels( uplo, wantq, ttype,stind, edind, &
7287072865
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
7287172866
indtau ), ldv,work( indw + tid*kd ) )
7287272867
!$OMP END TASK
72873-
endif
72874-
#else
72875-
call stdlib_qsb2st_kernels( uplo, wantq, ttype,stind, edind, &
72876-
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( indtau ),&
72877-
ldv,work( indw + tid*kd ) )
72878-
#endif
72868+
!$ endif
7287972869
if ( blklastind>=(n-1) ) then
7288072870
stt = stt + 1
7288172871
exit
@@ -72885,10 +72875,8 @@ module stdlib_linalg_lapack_q
7288572875
end do loop_120
7288672876
end do loop_110
7288772877
end do loop_100
72888-
#if defined(_OPENMP)
7288972878
!$OMP END MASTER
7289072879
!$OMP END PARALLEL
72891-
#endif
7289272880
! copy the diagonal from a to d. note that d is real thus only
7289372881
! the real part is needed, the imaginary part should be zero.
7289472882
do i = 1, n

src/stdlib_linalg_lapack_s.fypp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41204,8 +41204,6 @@ module stdlib_linalg_lapack_s
4120441204

4120541205
pure subroutine stdlib_ssytrd_sb2st( stage1, vect, uplo, n, kd, ab, ldab,d, e, hous, lhous, &
4120641206
work, lwork, info )
41207-
#if defined(_OPENMP)
41208-
#endif
4120941207
! -- lapack computational routine --
4121041208
! -- lapack is a software package provided by univ. of tennessee, --
4121141209
! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
@@ -41356,15 +41354,13 @@ module stdlib_linalg_lapack_s
4135641354
call stdlib_slacpy( "A", kd+1, n, ab, ldab, work( apos ), lda )
4135741355
call stdlib_slaset( "A", kd, n, zero, zero, work( awpos ), lda )
4135841356
! openmp parallelisation start here
41359-
#if defined(_OPENMP)
4136041357
!$OMP PARALLEL PRIVATE( TID, THGRID, BLKLASTIND )
4136141358
!$OMP$ PRIVATE( THED, I, M, K, ST, ED, STT, SWEEPID )
4136241359
!$OMP$ PRIVATE( MYID, TTYPE, COLPT, STIND, EDIND )
4136341360
!$OMP$ SHARED ( UPLO, WANTQ, INDV, INDTAU, HOUS, WORK)
4136441361
!$OMP$ SHARED ( N, KD, IB, NBTILES, LDA, LDV, INDA )
4136541362
!$OMP$ SHARED ( STEPERCOL, THGRNB, THGRSIZ, GRSIZ, SHIFT )
4136641363
!$OMP MASTER
41367-
#endif
4136841364
! main bulge chasing loop
4136941365
loop_100: do thgrid = 1, thgrnb
4137041366
stt = (thgrid-1)*thgrsiz+1
@@ -41398,30 +41394,24 @@ module stdlib_linalg_lapack_s
4139841394
endif
4139941395
endif
4140041396
! call the kernel
41401-
#if defined(_OPENMP) && _OPENMP >= 201307
41402-
if( ttype/=1 ) then
41397+
!$ if( ttype/=1 ) then
4140341398
!$OMP TASK DEPEND(in:WORK(MYID+SHIFT-1))
4140441399
!$OMP$ DEPEND(in:WORK(MYID-1))
4140541400
!$OMP$ DEPEND(out:WORK(MYID))
41406-
tid = omp_get_thread_num()
41407-
call stdlib_ssb2st_kernels( uplo, wantq, ttype,stind, edind, &
41408-
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
41409-
indtau ), ldv,work( indw + tid*kd ) )
41401+
!$ tid = omp_get_thread_num()
41402+
!$ call stdlib_ssb2st_kernels( uplo, wantq, ttype,stind, edind, &
41403+
!$ sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
41404+
!$ indtau ), ldv,work( indw + tid*kd ) )
4141041405
!$OMP END TASK
41411-
else
41406+
!$ else
4141241407
!$OMP TASK DEPEND(in:WORK(MYID+SHIFT-1))
4141341408
!$OMP$ DEPEND(out:WORK(MYID))
41414-
tid = omp_get_thread_num()
41409+
!$ tid = omp_get_thread_num()
4141541410
call stdlib_ssb2st_kernels( uplo, wantq, ttype,stind, edind, &
4141641411
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( &
4141741412
indtau ), ldv,work( indw + tid*kd ) )
4141841413
!$OMP END TASK
41419-
endif
41420-
#else
41421-
call stdlib_ssb2st_kernels( uplo, wantq, ttype,stind, edind, &
41422-
sweepid, n, kd, ib,work ( inda ), lda,hous( indv ), hous( indtau ),&
41423-
ldv,work( indw + tid*kd ) )
41424-
#endif
41414+
!$ endif
4142541415
if ( blklastind>=(n-1) ) then
4142641416
stt = stt + 1
4142741417
exit
@@ -41431,10 +41421,8 @@ module stdlib_linalg_lapack_s
4143141421
end do loop_120
4143241422
end do loop_110
4143341423
end do loop_100
41434-
#if defined(_OPENMP)
4143541424
!$OMP END MASTER
4143641425
!$OMP END PARALLEL
41437-
#endif
4143841426
! copy the diagonal from a to d. note that d is real thus only
4143941427
! the real part is needed, the imaginary part should be zero.
4144041428
do i = 1, n

0 commit comments

Comments
 (0)