1

I have the following serial part of a FORTRAN code which should be executed sequentially.

c$acc  serial 
       nppn1=0
c
       do 1200 ippas=1,50
c
       nppn0=nppn1+1
       nppn1=lppas(ippas)
c
c     -----did we complete the passes ?
c
       if(nppn1.eq.0)                                          goto 1201
c
c     -----do we have any ?
c
       if(nppn0.gt.nppn1)                                      goto 1199
c
c     -----loop over the receiving points
c
c$acc  loop seq 
       do 1400 ippne=nppn0,nppn1
c
c     -----points
c
       ipoin=bppni(1,ippne)
       jpoin=bppni(2,ippne)
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
c
c     ----end of loop over the receiving points
c     
 1400 continue

c
c
c     ----end of loop over the passes
c     
 1199 continue
 1200 continue
 1201 continue
c$acc  end serial

The results obtained using the PGI compiler with the OpenACC directives deactivated look like,

            ipoin        jpoin         unkno(iva,ipoin)   unkno(iva,jpoin)
before loop 160215       160165       100.3518075025082   100.3517910648527      
 after loop 160215       160165       100.3517910648527   100.3517910648527        
before loop 160165       157415       100.3517910648527   100.3517910648527         
 after loop 160165       157415       100.3517910648527   100.3517910648527         

which is the expected behavior. However, when OpenAcc directives are activated the values are not updated.

             ipoin     jpoin    unkno(iva,ipoin)           unkno(iva,jpoin)
before loop  160215    160165   100.3518075025082         100.3517910648527     
after  loop  160215    160165   100.3518075025082         100.3517910648527   

When compiling, the PGI compiler says the following:

   2552, Accelerator serial kernel generated
         Generating Tesla code
       2556, !$acc do seq
       2588, !$acc do seq
       2603, !$acc do seq
   2552, Generating implicit copyin(bppnr(:nunkp,:),bppni(:2,:),lppas(:))
         Generating implicit copy(unkno(:nunkp,:))

So, I don't know what is happening here and how I can solve this issue. Any ideas?

Alejandro
  • 11
  • 2
  • 1
    Welcome, please take the [tour]. The code is horribly messy with all those gotos. It would make a very good sense to refactor it (with good unit tests) befor attempting any OpenACC with that. It likely that a full compilable [mcve] will be necessary. – Vladimir F Героям слава Mar 23 '20 at 08:19
  • If you can provide a reproducing example, that would be helpful since there's not enough information to determine the issue. The compiler feedback messages all look fine, though if you have a higher level data region, one possible cause is that you aren't copying back the results. – Mat Colgrove Mar 23 '20 at 15:50

0 Answers0