|
| View previous topic :: View next topic |
| Author |
Message |
joe.steinberg
Joined: 03 Mar 2010 Posts: 8
|
Posted: Mon Jun 07, 2010 4:25 pm Post subject: Array slices in CUDA Fortran? |
|
|
I have a module-scope device array:
| Code: |
real(real_kind), device, allocatable, dimension(:,:) :: coeffs
|
I have a device subroutine that takes a device array as one of its arguments:
| Code: |
attributes(device) subroutine ConvertToInterpolationCoefficients(length, arr)
integer :: length
real(real_kind), device, dimension(length) :: arr
real(real_kind) :: previous_c
integer :: n
! causal initialization
arr(1) = lambda * InitialCausalCoefficient(length, arr)
previous_c = arr(1)
! causal recursion
do n=2,length
arr(n) = lambda*arr(n) + pole*previous_c
previous_c = arr(n)
enddo
! anticausal initialization
arr(length) = InitialAnticausalCoefficient(length, arr)
previous_c = arr(length)
! anticausal recursion
do n=length-1,1,-1
arr(n) = pole * (previous_c - arr(n))
previous_c = arr(n)
enddo
end subroutine ConvertToInterpolationCoefficients
|
Finally, I have a kernel from which I call the above subroutine. I would like to pass slices of the module-scope array as the 2nd argument as below.
| Code: |
attributes(global) subroutine SamplesToCoefficients2DX(height,width)
integer, value :: height,width
integer :: row
row = (blockidx%x-1) * blockdim%x + threadidx%x
if(row<=height) then
call ConvertToInterpolationCoefficients(width, coeffs(row,1:width))
endif
end subroutine SamplesToCoefficients2DX ! line 152
|
Is this possible? I'm guessing not, since when I do this, I get the following error when I try to compile:
| Code: |
PGF90-F-0000-Internal compiler error. unsupported procedure 370 (../src/cubic_bspline_interp_2D_mod_v2.cuf: 152)
|
For reference, line 152 is marked in the above kernel code with a comment. I am using version 10.5 on 64-bit Ubuntu Linux. Thanks in advance. |
|
| Back to top |
|
 |
TheMatt
Joined: 06 Jul 2009 Posts: 263 Location: Greenbelt, MD
|
Posted: Tue Jun 08, 2010 7:04 am Post subject: |
|
|
I'm not sure Fortran 90 strong typing will allow you do what you are doing. ConvertToInterpolationCoefficients is expecting a 1-D array:
| Code: | | real(real_kind), device, dimension(length) :: arr |
while you are passing a 2-D array:
| Code: | | call ConvertToInterpolationCoefficients(width, coeffs(row,1:width)) |
In memory, that might be equivalent to a 1-D array of length width, but I'm not sure Fortran 90 allows that when passing to subroutines. If a subroutine is expecting a 1-D array, you have to pass it something typed as a 1-D array. (Or do interface blocks and all that so you can pass 1-D and 2-D arrays to a generic procedure call.) |
|
| Back to top |
|
 |
joe.steinberg
Joined: 03 Mar 2010 Posts: 8
|
Posted: Tue Jun 08, 2010 7:24 am Post subject: |
|
|
| Thanks. |
|
| Back to top |
|
 |
TheMatt
Joined: 06 Jul 2009 Posts: 263 Location: Greenbelt, MD
|
Posted: Tue Jun 08, 2010 8:58 am Post subject: |
|
|
| joe.steinberg wrote: | | Thanks. | You're welcome...if it's true. These are just my thoughts; Mat or someone else from PGI might ring in here and speak The Truth.
I've been hit with lots of strong typing errors recently (all my fault...and how), so it was the first thing that ran through my mind. |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4995 Location: The Portland Group Inc.
|
Posted: Tue Jun 08, 2010 10:21 am Post subject: |
|
|
Hi Matt, Joe,
We're most likely trying to convert the 2-D array into a temporary 1-D array when passing to the device routine. I think this should be ok but if not, we should be giving you an error, not an ICE.
Joe, can you please send a reproducing example to PGI Customer Service (trs@pgroup.com)?
Thanks,
Mat |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|