intrinsic bitwise function PGI fortran


I’d like to use intrinsic bitwise functions like ieor , etc …
Fortran 2018 functions like POPPAR and POPCNT are supported (according to the manual reference) but still give me :
pgf90 -lcufft -Mcuda -O3 -Dpgi -r8 -Mpreprocess -ta=tesla:cuda10.1 -c cutools.f90
PGF90-F-0000-Internal compiler error. Unsupported IPOPPAR 4 (cutools.f90: 631)
PGF90/x86-64 Linux 19.9-0: compilation aborted

can you help me?


Hi Jordan,

This appears that it may be an issue with the compiler since poppar and popcnt should work in device code.

Is “cutool.f90” small enough that you can post, or strip it down to small reproducer?

If not, I can write a reproducer, but would rather have your version so when I report the error I can make sure I’m reporting the exact issue.


Thank for your reply,

Actually cutool.f90 is a file with a module :

It is something like :

module cutools
! ...


! ....

attributes(global) subroutine cuget_1bdensmat(dmat,CI,indexI,actdim)
implicit none
complex(8) :: dmat(:,:)
complex(8) :: CI(:)
integer    :: indexI(:)
integer  ,value   :: actdim
complex(8) ,shared :: temp(blockDim%x*blockDim%y)
integer  :: i,p,q,j, totslatt,slattoveralp,actP,actQ,inext
 p = blockIdx%x
 q = blockIdx%y
 i = (threadIdx%y -1)*blockDim%x+threadIdx%x ! for the moment max nb of slater = 1024
temp(i) = cmplx(0.d0,0.d0)
temp(i) = cmplx(0.d0,0.d0)
 if (i<= actdim) then
	if (ABS(CI(i))>1.d-8) then
	if (p==q) then
	do while (j <= actdim)
		if (ABS(CI(j))>1.d-8) then
			actP = ibclr(indexI(i), p-1)
			actQ = ibclr(indexI(j), q-1)
			if (actP==actQ .and. (actP/=indexI(i) .or. actQ/=indexI(j))) then
			end if
		end if
		j = j +1
	end do
	end if
	end if
 end if
 !! reduction temp 
 !! dmat(p,q) = temp(1)
end subroutine cuget_1bdensmat

! ....

end module cutools


Thanks Jordan. I’ve filed TPR #27787 and sent it to engineering for further investigation. Unfortunately, it probably wont be fixed anytime soon so you’ll need to look into rewriting the code without POPPAR.


A work-around is to compile with -Mcuda=nonvvm. I am not certain yet why this isn’t working with the nvvm back-end.

This has been fixed to work with nvvm in 20.1