serial construct in openacc, Fortran

OpenACC and CUDA Fortran
mkcolg
Posts: 8382
Joined: Jun 30 2004

Re: serial construct in openacc, Fortran

Post by mkcolg » Mon Mar 23, 2020 9:54 am

Most likely, you're just missing an "update" directive someplace.

afiguer
Posts: 10
Joined: Mar 23 2020

Re: serial construct in openacc, Fortran

Post by afiguer » Mon Mar 23, 2020 10:02 am

Is there any way to see what the device is doing inside a sequential loop? For example write the results in each iteration?

mkcolg
Posts: 8382
Joined: Jun 30 2004

Re: serial construct in openacc, Fortran

Post by mkcolg » Mon Mar 23, 2020 10:08 am

Yes, unfortmatted printing (print *) is allowed in device compute regions. It's buffered from the device which can intermix results when run in parallel, but should be in order from a serial region.

afiguer
Posts: 10
Joined: Mar 23 2020

Re: serial construct in openacc, Fortran

Post by afiguer » Mon Mar 23, 2020 1:24 pm

I use a print statement in two different position with respect to the inner loop and a stop clause to see whats is happening with the first point only.

Code: Select all

       do 1400 ippne=nppn0,nppn1
c
c     -----points
c
       ipoin=bppni(1,ippne)
       jpoin=bppni(2,ippne)
       print *,'before',ipoin,jpoin,ippne,unkno(1,ipoin),
     &           unkno(1,jpoin),nppn0,nppn1
c
c     -----variables 1-nunkp
c
c$acc  loop seq
       do 1410 iva=1,nunkp
       unkno(iva,ipoin)=unkno(iva,jpoin)+bppnr(iva,ippne)
 1410 continue
       print * ,'after',ipoin,jpoin,ippne,unkno(1,ipoin),
     &           unkno(1,jpoin)
       stop
c
c     ----end of loop over the receiving points
c     
 1400 continue
The values that I get are the following,

Code: Select all

        
before       6053         8803        13006    100.3518075025082      100.3517910648528                1      13005
after        6053         8803        13006    100.3517910648528      100.3517910648528       
The problem here is that despite the loop is from nppn0(1) to nppn1(13005), the first value of ippne is 13006.
Any guess about why is this happening?

mkcolg
Posts: 8382
Joined: Jun 30 2004

Re: serial construct in openacc, Fortran

Post by mkcolg » Tue Mar 24, 2020 7:07 am

Any guess about why is this happening?
Best guess is that it's a compiler issue, but I can't really tell without a reproducing example.

How is ippne declared? Does this happen the first time through the loop or the second?

Post Reply