GCC 10 was released today. Here’s what’s new:
For gfortran, to me most notable update is the support of derived types in
co_broadcast. Of F2018 features, I use collectives the most.
The page also mentions OpenACC 2.6 support for C, C++, and Fortran. I wasn’t aware of OpenACC development in GCC. Has anybody tried it?
Yes, and a 10.1.1 version landed in Fedora 32 some days ago.
I have been interested by OpenACC since GCC6, but never succeeded. I think it’s time to try once again !
I have compiled the following code, inspired by the first example in https://docs.computecanada.ca/wiki/OpenACC_Tutorial_-_Adding_directives
integer :: i, N
real(8), dimension(1:200000000) :: x
real(8), dimension(1:200000000) :: y
real(8) :: a
a = 3.14159265d0
N = 200000000
do i = 1, N
x(i) = 1.0d0
y(i) = 2.0d0
y(:) = a*x(:) + y(:)
!$acc end kernels
end program example_acc
I am using gfortran 9.3.0 under Ubuntu 20.04:
$ gfortran example_acc.f90 && time ./a.out
When trying to compile with
-fopenacc, I had the following error:
lto-wrapper: fatal error: could not find accel/nvptx-none/mkoffload in /usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ (consider using ‘-B’)
/usr/bin/ld : erreur : lto-wrapper failed
collect2: error: ld returned 1 exit status
I have installed the
gcc-offload-nvptx packages: “This package contains libgomp plugin for offloading to NVidia PTX. The plugin needs libcuda.so.1 shared library that has to be installed separately.”
$ gfortran -fopenacc example_acc.f90 && time ./a.out
So, it seems you need a NVidia accelerator, but I have an ATI Radeon on my HP ZBook…
This is the example that I played before (or at least tried) with PGI compiler. I also don’t have an Nvidia card. Maybe I’ll try one day on one of the GPU cloud instances.
Compared to GCC 9, the upcoming GCC 10 release series contains the following OpenACC changes:
- Support for AMD Radeon (GCN) GPUs (Fiji, VEGA)
After installing the Ubuntu package gcc-10-offload-amdgc, I tried:
$ gfortran-10 -fopenacc -foffload=amdgcn-amdhsa="-march=gfx601" example_acc.f90 && time ./a.out
x86_64-linux-gnu-accel-amdgcn-amdhsa-gcc-10: error: unrecognized argument in option ‘-march=gfx601’
x86_64-linux-gnu-accel-amdgcn-amdhsa-gcc-10: note: valid arguments to ‘-march=’ are: fiji gfx900 gfx906; did you mean ‘gfx900’?
Does anyone has that kind of AMD video card (fiji, gfx900 or gfx906) ? Have you succeeded using OpenACC ?