Quantcast
Channel: Intel® Many Integrated Core Architecture
Viewing all articles
Browse latest Browse all 1347

help with asynchronous calculation

$
0
0

Hello, I would like to run an asynchronous calculation, but am having a hard time understanding with the intel user and reference guide are saying regarding this. I have code that looks like the following.

    signal_value  = 1
    !dir$ offload  target(mic:0) signal(signal_value),&
    !dir$ in(position: alloc_if(.false.),free_if(.false.)),&
    !dir$ inout(ff: alloc_if(.false.), free_if(.false.)),&
    !dir$ nocopy(nlist: alloc_if(.false.) free_if(.false.)),&
    !dir$ nocopy(numneigh: alloc_if(.false.) free_if(.false.)),&
    !dir$ in(q: alloc_if(.false.) free_if(.false.)),&
    !dir$ nocopy(lj1: alloc_if(.false.) free_if(.false.)),&
    !dir$ nocopy(lj2: alloc_if(.false.) free_if(.false.)),&
    !dir$ nocopy(lj3: alloc_if(.false.) free_if(.false.)),&
    !dir$ nocopy(lj4: alloc_if(.false.) free_if(.false.))
    !---asynchronous computation subroutine on MIC
    call lj_cut_coul_dsf_nonewton(step)

    !---asynchronous computation on CPU host (next 4 subroutine calls)
    call bond_harmonic(step)
    call angle_harmonic(step)
    call dihedral_opls(step)
    call improper_harmonic(step)


    !dir$ offload_wait target(mic:0) WAIT (signal_value)

 

Now in this code, lj_cut_dsf_nonewton consists of a block of code inside openmp directives that I would like to run asynchronously on the xeon phi coprocessor. No code in this subroutine is not ran on the xeon phi coprocessor, and all the offload directives for the necessary arrays occurred above in the offload statement.

 !dir$ attributes offload:mic :: lj_cut_coul_dsf_nonewton
  subroutine lj_cut_coul_dsf_nonewton(step)

  !$omp parallel do default(firstprivate),&
  !$omp& shared(position,ff,nlist,numneigh,q,lj1,lj2,lj3,lj4)
       calculate non bonded forces for molecular dynamics on MIC
  !$omp end parallel do

   end subroutine

 

As shown in the comment, I want bond_harmonic, angle_harmonic, dihedral_opls, and improper_harmonic all to be ran on the host CPU asynchronously. However, when I compile the code, I get errors saying that global variables inside bond_harmonic, angle_harmonic, dihedral_opls, and improper_harmonic need to be declared with an offload target attribute.This makes me think that I am not understanding what the code is doing properly. I should not have to declare, and most importantly allocate memory, for these arrays/variables since they are never going to be on the coprocessor, and are supposed to be only being used asynchronously on the CPU. Could someone tell me if my understanding is correct, or where I am going wrong before I go about changing my code?

 


Viewing all articles
Browse latest Browse all 1347

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>