Search code examples
openmphpcopenacc

ERROR while compiling this OpenACC code ? Can anyone figure out?


This is the code .

CALL OMP_SET_NUM_THREADS(2)
!$omp parallel num_threads(acc_get_num_devices(acc_device_nvidia))
!$omp sections
!$omp section
!$acc data copyout(T) copyin(T_o)
call acc_set_device_num(1, acc_device_nvidia )
!$acc kernels
   do j=2,(nj-1)/2
       do i=2,ni-1
           T(i,j)=0.25*(T_o(i+1,j)+T_o(i-1,j)+ T_o(i,j+1)+T_o(i,j-1))  
       enddo
   enddo
!$acc end kernels
!$acc end data
!$omp section
!$acc data copyout(T) copyin(T_o)
call acc_set_device_num(2, acc_device_nvidia )
   do j=((nj-1)/2)+1,nj-1
       do i=2,ni-1
           T(i,j)=0.25*(T_o(i+1,j)+T_o(i-1,j)+ T_o(i,j+1)+T_o(i,j-1))  
       enddo
   enddo
!$acc end data  
!$omp end sections
!$omp end parallel 

And this is the compilation error I'm getting. enter image description here

I'm also attaching the error text below: /home/opt_ohpc_pub/nvhpc-sdk/Linux_x86_64/20.7/compilers/share/llvm/bin/opt: /tmp/nvfortrancom0gYsq9huq.ll:1227:32: error: invalid type for alloca %acc_set_device_num_ = alloca void (...), align 8


Solution

  • It's a compiler code gen error. While I don't see any issue reports with this, you might try using our latest 21.9 release to see if we've fixed it. https://developer.nvidia.com/nvidia-hpc-sdk-downloads

    Also, if you can provide a full reproducing example, I can check. If it still occurs, I can then add an issue report.

    Note that you're setting the device after the start of the data region so it will be creating the data on the wrong device. Also, since you're copying the entire "T" array from both devices, one will clobber the other.