CUDA FORTRAN: function gives different answer if I pass variable instead of number -


i'm trying use ishft() function bitshift 32-bit integers in parallel, using cuda fortran.

the problem different answers ishft(-4,-1) , ishft(var,-1) though var = -4. test code i've written:

module testshift     integer :: test    integer, device :: d_test   contains     attributes(global) subroutine testshft ()      integer :: var     var = -4     d_test = ishft(var,-1)   end subroutine testshft  end module testshift  program foo    use testshift     integer ::   call testshft<<<1,1>>>() ! carry out ishft on gpu   test = d_test            ! copy device result host   = ishft(-4,-1)         ! carry out ishft on cpu   print *, i, test         ! print results end program foo 

i compile , execute:

pgf90 testishft.f90 -mcuda ./a.out     2147483646           -2 

both should 2147483646 if working correctly. right answer if replace var 4.

how fix problem? help

when remove gpu-specific code above program 2147483646 2147483646 g95 compiler, expect. have tried running "scalar" version of program using pgf90 compiler? if scalar version works gpu version not, helps isolate problem. if problem pgf90/cuda specific, perhaps best place ask question

pgi user forum forum index -> programming , compiling http://www.pgroup.com/userforum/viewforum.php?f=4 .


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -