PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

Stream Management

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
thomi



Joined: 10 Apr 2010
Posts: 5

PostPosted: Fri Sep 24, 2010 9:45 am    Post subject: Stream Management Reply with quote

I am trying to use concurrent streams but I am having problems with it. Maybe someone has already tried to use streams and can give me a piece of code so I can see how it works. First of all I start with:

istat = cudaStreamCreate(1)

this should create a new stream, but still the compiler states:'Argument number 1 to cudastreamcreate does not match INTENT (OUT)'. Am I already missing something? Am I correct that I then have to create for each stream a data copy? eg.

istat = cudaMemcpyAsync(adev,a,100,0)
istat = cudaMemcpyAsync(adev,a,100,1)

Thanks, thomi
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6691
Location: The Portland Group Inc.

PostPosted: Fri Sep 24, 2010 4:40 pm    Post subject: Reply with quote

Hi thomi,

The function cudaStreamCreate expects an integer variable as it's argument. The function will then assign it a stream id.

Code:
% cat teststream.cuf

program teststream
   use cudafor

   integer :: strm1, istat, N
   real, dimension(:),pinned,allocatable :: A
   real, dimension(:),allocatable, device :: Adev
   N=100
   allocate(A(N),Adev(N))
   A=1.1
   istat = cudaStreamCreate(strm1)
   print *, strm1
   istat = cudaMemcpyAsync(Adev,A,N,cudaMemcpyHostToDevice,strm1)

end program teststream
% pgf90 teststream.cuf -V10.9 ; a.out
            1


Note that the host array must be and allocatable and located in pinned memory.

Hope this helps,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group