possible to specify "stream" inside !$cuf kernel ?

Hi,

I would like to know if there is any way to specify in a !cuf kernel directive that it must run the loop on a particular stream, because pgfortran refuses to compile the program below and reports a syntax error.

      program mysum
      use cudafor
      IMPLICIT NONE
      integer,parameter::n=13,nStreams=4
      integer :: stream(nStreams)
      real:: xx(n)
      real, device:: xx_dev(n)
      real val
      integer i,istat

      do i = 1, nStreams
        istat = cudaStreamCreate(stream(i))
      enddo

      write(*,*) stream

      do i=1,n
       xx(i)=real(i)
      enddo
      write(*,*) xx

      xx_dev=xx
      val = 0.0
!$cuf kernel do {{{ *, *, 0, stream(1) }}}
      do i=1,n
        val = val+xx_dev(i)
      enddo

      write(*,*) sum(xx),val
      end program mysum

thanks.
(Note: in the chevron syntax, please replace the curly braces with angle brackets because the angle brackets did not display the contents inside it correctly, which is probably some HTML issue)

Hi hajmola,

Currently, the CUF kernel directive does not allow for you to specify the stream. You will need to write your own kernels to use this functionality. However, I just added a feature request (TPR#18433) and sent it to our compiler engineers. Hopefully it’s something they can add for you.

  • Mat