Skip to content

Commit ea0623c

Browse files
committed
guard some do concurrent offloading for nvfortran
1 parent e6779cd commit ea0623c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

.github/workflows/CI-CD.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
include:
3030
- {os: ubuntu-latest, compiler: gfortran }
3131
- {os: ubuntu-latest, compiler: ifx }
32-
- {os: ubuntu-latest, compiler: flang-new}
32+
# - {os: ubuntu-latest, compiler: flang-new} # see: https://github.com/gha3mi/setup-fortran-conda/issues/46
3333
- {os: ubuntu-latest, compiler: nvfortran}
3434
- {os: windows-latest, compiler: gfortran }
3535
- {os: windows-latest, compiler: ifx }

src/forcolormap.f90

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,11 @@ impure subroutine write_ppm_colorbar(self, filename, width, height, encoding)
869869
end if
870870

871871
allocate(rgb_image(pixheight,pixwidth*3))
872-
872+
#if defined(__NVCOMPILER)
873+
do i = 0, pixwidth-1
874+
#else
873875
do concurrent (i = 0:pixwidth-1) local(z, red, green, blue, j)
876+
#endif
874877
z = self%zmin + i / real(pixwidth-1, kind=wp) * (self%zmax - self%zmin)
875878
call self%compute_RGB(z, red, green, blue)
876879
do concurrent (j = 0: pixheight-1)
@@ -923,7 +926,11 @@ impure subroutine write_ppm_colormap_1d(self, filename, zfun, xmin, xmax, width,
923926
end if
924927

925928
allocate(rgb_image(pixheight, pixwidth*3))
929+
#if defined(__NVCOMPILER)
930+
do i = 0, pixwidth-1
931+
#else
926932
do concurrent (i = 0:pixwidth-1) local(t, x, red, green, blue, j)
933+
#endif
927934
t = real(i, wp) / real(max(1, pixwidth-1), wp)
928935
x = xmin + t*(xmax - xmin)
929936
z = zfun(x)
@@ -978,7 +985,12 @@ impure subroutine write_ppm_colormap_2d(self, filename, zfun, xmin, xmax, width,
978985
end if
979986

980987
allocate(rgb_image(pixheight, pixwidth*3))
988+
#if defined(__NVCOMPILER)
989+
do i = 0, pixwidth-1
990+
do j = 0, pixheight-1
991+
#else
981992
do concurrent (j = 0:pixheight-1, i = 0:pixwidth-1) local(ti, tj, x, y, red, green, blue)
993+
#endif
982994
tj = real(j, wp) / real(max(1, pixheight-1), wp)
983995
ti = real(i, wp) / real(max(1, pixwidth-1), wp)
984996
y = xmin(2) + tj*(xmax(2) - xmin(2))
@@ -988,6 +1000,9 @@ impure subroutine write_ppm_colormap_2d(self, filename, zfun, xmin, xmax, width,
9881000
rgb_image(pixheight-j, 3*(i+1)-2) = red
9891001
rgb_image(pixheight-j, 3*(i+1)-1) = green
9901002
rgb_image(pixheight-j, 3*(i+1) ) = blue
1003+
#if defined(__NVCOMPILER)
1004+
end do
1005+
#endif
9911006
end do
9921007

9931008
if (present(encoding)) then
@@ -1010,7 +1025,7 @@ impure subroutine write_ppm_colormap_2d(self, filename, zfun, xmin, xmax, width,
10101025
pure subroutine reverse(self, name)
10111026
class(Colormap), intent(inout) :: self
10121027
character(*), intent(in), optional :: name
1013-
self%map = self%map(size(self%map,1)-1:0:-1, :)
1028+
self%map(0:self%levels-1, :) = self%map(self%levels-1:0:-1, :)
10141029
if (present(name)) then
10151030
self%name = trim(name)
10161031
else

0 commit comments

Comments
 (0)