Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue]: Issues with Rocm/flang using 'reduction' with an array #93

Open
Yan-44 opened this issue Jan 8, 2025 · 3 comments
Open

[Issue]: Issues with Rocm/flang using 'reduction' with an array #93

Yan-44 opened this issue Jan 8, 2025 · 3 comments

Comments

@Yan-44
Copy link

Yan-44 commented Jan 8, 2025

Problem Description

Hi,
I am new on Rocm/flang github and I hope this is the correct place to post Rocm/flang issues. The simple code below reproduces issues that I experience with a very large Fortran code that I have developed when attempting to offload it:

  1. Compilation (/opt/rocm-6.1.0/llvm/bin/flang -O2 -fopenmp test31b_reduction.f90 --offload-arch=gfx1030 -o test31b) yields the following error message:

    F90-F-0000-Internal compiler error. gen_sptr(): unexpected storage type 6 (test31b_reduction.f90: 23)

  2. However, multi-threaded compilation (/opt/rocm-6.1.0/llvm/bin/flang -O2 -fopenmp test31b_reduction.f90 -o test31b) and execution work fine:

    toto(1) = 1000., correct answer is: toto(1) = 1000
    tata = 5.000000000000284 , correct answer is: tata = 5.000000000000284

  3. Furthermore, upon commenting any occurrence of 'reduction(max: tata)', compilation (/opt/rocm-6.1.0/llvm/bin/flang -O2 -fopenmp test31b_reduction.f90 --offload-arch=gfx1030 -o test31b) works fine but execution yields the following error:

    0: ALLOCATE: array already allocated
    
  4. Last, as expected, when commenting any occurrence of 'reduction', compilation (/opt/rocm-6.1.0/llvm/bin/flang -O2 -fopenmp test31b_reduction.f90 --offload-arch=gfx1030 -o test31b) works fine but execution yields erroneous results:

    toto(1) = 18., correct answer is: toto(1) = 1000
    tata = 6.3291139240506278E-002 , correct answer is: tata = 5.000000000000284

Could anyone help me fix issue 1?

Thanks for your help.

  Program test31b_reduction
  implicit none

  integer, parameter :: N=1000
  integer :: i
  double precision,dimension(:),allocatable :: toto
  double precision :: tata

  allocate(toto(2))
  toto=0._8
  tata=0._8  

  !$OMP TARGET map(toto,tata)
  !$OMP TEAMS reduction(+: toto) reduction(max: tata)
  !$OMP DISTRIBUTE PARALLEL DO reduction(+: toto) reduction(max: tata)
  do i = 1, N
     toto(1)=toto(1)+1._8
     if (tata<abs(1._8/(128.2_8-real(i,8)))) tata=abs(1._8/(128.2_8-real(i,8)))
  end do
  !$OMP END DISTRIBUTE PARALLEL DO
  !$OMP END TEAMS
  !$OMP END TARGET
  
  print*,'toto(1) = ',toto(1),', correct answer is: toto(1) = ',N
  print*,'tata = ',tata, ', correct answer is: tata = ',abs(1._8/(128.2_8-real(128,8)))
  deallocate(toto)

  end program test31b_reduction

Operating System

Ubuntu 20.04.6 LTS (Focal Fossa)

CPU

Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz

GPU

AMD Radeon PRO W6800 (amdgcn-amd-amdhsa--gfx1030)

ROCm Version

ROCm 6.1.0

ROCm Component

No response

Steps to Reproduce

No response

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

@Yan-44 Yan-44 changed the title [Issue]: Issues with Rocm/flang using 'reduction' [Issue]: Issues with Rocm/flang using 'reduction' with an array Jan 8, 2025
@ronlieb
Copy link
Contributor

ronlieb commented Jan 8, 2025

seems to work with rocm 6.3

@Yan-44
Copy link
Author

Yan-44 commented Jan 9, 2025

Hi,
Thanks, @ronlieb for your answer.
I have checked rocm 6.3 prerequisites and observed that Ubuntu 20.04.6 LTS (Focal Fossa) was not among the supported operational systems. Unfortunately, the decision to upgrade the workstation I am using to (at least) Ubuntu 22.04.5 lies with the computer service of my lab, and for a number of reasons this will take days/weeks.
Hence, I won't be able to confirm rapidly that my code works well with Rocm 6.3. Shall I close the issue or is it OK if it remains open?
Best regards

@ronlieb
Copy link
Contributor

ronlieb commented Jan 9, 2025

your choice, leave it open if you wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants