Device intrinsic problem

When I compile the code followed:

module INTRINSICTEST
use cudadevice
real*8,constant :: tab(0:51)
contains
attributes(device) FUNCTION my_fast_scale(a, i)
  real*8  :: my_fast_scale
  real*8  :: a
  integer :: i
  integer :: ihi,ilo
  
  ihi = _double2loint(a)
  ilo = _double2hiint(a)
  
  my_fast_scale = _hiloint2double (ISHFT(i,20)+ihi,ilo) 
  
END FUNCTION

attributes(global) SUBROUTINE test
   print*, my_fast_scale(2.5d0,-1)
end SUBROUTINE

end module

PROGRAM test
use cudafor
USE INTRINSICTEST

call test<<<1,1>>>
  
end PROGRAM

I got these errors:

pgfortran BoysFunction.cuf -lcudadevice -lcudart -lcudafor -Mcuda=cc35,cuda6.5
PGF90-S-0155-Calls from device code to a host function are allowed only in emulation mode - _double2loint (BoysFunction.cuf: 11)
PGF90-S-0155-Calls from device code to a host function are allowed only in emulation mode - _double2hiint (BoysFunction.cuf: 12)
PGF90-S-0155-Calls from device code to a host function are allowed only in emulation mode - _hiloint2double (BoysFunction.cuf: 14)
0 inform, 0 warnings, 3 severes, 0 fatal for my_fast_scale

How can I use the device intrinsic correctly?

Oh, I see what’s going on here. Not all the subroutines listed on Table 12 exist in the cudadevice.mod, and as a result, routines like “__double2hiint” etc. cannot be used in CUDA Fortran. Moreover, Table 12 is only part of libdevice of CUDA. Will PGI solve this problem in the future so that we can use as many CUDA built-in routines as in CUDA C?

Hi qijiin21c,

We most likely can add it at some point. I’ll add an RFE.

I have sent this off to engineering who’s tryig to pull together a short-term work around by having you add an interface to the CUDA versions. Though they ran into a couple of issues. I’ll update this post when I know more.

  • Mat

Hi Mat,
Thanks for your reply. Hope this problem will be solved soon.