PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

compiling error
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
ignacio82



Joined: 25 Jul 2013
Posts: 6

PostPosted: Thu Aug 08, 2013 8:00 am    Post subject: compiling error Reply with quote

When I try to compile my program using PGI I get these errors

Code:

PGF90-S-0000-Internal compiler error. string_expr_length: operator not concatenation       4 (mpi_params.f90: 28)
PGF90-S-0155-ALLOCATE object must have same rank as SOURCE= expression recvcounts (mpi_params.f90: 28)
  0 inform,   0 warnings,   2 severes, 0 fatal for init_mpi_params
make: *** [mpi_params.o] Error 2


This is the module generating the error:

Code:

module mpi_params
   USE MPI
   implicit none
   integer                              :: ierr, numprocs, proc_num, &
                                           points_per_proc, istart, iend
   integer, allocatable, dimension(:)   :: displs, recvcounts
   doubleprecision, allocatable, dimension(:)   :: proc_contrib
contains
subroutine init_mpi_params(nn)
integer, intent(in)                     :: nn
integer                                 :: i
! Determine how many points to handle with each proc
 if ( mod(nn,numprocs)==0 ) then
    points_per_proc = nn/numprocs
 else
    points_per_proc = (nn-mod(nn,numprocs))/numprocs
    if (numprocs-1 == proc_num ) points_per_proc = nn - points_per_proc*(numprocs-1)
 end if
! Determine start and end index for this proc's points
istart = proc_num * points_per_proc + 1
if (numprocs-1 == proc_num ) istart = proc_num*(nn-mod(nn,numprocs))/numprocs +1
iend = istart + points_per_proc - 1
if (numprocs-1 == proc_num ) iend = nn
ALLOCATE(proc_contrib(points_per_proc))
!print *, 'about to allocate displs'
allocate(displs(numprocs),source=(/(i*(nn-mod(nn,numprocs))/numprocs,i=0,numprocs-1)/))
!print *, 'about to allocate recvcounts'
allocate(recvcounts(numprocs),source=(nn-mod(nn,numprocs))/numprocs)
recvcounts(numprocs)=nn - points_per_proc*(numprocs-1)
if (numprocs-1 == proc_num ) recvcounts(numprocs) = iend-istart+1
end subroutine init_mpi_params

end module mpi_params


How can I fix my problem?

Thanks!


PS: I can compile and run the program if I use the intel compiler.
PS2: The complete example program is in https://bitbucket.org/ignacio82/bhhh branch ignacio82/MPI
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6120
Location: The Portland Group Inc.

PostPosted: Thu Aug 08, 2013 4:30 pm    Post subject: Reply with quote

Hi ignacio82,

This looks like a compiler error. It seems to be having issues with using a scalar value for the allocatable source. I've created a problem report (TPR#19510) and sent it on to engineering.

I was able to create the following work around:
Code:
% cat  mpi_params.f90
module mpi_params
   USE MPI
   implicit none
   integer                              :: ierr, numprocs, proc_num, &
                                           points_per_proc, istart, iend
   integer, allocatable, dimension(:)   :: displs, recvcounts
   double precision, allocatable, dimension(:)   :: proc_contrib
contains
subroutine init_mpi_params(nn)
integer, intent(in)                     :: nn
integer                                 :: i, slen
! Determine how many points to handle with each proc
 if ( mod(nn,numprocs)==0 ) then
    points_per_proc = nn/numprocs
 else
    points_per_proc = (nn-mod(nn,numprocs))/numprocs
    if (numprocs-1 == proc_num ) points_per_proc = nn - &
points_per_proc*(numprocs-1)
 end if
! Determine start and end index for this proc's points
istart = proc_num * points_per_proc + 1
if (numprocs-1 == proc_num ) istart = &
proc_num*(nn-mod(nn,numprocs))/numprocs +1
iend = istart + points_per_proc - 1
if (numprocs-1 == proc_num ) iend = nn
ALLOCATE(proc_contrib(points_per_proc))
!print *, 'about to allocate displs'
allocate(displs(numprocs),source=(/(i*(nn-mod(nn,numprocs))/numprocs,i=0,numprocs-1)/))
!print *, 'about to allocate recvcounts' a
#ifdef WORKS
allocate(recvcounts(numprocs),source=(/((nn-mod(nn,numprocs))/numprocs,i=1,numprocs)/))
#else
allocate(recvcounts(numprocs),source=((nn-mod(nn,numprocs))/numprocs))
#endif
recvcounts(numprocs)=nn - points_per_proc*(numprocs-1)
if (numprocs-1 == proc_num ) recvcounts(numprocs) = iend-istart+1
end subroutine init_mpi_params

end module mpi_params


Thanks!
Mat
Back to top
View user's profile
ignacio82



Joined: 25 Jul 2013
Posts: 6

PostPosted: Fri Aug 09, 2013 5:24 am    Post subject: Reply with quote

Hi Mat,

Thanks for your help. I cannot get your work around to work.

The first error I got was

Code:

$ make
mpif90 -g  -c mpi_params.f90
PGF90-S-0021-Label field of continuation line is not blank (mpi_params.f90: 30)
PGF90-S-0021-Label field of continuation line is not blank (mpi_params.f90: 32)
PGF90-S-0021-Label field of continuation line is not blank (mpi_params.f90: 34)
  0 inform,   0 warnings,   3 severes, 0 fatal for init_mpi_params


I think you are using # to comment out a line instead of !. I changed those # for !

After doing that and trying to compile, I get these errors:

Code:

$ make
mpif90 -g  -c mpi_params.f90
PGF90-S-0000-Internal compiler error. string_expr_length: operator not concatenation       4 (mpi_params.f90: 33)
PGF90-S-0155-ALLOCATE object must have same rank as SOURCE= expression recvcounts (mpi_params.f90: 33)
  0 inform,   0 warnings,   2 severes, 0 fatal for init_mpi_params
make: *** [mpi_params.o] Error 2


Thanks again!
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6120
Location: The Portland Group Inc.

PostPosted: Fri Aug 09, 2013 7:20 am    Post subject: Reply with quote

Hi ignacio82,

Sorry, I should have showed the compile line. You need to add "-Mpreprocess -DWORKS" to get the work around. Or you can also comment out the preprocessor directives but you also need to comment out the failing case.

- Mat
Back to top
View user's profile
ignacio82



Joined: 25 Jul 2013
Posts: 6

PostPosted: Fri Aug 09, 2013 9:20 am    Post subject: Reply with quote

Works!
Thanks a lot
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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 © phpBB Group