Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
2229 Discussions

OpenMP Target use_device_ptr/use_device_addr with Fortran derived types

caplanr
New Contributor I
206 Views

Hi,

 

I am testing a miniapp that tests multi-gpu Fortran that is used in our production code.

The code is located at:  multigpu-test-code 

The specific version being tested here is:   psi_multigpu_test_code_stdpar_ompdata.f90

 

I am testing on the Stampede3 system at TACC on the MAX 1550 GPU.

 

When I try to compile the code with:

 

mpif90 -f90=ifx -fiopenmp -fopenmp-target-do-concurrent -fopenmp-targets=spir64 -fopenmp-do-concurrent-maptype-modifier=present psi_multigpu_test_code_stdpar_ompdata.f90 -o psi_multigpu_test_code_stdpar_ompdata

 

I get the error:

psi_multigpu_test_code_stdpar_ompdata.f90(669): error #9036: A list item that appears in a use_device_ptr or use_device_addr clause must not be a component of a derived type. [R]
!$omp target data use_device_ptr(v%r,v%t,v%p)
-----------------------------------^

 

Is this error due to the OpenMP Target specification, or is it a temporary limitation of the compiler?   

The code works correctly on NVIDIA GPUs with the nvfortran compiler, implying the latter (although nvfortran is known to support the unsupported sometimes...)

 

In either case, is there a current workaround to allow passing derived type arrays into GPU-aware MPI/library calls?

 

Thanks!

 

 - Ron

 

 

0 Kudos
1 Solution
TobiasK
Moderator
109 Views

@caplanr

The restriction is removed in OpenMP 6.0, for 5.2 you may workaround the restriction with something like this:

 

 

program test_use_device_addr
  implicit none
  type d
     real :: a
  end type d
  type(d) :: a
  real,pointer ::a_ptr
  call assign_ptr(a%a,a_ptr)  
!$omp target data use_device_addr(a_ptr)

!$omp end target data
call wrapper(a%a)
contains
  subroutine wrapper(a)
    real :: a
    !$omp target data use_device_addr(a)                                                                                                                                                     
    !$omp end target data                                                                                                                                                                    
  end subroutine wrapper
  subroutine assign_ptr(source,ptr)
    real,target :: source
    real,pointer :: ptr
    ptr=>source
  end subroutine assign_ptr
end program test_use_device_ptr

View solution in original post

2 Replies
TobiasK
Moderator
110 Views

@caplanr

The restriction is removed in OpenMP 6.0, for 5.2 you may workaround the restriction with something like this:

 

 

program test_use_device_addr
  implicit none
  type d
     real :: a
  end type d
  type(d) :: a
  real,pointer ::a_ptr
  call assign_ptr(a%a,a_ptr)  
!$omp target data use_device_addr(a_ptr)

!$omp end target data
call wrapper(a%a)
contains
  subroutine wrapper(a)
    real :: a
    !$omp target data use_device_addr(a)                                                                                                                                                     
    !$omp end target data                                                                                                                                                                    
  end subroutine wrapper
  subroutine assign_ptr(source,ptr)
    real,target :: source
    real,pointer :: ptr
    ptr=>source
  end subroutine assign_ptr
end program test_use_device_ptr
caplanr
New Contributor I
72 Views

Thanks!

 

Will OpenMP 6.0 (at least this component of it) be implemented in the next version of IFX?

Any ETA on the release?

 

 - Ron

0 Kudos
Reply