LCOV - code coverage report
Current view: top level - shared/common/src/28_numeric_noabirule - abi_xscal.f90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 37.7 % 53 20
Test Date: 2026-11-09 13:21:34 Functions: 40.0 % 10 4
Branches: 7.0 % 200 14

             Branch data     Line data    Source code
       1                 :             : !{\src2tex{textfont=tt}}
       2                 :             : !!****f* m_abi_linalg/abi_xscal
       3                 :             : !! NAME
       4                 :             : !!  abi_xscal
       5                 :             : !!
       6                 :             : !! FUNCTION
       7                 :             : !!  abi_xscal is the generic function for BLAS-1 SCAL (x = alpha * x)
       8                 :             : !!  with optional GPU dispatch.
       9                 :             : !!
      10                 :             : !! COPYRIGHT
      11                 :             : !!  Copyright (C) 2001-2026 ABINIT group
      12                 :             : !!  This file is distributed under the terms of the
      13                 :             : !!  GNU General Public License, see ~abinit/COPYING
      14                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
      15                 :             : !!
      16                 :             : !! SOURCE
      17                 :             : 
      18                 :             : !!***
      19                 :             : 
      20                 :             : !----------------------------------------------------------------------
      21                 :             : 
      22                 :             : !!****f* m_abi_linalg/abi_d2zscal
      23                 :             : !! NAME
      24                 :             : !! abi_d2zscal
      25                 :             : !!
      26                 :             : !! FUNCTION
      27                 :             : !!  Real SCAL: x = alpha * x, with real(dp) alpha and real(dp) array.
      28                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=1.
      29                 :             : !!
      30                 :             : !! INPUTS
      31                 :             : !!
      32                 :             : !! SOURCE
      33                 :             : 
      34                 :      590740 : subroutine abi_d2zscal(n, alpha, x, incx, x_cplx, gpu_option)
      35                 :             : 
      36                 :             : !Arguments ------------------------------------
      37                 :             :  integer, intent(in) :: n
      38                 :             :  complex(dpc), intent(in) :: alpha
      39                 :             :  real(dp), target, intent(inout) :: x(*)
      40                 :             :  integer, intent(in) :: incx
      41                 :             :  !Optionals -----------------------------------
      42                 :             :  integer, intent(in), optional :: x_cplx,gpu_option
      43                 :             : 
      44                 :             : !Local variables-------------------------------
      45                 :             :  integer :: cplx_,gpu_option_
      46                 :             : 
      47                 :             : ! *********************************************************************
      48                 :             : 
      49         [ +  - ]:      590740 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
      50         [ +  - ]:      590740 :  cplx_=1 ; if(PRESENT(x_cplx)) cplx_ = x_cplx
      51                 :             : 
      52                 :             : #if defined(DEBUG_VERBOSE) && defined(HAVE_OPENMP_OFFLOAD)
      53                 :             :  if ( gpu_option_ == ABI_GPU_OPENMP ) then
      54                 :             :    ABI_CHECK(xomp_target_is_present(c_loc(x)), "Array isn't mapped on GPU")
      55                 :             :  end if
      56                 :             : #endif
      57                 :             : 
      58         [ -  + ]:      590740 :  if(gpu_option_/=ABI_GPU_DISABLED) then
      59         [ #  # ]:           0 :    if(gpu_option_==ABI_GPU_OPENMP) then
      60                 :             : #ifdef HAVE_OPENMP_OFFLOAD
      61                 :             :      !$OMP TARGET DATA USE_DEVICE_ADDR(x)
      62                 :             :      call abi_gpu_xscal_cptr(cplx_, n, alpha, c_loc(x), incx)
      63                 :             :      !$OMP END TARGET DATA
      64                 :             : #endif
      65                 :             :    else
      66                 :           0 :      call abi_gpu_xscal_cptr(cplx_, n, alpha, c_loc(x), incx)
      67                 :             :    end if
      68                 :             :  else
      69         [ +  - ]:      590740 :    if(cplx_==1) then
      70                 :      590740 :      call dscal(n, alpha, x, incx)
      71                 :             :    else
      72                 :           0 :      call zscal(n, alpha, x, incx)
      73                 :             :    end if
      74                 :             :  end if
      75                 :             : 
      76                 :      590740 : end subroutine abi_d2zscal
      77                 :             : !!***
      78                 :             : 
      79                 :             : !----------------------------------------------------------------------
      80                 :             : 
      81                 :             : !!****f* m_abi_linalg/abi_d2zscal_3d
      82                 :             : !! NAME
      83                 :             : !! abi_d2zscal_3d
      84                 :             : !!
      85                 :             : !! FUNCTION
      86                 :             : !!  Real SCAL: x = alpha * x, with real(dp) alpha and real(dp) array.
      87                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=1.
      88                 :             : !!
      89                 :             : !! INPUTS
      90                 :             : !!
      91                 :             : !! SOURCE
      92                 :             : 
      93         [ #  # ]:           0 : subroutine abi_d2zscal_3d(n, alpha, x, incx, x_cplx, gpu_option)
      94                 :             : 
      95                 :             : !Arguments ------------------------------------
      96                 :             :  integer, intent(in) :: n
      97                 :             :  complex(dpc), intent(in) :: alpha
      98                 :             :  real(dp), target, intent(inout) :: x(:,:,:)
      99                 :             :  integer, intent(in) :: incx
     100                 :             :  !Optionals -----------------------------------
     101                 :             :  integer, intent(in), optional :: x_cplx,gpu_option
     102                 :             : 
     103                 :             : !Local variables-------------------------------
     104                 :             :  integer :: cplx_,gpu_option_
     105                 :             : 
     106                 :             : ! *********************************************************************
     107                 :             : 
     108         [ #  # ]:           0 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
     109         [ #  # ]:           0 :  cplx_=1 ; if(PRESENT(x_cplx)) cplx_ = x_cplx
     110                 :             : 
     111   [ #  #  #  #  :           0 :  call abi_d2zscal(n, alpha, x, incx, x_cplx=cplx_, gpu_option=gpu_option_)
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     112                 :             : 
     113                 :           0 : end subroutine abi_d2zscal_3d
     114                 :             : !!***
     115                 :             : 
     116                 :             : !----------------------------------------------------------------------
     117                 :             : 
     118                 :             : !!****f* m_abi_linalg/abi_d2zscal_4d
     119                 :             : !! NAME
     120                 :             : !! abi_d2zscal_4d
     121                 :             : !!
     122                 :             : !! FUNCTION
     123                 :             : !!  Real SCAL: x = alpha * x, with real(dp) alpha and real(dp) array.
     124                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=1.
     125                 :             : !!
     126                 :             : !! INPUTS
     127                 :             : !!
     128                 :             : !! SOURCE
     129                 :             : 
     130         [ #  # ]:           0 : subroutine abi_d2zscal_4d(n, alpha, x, incx, x_cplx, gpu_option)
     131                 :             : 
     132                 :             : !Arguments ------------------------------------
     133                 :             :  integer, intent(in) :: n
     134                 :             :  complex(dpc), intent(in) :: alpha
     135                 :             :  real(dp), target, intent(inout) :: x(:,:,:,:)
     136                 :             :  integer, intent(in) :: incx
     137                 :             :  !Optionals -----------------------------------
     138                 :             :  integer, intent(in), optional :: x_cplx,gpu_option
     139                 :             : 
     140                 :             : !Local variables-------------------------------
     141                 :             :  integer :: cplx_,gpu_option_
     142                 :             : 
     143                 :             : ! *********************************************************************
     144                 :             : 
     145         [ #  # ]:           0 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
     146         [ #  # ]:           0 :  cplx_=1 ; if(PRESENT(x_cplx)) cplx_ = x_cplx
     147                 :             : 
     148   [ #  #  #  #  :           0 :  call abi_d2zscal(n, alpha, x, incx, x_cplx=cplx_, gpu_option=gpu_option_)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                #  #  # ]
     149                 :             : 
     150                 :           0 : end subroutine abi_d2zscal_4d
     151                 :             : !!***
     152                 :             : 
     153                 :             : !----------------------------------------------------------------------
     154                 :             : 
     155                 :             : !!****f* m_abi_linalg/abi_d2zscal_5d
     156                 :             : !! NAME
     157                 :             : !! abi_d2zscal_5d
     158                 :             : !!
     159                 :             : !! FUNCTION
     160                 :             : !!  Real SCAL: x = alpha * x, with real(dp) alpha and real(dp) array.
     161                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=1.
     162                 :             : !!
     163                 :             : !! INPUTS
     164                 :             : !!
     165                 :             : !! SOURCE
     166                 :             : 
     167         [ #  # ]:           0 : subroutine abi_d2zscal_5d(n, alpha, x, incx, x_cplx, gpu_option)
     168                 :             : 
     169                 :             : !Arguments ------------------------------------
     170                 :             :  integer, intent(in) :: n
     171                 :             :  complex(dpc), intent(in) :: alpha
     172                 :             :  real(dp), target, intent(inout) :: x(:,:,:,:,:)
     173                 :             :  integer, intent(in) :: incx
     174                 :             :  !Optionals -----------------------------------
     175                 :             :  integer, intent(in), optional :: x_cplx,gpu_option
     176                 :             : 
     177                 :             : !Local variables-------------------------------
     178                 :             :  integer :: cplx_,gpu_option_
     179                 :             : 
     180                 :             : ! *********************************************************************
     181                 :             : 
     182         [ #  # ]:           0 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
     183         [ #  # ]:           0 :  cplx_=1 ; if(PRESENT(x_cplx)) cplx_ = x_cplx
     184                 :             : 
     185   [ #  #  #  #  :           0 :  call abi_d2zscal(n, alpha, x, incx, x_cplx=cplx_, gpu_option=gpu_option_)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     186                 :             : 
     187                 :           0 : end subroutine abi_d2zscal_5d
     188                 :             : !!***
     189                 :             : 
     190                 :             : !----------------------------------------------------------------------
     191                 :             : 
     192                 :             : !!****f* m_abi_linalg/abi_d2zscal_7d
     193                 :             : !! NAME
     194                 :             : !! abi_d2zscal_7d
     195                 :             : !!
     196                 :             : !! FUNCTION
     197                 :             : !!  Real SCAL: x = alpha * x, with real(dp) alpha and real(dp) array.
     198                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=1.
     199                 :             : !!
     200                 :             : !! INPUTS
     201                 :             : !!
     202                 :             : !! SOURCE
     203                 :             : 
     204         [ #  # ]:           0 : subroutine abi_d2zscal_7d(n, alpha, x, incx, x_cplx, gpu_option)
     205                 :             : 
     206                 :             : !Arguments ------------------------------------
     207                 :             :  integer, intent(in) :: n
     208                 :             :  complex(dpc), intent(in) :: alpha
     209                 :             :  real(dp), target, intent(inout) :: x(:,:,:,:,:,:,:)
     210                 :             :  integer, intent(in) :: incx
     211                 :             :  !Optionals -----------------------------------
     212                 :             :  integer, intent(in), optional :: x_cplx,gpu_option
     213                 :             : 
     214                 :             : !Local variables-------------------------------
     215                 :             :  integer :: cplx_,gpu_option_
     216                 :             : 
     217                 :             : ! *********************************************************************
     218                 :             : 
     219         [ #  # ]:           0 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
     220         [ #  # ]:           0 :  cplx_=1 ; if(PRESENT(x_cplx)) cplx_ = x_cplx
     221                 :             : 
     222   [ #  #  #  #  :           0 :  call abi_d2zscal(n, alpha, x, incx, x_cplx=cplx_, gpu_option=gpu_option_)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  #  
                      # ]
     223                 :             : 
     224                 :           0 : end subroutine abi_d2zscal_7d
     225                 :             : !!***
     226                 :             : 
     227                 :             : !----------------------------------------------------------------------
     228                 :             : 
     229                 :             : !!****f* m_abi_linalg/abi_dscal
     230                 :             : !! NAME
     231                 :             : !! abi_dscal
     232                 :             : !!
     233                 :             : !! FUNCTION
     234                 :             : !!  Real SCAL: x = alpha * x, with real(dp) alpha and real(dp) array.
     235                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=1.
     236                 :             : !!
     237                 :             : !! INPUTS
     238                 :             : !!
     239                 :             : !! SOURCE
     240                 :             : 
     241                 :           0 : subroutine abi_dscal(n, alpha, x, incx, gpu_option)
     242                 :             : 
     243                 :             : !Arguments ------------------------------------
     244                 :             :  integer, intent(in) :: n
     245                 :             :  real(dp), intent(in) :: alpha
     246                 :             :  real(dp), target, intent(inout) :: x(*)
     247                 :             :  integer, intent(in) :: incx
     248                 :             :  !Optionals -----------------------------------
     249                 :             :  integer, intent(in), optional :: gpu_option
     250                 :             : 
     251                 :             : !Local variables-------------------------------
     252                 :             :  integer :: gpu_option_
     253                 :             : 
     254                 :             : ! *********************************************************************
     255                 :             : 
     256         [ #  # ]:           0 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
     257                 :             : 
     258                 :           0 :  call abi_d2zscal(n, dcmplx(alpha, 0.0_dp), x, incx, x_cplx=1, gpu_option=gpu_option_)
     259                 :             : 
     260                 :           0 : end subroutine abi_dscal
     261                 :             : !!***
     262                 :             : 
     263                 :             : !----------------------------------------------------------------------
     264                 :             : 
     265                 :             : !!****f* m_abi_linalg/abi_dscal_2d
     266                 :             : !! NAME
     267                 :             : !! abi_dscal_2d
     268                 :             : !!
     269                 :             : !! FUNCTION
     270                 :             : !!  Real SCAL: x = alpha * x, with real(dp) alpha and real(dp) array.
     271                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=1.
     272                 :             : !!
     273                 :             : !! INPUTS
     274                 :             : !!
     275                 :             : !! SOURCE
     276                 :             : 
     277         [ -  + ]:      590740 : subroutine abi_dscal_2d(n, alpha, x, incx, gpu_option)
     278                 :             : 
     279                 :             : !Arguments ------------------------------------
     280                 :             :  integer, intent(in) :: n
     281                 :             :  real(dp), intent(in) :: alpha
     282                 :             :  real(dp), target, intent(inout) :: x(:,:)
     283                 :             :  integer, intent(in) :: incx
     284                 :             :  !Optionals -----------------------------------
     285                 :             :  integer, intent(in), optional :: gpu_option
     286                 :             : 
     287                 :             : !Local variables-------------------------------
     288                 :             :  integer :: gpu_option_
     289                 :             : 
     290                 :             : ! *********************************************************************
     291                 :             : 
     292         [ +  - ]:      590740 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
     293                 :             : 
     294   [ -  +  -  -  :      590740 :  call abi_d2zscal(n, dcmplx(alpha, 0.0_dp), x, incx, x_cplx=1, gpu_option=gpu_option_)
          -  -  -  -  -  
             +  -  -  -  
                      - ]
     295                 :             : 
     296                 :      590740 : end subroutine abi_dscal_2d
     297                 :             : !!***
     298                 :             : 
     299                 :             : !----------------------------------------------------------------------
     300                 :             : 
     301                 :             : !!****f* m_abi_linalg/abi_zscal
     302                 :             : !! NAME
     303                 :             : !! abi_zscal
     304                 :             : !!
     305                 :             : !! FUNCTION
     306                 :             : !!  Complex SCAL: x = alpha * x, with complex(dp) alpha and complex(dp) array.
     307                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=2.
     308                 :             : !!
     309                 :             : !! INPUTS
     310                 :             : !!
     311                 :             : !! SOURCE
     312                 :             : 
     313                 :     1058221 : subroutine abi_zscal(n, alpha, x, incx, gpu_option)
     314                 :             : 
     315                 :             : !Arguments ------------------------------------
     316                 :             :  integer, intent(in) :: n
     317                 :             :  complex(dp), intent(in) :: alpha
     318                 :             :  complex(dp), target, intent(inout) :: x(*)
     319                 :             :  integer, intent(in) :: incx
     320                 :             :  !Optionals -----------------------------------
     321                 :             :  integer, intent(in), optional :: gpu_option
     322                 :             : 
     323                 :             : !Local variables-------------------------------
     324                 :             :  integer :: gpu_option_
     325                 :             : 
     326                 :             : ! *********************************************************************
     327                 :             : 
     328         [ +  - ]:     1058221 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
     329                 :             : 
     330                 :             : #if defined(DEBUG_VERBOSE) && defined(HAVE_OPENMP_OFFLOAD)
     331                 :             :  if ( gpu_option_ == ABI_GPU_OPENMP ) then
     332                 :             :    ABI_CHECK(xomp_target_is_present(c_loc(x)), "Array isn't mapped on GPU")
     333                 :             :  end if
     334                 :             : #endif
     335                 :             : 
     336         [ -  + ]:     1058221 :  if(gpu_option_/=ABI_GPU_DISABLED) then
     337         [ #  # ]:           0 :    if(gpu_option_==ABI_GPU_OPENMP) then
     338                 :             : #ifdef HAVE_OPENMP_OFFLOAD
     339                 :             :      !$OMP TARGET DATA USE_DEVICE_ADDR(x) IF(gpu_option_==ABI_GPU_OPENMP)
     340                 :             :      call abi_gpu_xscal_cptr(2, n, alpha, c_loc(x), incx)
     341                 :             :      !$OMP END TARGET DATA
     342                 :             : #endif
     343                 :             :    else
     344                 :           0 :      call abi_gpu_xscal_cptr(2, n, alpha, c_loc(x), incx)
     345                 :             :    end if
     346                 :             :  else
     347                 :     1058221 :    call zscal(n, alpha, x, incx)
     348                 :             :  end if
     349                 :             : 
     350                 :     1058221 : end subroutine abi_zscal
     351                 :             : !!***
     352                 :             : 
     353                 :             : !----------------------------------------------------------------------
     354                 :             : 
     355                 :             : !!****f* m_abi_linalg/abi_zscal_2d
     356                 :             : !! NAME
     357                 :             : !! abi_zscal
     358                 :             : !!
     359                 :             : !! FUNCTION
     360                 :             : !!  Complex SCAL: x = alpha * x, with complex(dp) alpha and complex(dp) array.
     361                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=2.
     362                 :             : !!
     363                 :             : !! INPUTS
     364                 :             : !!
     365                 :             : !! SOURCE
     366                 :             : 
     367         [ -  + ]:     1058221 : subroutine abi_zscal_2d(n, alpha, x, incx, gpu_option)
     368                 :             : 
     369                 :             : !Arguments ------------------------------------
     370                 :             :  integer, intent(in) :: n
     371                 :             :  complex(dp), intent(in) :: alpha
     372                 :             :  complex(dp), target, intent(inout) :: x(:,:)
     373                 :             :  integer, intent(in) :: incx
     374                 :             :  !Optionals -----------------------------------
     375                 :             :  integer, intent(in), optional :: gpu_option
     376                 :             : 
     377                 :             : !Local variables-------------------------------
     378                 :             :  integer :: gpu_option_
     379                 :             : 
     380                 :             : ! *********************************************************************
     381                 :             : 
     382         [ +  - ]:     1058221 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
     383                 :             : 
     384   [ -  +  -  -  :     1058221 :  call abi_zscal(n, alpha, x, incx, gpu_option=gpu_option_)
          -  -  -  -  -  
             +  -  -  -  
                      - ]
     385                 :             : 
     386                 :     1058221 : end subroutine abi_zscal_2d
     387                 :             : !!***
     388                 :             : 
     389                 :             : !----------------------------------------------------------------------
     390                 :             : 
     391                 :             : !!****f* m_abi_linalg/abi_zscal_3d
     392                 :             : !! NAME
     393                 :             : !! abi_zscal_3d
     394                 :             : !!
     395                 :             : !! FUNCTION
     396                 :             : !!  Complex SCAL: x = alpha * x, with complex(dp) alpha and complex(dp) array.
     397                 :             : !!  On GPU, calls abi_gpu_xscal_cptr with cplx=2.
     398                 :             : !!
     399                 :             : !! INPUTS
     400                 :             : !!
     401                 :             : !! SOURCE
     402                 :             : 
     403         [ #  # ]:           0 : subroutine abi_zscal_3d(n, alpha, x, incx, gpu_option)
     404                 :             : 
     405                 :             : !Arguments ------------------------------------
     406                 :             :  integer, intent(in) :: n
     407                 :             :  complex(dp), intent(in) :: alpha
     408                 :             :  complex(dp), target, intent(inout) :: x(:,:,:)
     409                 :             :  integer, intent(in) :: incx
     410                 :             :  !Optionals -----------------------------------
     411                 :             :  integer, intent(in), optional :: gpu_option
     412                 :             : 
     413                 :             : !Local variables-------------------------------
     414                 :             :  integer :: gpu_option_
     415                 :             : 
     416                 :             : ! *********************************************************************
     417                 :             : 
     418         [ #  # ]:           0 :  gpu_option_=ABI_GPU_DISABLED ; if(PRESENT(gpu_option)) gpu_option_ = gpu_option
     419                 :             : 
     420   [ #  #  #  #  :           0 :  call abi_zscal(n, alpha, x, incx, gpu_option=gpu_option_)
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     421                 :             : 
     422                 :           0 : end subroutine abi_zscal_3d
     423                 :             : !!***
        

Generated by: LCOV version 2.3-1