Research Article

Performance of a Code Migration for the Simulation of Supersonic Ejector Flow to SMP, MIC, and GPU Using OpenMP, OpenMP+LEO, and OpenACC Directives

Listing 9

Code fragments corresponding to Figure 7(b); first all the variables are transferred to the MIC.
! dir$offload_transfer target(mic:0)
in(U1,U2,U3,U4: alloc_if(.true.)
free_if(.false.))
!dir$offload_transfer target(mic:0)
in(U1_,U2_,U3_,U4_: alloc_if(.true.)
free_if(.false.))
!dir$offload_transfer target(mic:0)
in(F1,F2,F3,F4: alloc_if(.true.)
free_if(.false.))
DO WHILE  (.TRUE.)
!dir$ offload target(mic:0)
nocopy(DF1Dx,DF2Dx,DF3Dx,DF4Dx) &
& nocopy(F1,F2,F3,F4,U1,U2,U3,U4,
G1,G2,G3,G4) &
&  nocopy(a_x,b_x,K_x,deltae) &
& in(k,Timetotal) out(k_shared) &
& out(Timetotal_shared,etot) &
& out(ro,u,v,P,T,M,ET)
!$OMP PARALLEL DEFAULT(NONE) &
!$OMP & SHARED(DF1Dx,DF2Dx,DF3Dx,DF4Dx) &
!$OMP & SHARED(F1,F2,F3,F4,
U1,U2,U3,U4,G1,G2,G3,G4) &
!$OMP &  SHARED(a_x,b_x,K_x,deltae) &
DO WHILE (K <= nk)
!$OMP DO COLLAPSE(2)
DO j=2,(nj-1)
  DO i=2,(ni-1)
  END DO
END DO
!$OMP END PARALLEL
PRINT *,EXITING THE MIC TO WRITE DATA;
IF (k_shared >=nk) exit;
k = k_shared+1;
TimeTotal = TimeTotal_shared;
END DO;