compiling error

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

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:

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

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:

% 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

Hi Mat,

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

The first error I got was

$ 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:

$ 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!

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

Works!
Thanks a lot

TPR 19510 - Scalar value for “source” in allocate stmnt gives ICE string_expr_length: operator not concatenation

We have corrected this in the current 14.1 release.

thanks,
dave