|
| View previous topic :: View next topic |
| Author |
Message |
jmckennon
Joined: 24 Aug 2010 Posts: 34
|
Posted: Tue Sep 07, 2010 7:27 am Post subject: Weird Error? |
|
|
Hi,
I'm working on a CUDAFORTRAN project and am trying to get my kernel routine to run. I'm very new at this so I'm not sure if I did everything right. My main routine compiles all the way until I call the device kernel. When it hits that, I get an error
PGF90-S-0446 rank mismatch
error for each and every argument of the device kernel. Why is this? The relevant code is below (or what I'm assuming to be relevant for this).
| Code: |
I tried googling the error but nothing comes up. Hope someone can help.
allocate(val1(size(val1)))
allocate(val2(size(val2)))
allocate(numXn(size(numXn)))
allocate(gmelft(size(gmelft)))
allocate(gmergt(size(gmergt)))
allocate(plft(size(plft)))
allocate(prght(size(prght)))
allocate(clft(size(clft)))
allocate(crght(size(crght)))
allocate(ulft(size(ulft)))
allocate(urght(size(urght)))
allocate(vlft(size(vlft)))
allocate(vrght(size(vrght)))
allocate(utlft(size(utlft)))
allocate(utrght(size(utrght)))
allocate(uttlft(size(uttlft)))
allocate(uttrgt(size(uttrgt)))
allocate(xnlft(size(xnlft)))
allocate(xnrght(size(xnrght)))
allocate(smallp(size(smallp)))
allocate(smallu(size(smallu)))
allocate(smlrho(size(smlrho)))
allocate(nriem(size(nriem)))
allocate(gmclft(size(gmclft)))
allocate(gmcrgt(size(gmcrgt)))
allocate(pstor(size(pstor)))
allocate(riemanTol(size(riemanTol)))
allocate(gameDev(numCells))
allocate(ugrdlDev(numCells))
dimBlock=dim3(16,16,1)
dimGrid= dim3(numIntCells5/16,numIntCells5/16,1)
call rieman_kernel<<<dimGrid,dimBlock>>>(val1,val2,numXn,gmelft,gmergt,plft,prght,clft,crght,ulft,urght,vlft,vrght,utlft,utrght,uttlft,uttrgt,xnlft,xnrght,smallp,smallu,smlrho,nriem,gmclft,gmcrgt,pstor,riemanTol,gameDev,ugrdlDev)
end subroutine rieman
|
[/code] |
|
| Back to top |
|
 |
brentl
Joined: 20 Jul 2004 Posts: 107
|
Posted: Tue Sep 07, 2010 2:05 pm Post subject: |
|
|
Two things: 1) I'd probably need to see how you declared the arrays in the rieman_kernel global subroutine. Or how you declared them in the interface block if you are using interface blocks. All interfaces between the host and the device routines must be explicit.
2) I think using the size of the array as the argument to allocate the array is an error. If it is unallocated, it has no size. These are okay:
allocate(gameDev(numCells))
but this I think is not going to work:
allocate(pstor(size(pstor))) |
|
| Back to top |
|
 |
jmckennon
Joined: 24 Aug 2010 Posts: 34
|
Posted: Thu Sep 09, 2010 6:50 am Post subject: |
|
|
thanks for the reply!
below is my relevant code
| Code: |
module rieman_calc
use cudafor
contains
subroutine rieman (numIntCells, numCells, &
rhoav, uav, utav, uttav, pav, &
urell, ugrdl, game, gameav, xnav, x)
use Hydro_data, ONLY: hy_numXn, &
hy_gmelft, hy_gmergt, &
hy_plft, hy_prght, &
hy_clft, hy_crght, &
hy_ulft, hy_urght, &
hy_vlft, hy_vrght, &
hy_utlft, hy_utrght, &
hy_uttlft, hy_uttrgt, & hy_uttlft, hy_uttrgt, &
hy_xnlft, hy_xnrght, &
hy_smallp, hy_smallu, &
hy_smlrho, hy_nriem, &
hy_gmclft, hy_gmcrgt,hy_pstor, &
hy_riemanTol
use Driver_interface, ONLY : Driver_abortFlash
implicit none
!! Arguments ----------------------------------
integer, intent (IN) :: numIntCells,numCells
real, intent(IN), DIMENSION(numCells) :: x
real, intent(IN), DIMENSION(numCells) :: ugrdl, game
real, intent(OUT), DIMENSION(numCells) :: uav, rhoav, utav, uttav, pav, &
urell, gameav
real, intent(OUT), DIMENSION(numCells,hy_numXn) :: xnav
real, device, allocatable, DIMENSION(:) :: val1
real, device, allocatable, DIMENSION(:):: val2
real, device, allocatable, DIMENSION(:):: ugrdlDev
real, device, allocatable, DIMENSION(:)::gameDev
real, device, allocatable, DIMENSION(:):: numXn
real, device, allocatable, DIMENSION(:):: gmelft
real, device, allocatable, DIMENSION(:):: gmergt
real, device, allocatable, DIMENSION(:):: plft
real, device, allocatable, DIMENSION(:):: prght
real, device, allocatable, DIMENSION(:):: clft
real, device, allocatable, DIMENSION(:)::crght
real, device, allocatable, DIMENSION(:):: ulft
real, device, allocatable, DIMENSION(:):: vlft
real,device, allocatable, DIMENSION(:):: vrght
real, device, allocatable, DIMENSION(:):: utlft
real, device, allocatable, DIMENSION(:):: utrght
real, device, allocatable, DIMENSION(:):: uttlft
real, device, allocatable, DIMENSION(:):: uttrgt
real, device, allocatable, DIMENSION(:):: xnlft
real, device, allocatable, DIMENSION(:):: xnrght
real, device, allocatable, DIMENSION(:):: smallp
real, device, allocatable, DIMENSION(:):: smallu
real, device, allocatable, DIMENSION(:):: smlrho
real, device, allocatable, DIMENSION(:):: nriem
real, device, allocatable, DIMENSION(:):: gmclft
real, device, allocatable, DIMENSION(:):: gmcrgt
real, device, allocatable, DIMENSION(:):: pstor
real, device, allocatable, DIMENSION(:):: riemanTol
real, device, allocatable, DIMENSION(:):: urght
type(dim3)::dimGrid,dimBlock
real, DIMENSION(numCells) :: pstar1, pstar2, gmstrl, gmstrr, &
& wlft1, wrght1, gmin, gmax, &
& gamfac, aux
real, DIMENSION(numCells) :: scrch1, scrch2, scrch3, scrch4
real :: ge, gc, ustrl1, ustrr1, ustrl2, ustrr2, &
& delu1, delu2, pres_err
integer :: i, j, k, n, numIntCells5, ierr
character(len=1), save :: dirs(3) = (/ 'x', 'y', 'z' /)
real, parameter :: small_dp = 1.e2 * epsilon(1.e0)
numIntCells5 = numIntCells + 5
val1=numCells
val2=numIntCells5
numXn=hy_numXn
gmelft=hy_gmelft
gmergt=hy_gmergt
plft=hy_plft
prght=hy_prght
clft=hy_clft
crght=hy_crght
ulft=hy_ulft
urght=hy_urght
vlft=hy_vlft
vrght=hy_vrght
utlft=hy_utlft
utrght=hy_utrght
uttlft=hy_uttlft
uttrgt=hy_uttrgt
xnlft=hy_xnlft
xnrght=hy_xnrght
smallp=hy_smallp
smallu=hy_smallu
smlrho=hy_smlrho
nriem=hy_nriem
gmclft=hy_gmclft
gmcrgt=hy_gmcrgt
pstor=hy_pstor
riemanTol=hy_riemanTol
gameDev=game
ugrdlDev=ugrdl
|
and then the previous allocate statements I posted. I'm not sure what the dimensions are of the hydro variables, I'm looking in to that at the moment. Do you see why I would be getting a rank mismatch error when I call the device kernel
| Code: |
dimBlock=dim3(16,16,1)
dimGrid= dim3(numIntCells5/16,numIntCells5/16,1)
call rieman_kernel<<<dimGrid,dimBlock>>>(val1,val2,numXn,gmelft,gmergt,plft,prght,clft,crght,ulft,urght,vlft,vrght,utlft,utrght,uttlft,uttrgt,xnlft,xnrght,smallp,smallu,smlrho,nriem,gmclft,gmcrgt,pstor,riemanTol,gameDev,ugrdlDev)
|
I really appreciate the help, I've been stuck on this for awhile now. |
|
| Back to top |
|
 |
jmckennon
Joined: 24 Aug 2010 Posts: 34
|
Posted: Thu Sep 09, 2010 2:12 pm Post subject: |
|
|
I tried making code simpler, so that I can get an easy piece to work and then go from there but I am having no luck.
I only want to get it to work with what's here then go from there.
The entire code now says (the majority of the lines are just declaration statements that I intend to use later if I ever get this to work).
| Code: |
module riemanCalc
use cudafor
contains
subroutine rieman (numIntCells, numCells, &
rhoav, uav, utav, uttav, pav, &
urell, ugrdl, game, gameav, xnav, x)
use Hydro_data, ONLY: hy_numXn, &
hy_gmelft, hy_gmergt, &
hy_plft, hy_prght, &
hy_clft, hy_crght, &
hy_ulft, hy_urght, &
hy_vlft, hy_vrght, &
hy_utlft, hy_utrght, &
hy_uttlft, hy_uttrgt, &
hy_xnlft, hy_xnrght, &
hy_smallp, hy_smallu, &
hy_smlrho, hy_nriem, &
hy_gmclft, hy_gmcrgt,hy_pstor, &
hy_riemanTol
use Driver_interface, ONLY : Driver_abortFlash
implicit none
!! Arguments ----------------------------------
integer, intent (IN) :: numIntCells,numCells
real, intent(IN), DIMENSION(numCells) :: x
real, intent(IN), DIMENSION(numCells) :: ugrdl, game
real, intent(OUT), DIMENSION(numCells) :: uav, rhoav, utav, uttav, pav, &
urell, gameav
real, intent(OUT), DIMENSION(numCells,hy_numXn) :: xnav
integer :: A,i, j, k, n, numIntCells5, ierr
character(len=1), save :: dirs(3) = (/ 'x', 'y', 'z' /)
real, parameter :: small_dp = 1.e2 * epsilon(1.e0)
real, device, allocatable, DIMENSION(:) :: val1
real, device, allocatable, DIMENSION(:):: val2
real, device, allocatable, DIMENSION(:):: ugrdlDev
real, device, allocatable, DIMENSION(:)::gameDev
real, device, allocatable, DIMENSION(:):: numXn
real, device, allocatable, DIMENSION(:):: gmelft
real, device, allocatable, DIMENSION(:):: gmergt
real, device, allocatable, DIMENSION(:):: plft
real, device, allocatable, DIMENSION(:):: prght
real, device, allocatable, DIMENSION(:):: clft
real, device, allocatable, DIMENSION(:)::crght
real, device, allocatable, DIMENSION(:):: ulft
real, device, allocatable, DIMENSION(:):: vlft
real, device, allocatable, DIMENSION(:):: vrght
real, device, allocatable, DIMENSION(:):: utlft
real, device, allocatable, DIMENSION(:):: utrght
real, device, allocatable, DIMENSION(:):: uttlft
real, device, allocatable, DIMENSION(:):: uttrgt
real, device, allocatable, DIMENSION(:):: xnlft
real, device, allocatable, DIMENSION(:):: xnrght
real, device, allocatable, DIMENSION(:):: smallp
real, device, allocatable, DIMENSION(:):: smallu
real, device, allocatable, DIMENSION(:):: smlrho
real, device, allocatable, DIMENSION(:):: nriem
real, device, allocatable, DIMENSION(:):: gmclft
real, device, allocatable, DIMENSION(:):: gmcrgt
real, device, allocatable, DIMENSION(:):: pstor
real, device, allocatable, DIMENSION(:):: riemanTol
type(dim3)::dimGrid,dimBlock
numIntCells5 = numIntCells + 5
allocate(prght(numIntCells))
prght=hy_prght(1:numIntCells)
dimGrid=dim3(numIntCells/16,numIntCells/16,1)
dimBlock=dim3(16,16,1)
call rieman_kernel<<<dimGrid,dimBlock>>>(prght)
return
end subroutine rieman
attributes (global) subroutine rieman_kernel(prght)
return
end subroutine rieman_kernel
end module riemanCalc
|
And even with just this, I still get that *insert expletive* rank mismatch error. hy_prght is a one dimensional array, and yet no matter what I do I get
PGF90-S-0446-Argument number 1 to rieman_kernel: rank mismatch (rieman.cuf: 193)
I simply cannot figure this out... |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 5001 Location: The Portland Group Inc.
|
Posted: Thu Sep 09, 2010 2:45 pm Post subject: |
|
|
Hi jmckennon,
I think you just missing the declaration of "prght" in your "rieman_kernel" kernel. Otherwise "prght" is implicitly declared as a real giving the rank mismatch.
| Code: |
attributes (global) subroutine rieman_kernel(prght)
real, DIMENSION(:) :: prght ! Add the declaration of prght
return
end subroutine rieman_kernel
end module riemanCalc
|
Hope this helps,
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
|