Skip to content

Commit

Permalink
Fixing PIO Source line too long issue
Browse files Browse the repository at this point in the history
PIO build fails with the pgi compiler on blues during the nightly
builds with a "Source line too long" error message. This is
because of the expansion of the "__FILE__" macro to a long fully
qualified file name. This issue occurs on nightly builds even
with the "-Mextend" flag (allow source upto 132 columns).

Also note that the build will not fail (with pgi on blues) if
it is from a directory with a "not-too-long" fully qualified name.

Fixing this issue by using the custom "__PIO_FILE__" macro within
PIO that expands to only the current filename.
  • Loading branch information
jayeshkrishna committed Jan 20, 2016
1 parent 1aafa5c commit c39db3e
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 33 deletions.
4 changes: 2 additions & 2 deletions pio/box_rearrange.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -786,11 +786,11 @@ end subroutine box_rearrange_io2comp_{TYPE}
do j=1,ndim
if ( gcoord(j) < lb(j,i) ) then
i = max(1,i-decompstep(j))
if(k>5000) print *,__FILE__,__LINE__,i,gcoord(:),lb(:,i),ub(:,i)
if(k>5000) print *,__PIO_FILE__,__LINE__,i,gcoord(:),lb(:,i),ub(:,i)
cycle loop_ioproc
else if(gcoord(j) >= ub(j,i) ) then
i = min(nioproc,i+decompstep(j))
if(k>5000) print *,__FILE__,__LINE__,i,gcoord(:),lb(:,i),ub(:,i)
if(k>5000) print *,__PIO_FILE__,__LINE__,i,gcoord(:),lb(:,i),ub(:,i)
cycle loop_ioproc
endif
end do
Expand Down
2 changes: 1 addition & 1 deletion pio/calcdecomp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ subroutine CalcStartandCount(basetype, ndims, gdims, num_io_procs,myiorank,start
kount=mykount

! if(myiorank>=0 .and. myiorank<use_io_procs) then
! print *,__FILE__,__LINE__,use_io_procs,gdims,start,kount
! print *,__PIO_FILE__,__LINE__,use_io_procs,gdims,start,kount
! endif


Expand Down
4 changes: 2 additions & 2 deletions pio/ionf_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ integer function close_nf(File) result(ierr)
case(PIO_iotype_netcdf, pio_iotype_netcdf4c, pio_iotype_netcdf4p)
if (File%fh>0) then
ierr = nf90_sync(File%fh)
if(Debug) print *,__FILE__,__LINE__,ierr
if(Debug) print *,__PIO_FILE__,__LINE__,ierr
ierr= nf90_close(File%fh)
if(Debug) print *,__FILE__,__LINE__,ierr
if(Debug) print *,__PIO_FILE__,__LINE__,ierr
endif
#endif
case default
Expand Down
6 changes: 3 additions & 3 deletions pio/pio_msg_callbacks.F90
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ subroutine writedarray_handler(iosystem)
call mpi_bcast(fillv, 1, mpi_integer , iosystem%compmaster, iosystem%intercomm, ierr)

file=> lookupfile(fh)
if(debugasync) print *,__FILE__,__LINE__,v%varid,iod_id
if(debugasync) print *,__PIO_FILE__,__LINE__,v%varid,iod_id
iodesc => lookupiodesc(iod_id)
#ifndef _MPISERIAL
select case(type)
Expand Down Expand Up @@ -296,7 +296,7 @@ subroutine readdarray_handler(iosystem)
real(r4) :: areal(1)
real(r8) :: adouble(1)

if(debugasync) print *,__FILE__,__LINE__
if(debugasync) print *,__PIO_FILE__,__LINE__

call mpi_bcast(fh, 1, mpi_integer, iosystem%compmaster, iosystem%intercomm, ierr)
call mpi_bcast(v%varid, 1, mpi_integer, iosystem%compmaster, iosystem%intercomm, ierr)
Expand All @@ -306,7 +306,7 @@ subroutine readdarray_handler(iosystem)

file=> lookupfile(fh)

if(debugasync) print *,__FILE__,__LINE__,iod_id, type
if(debugasync) print *,__PIO_FILE__,__LINE__,iod_id, type

iodesc => lookupiodesc(iod_id)
#ifndef _MPISERIAL
Expand Down
10 changes: 5 additions & 5 deletions pio/pio_msg_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,14 @@ subroutine add_to_iodesc_list(iodesc)



if(debugasync) print *,__FILE__,__LINE__,index
if(debugasync) print *,__PIO_FILE__,__LINE__,index
end if
iodesc%async_id=index
list_item%index=index
list_item%iodesc => iodesc


if(debugasync) print *,__FILE__,__LINE__,index,list_item%iodesc%async_id
if(debugasync) print *,__PIO_FILE__,__LINE__,index,list_item%iodesc%async_id

end subroutine add_to_iodesc_list

Expand Down Expand Up @@ -353,7 +353,7 @@ function delete_from_iodesc_list(id) result(iodesc)
if(debugasync) then
list_item=> top_iodesc
do while(associated(list_item))
print *,__FILE__,__LINE__,id,list_item%index,list_item%iodesc%async_id
print *,__PIO_FILE__,__LINE__,id,list_item%index,list_item%iodesc%async_id
list_item=>list_item%next
enddo
endif
Expand Down Expand Up @@ -430,10 +430,10 @@ function lookupiodesc(async_id) result(iodesc)
nullify(iodesc)
do while(associated(list_item%iodesc) )

if(debugasync) print *,__FILE__,__LINE__,list_item%index,async_id,list_item%iodesc%async_id
if(debugasync) print *,__PIO_FILE__,__LINE__,list_item%index,async_id,list_item%iodesc%async_id
if(abs(list_item%iodesc%async_id) == async_id) then
iodesc => list_item%iodesc
if(debugasync) print *,__FILE__,__LINE__,async_id,list_item%index,iodesc%write%n_elemtype
if(debugasync) print *,__PIO_FILE__,__LINE__,async_id,list_item%index,iodesc%write%n_elemtype
exit
end if
list_item=>list_item%next
Expand Down
6 changes: 3 additions & 3 deletions pio/piodarray.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ contains
if(debugasync) print *,__PIO_FILE__,__LINE__
endif

if(debugasync .and. ios%ioproc) print *,__FILE__,__LINE__,iodesc%async_id
if(debugasync .and. ios%ioproc) print *,__PIO_FILE__,__LINE__,iodesc%async_id

select case(File%iotype)
case(pio_iotype_pbinary, pio_iotype_direct_pbinary)
Expand Down Expand Up @@ -996,7 +996,7 @@ contains
call alloc_check(IOBUF,0,'IOBUF')
end if
endif
! print *,__FILE__,__LINE__,ndims, fndims, start(1:fndims),count(1:fndims),vardesc%rec
! print *,__PIO_FILE__,__LINE__,ndims, fndims, start(1:fndims),count(1:fndims),vardesc%rec

#ifdef TIMING
call t_startf("pio_read_nf")
Expand Down Expand Up @@ -1308,7 +1308,7 @@ contains
#ifdef _PNETCDF
ierr = nfmpi_wait_all(file%fh, cnt-1, array_of_requests, status)
#endif
if(DEBUG) print *,__FILE__,__LINE__,status, ierr, total_buffsize
if(DEBUG) print *,__PIO_FILE__,__LINE__,status, ierr, total_buffsize

ptr=>file%data_list_top
do while(associated(ptr))
Expand Down
22 changes: 11 additions & 11 deletions pio/piolib_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ subroutine initdecomp_1dof_nf_i8(iosystem,basepiotype,dims,lenblocks,compdof,iod
!---------------------
glength= product(int(dims,kind=PIO_OFFSET))
if(glength > huge(ndisp)) then
print *,__FILE__,__LINE__,dims,glength
print *,__PIO_FILE__,__LINE__,dims,glength
call piodie( __PIO_FILE__,__LINE__, &
'requested array size too large for this interface ')
endif
Expand Down Expand Up @@ -1517,7 +1517,7 @@ subroutine genindexedblock(lenblocks,basetype,elemtype,filetype,displace)
if(check) call checkmpireturn('genindexedblock: after call to type_commit: ',ierr)
! if(debug) then
! call mpi_type_get_envelope(filetype, nints, nadds, ndtypes, comb, ierr)
! print *,__FILE__,__LINE__,nints,nadds,ndtypes,comb,ierr
! print *,__PIO_FILE__,__LINE__,nints,nadds,ndtypes,comb,ierr
! endif
endif

Expand Down Expand Up @@ -1783,7 +1783,7 @@ subroutine init_intracom(comp_rank, comp_comm, num_iotasks, num_aggregator, stri

iotmp2(:)=0
call MPI_allreduce(iotmp, iotmp2, iosystem%num_tasks, MPI_INTEGER, MPI_SUM, comp_comm, ierr)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__FILE__,__LINE__)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__PIO_FILE__,__LINE__)
call alloc_check(iosystem%ioranks,n_iotasks,'init:n_ioranks')
j=1
iosystem%iomaster = -1
Expand Down Expand Up @@ -1986,11 +1986,11 @@ subroutine init_intercom(component_count, peer_comm, comp_comms, io_comm, iosyst
iam = -1
end if
call mpi_allreduce(iam, io_leader, 1, mpi_integer, MPI_MAX, peer_comm, ierr)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__FILE__,__LINE__)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__PIO_FILE__,__LINE__)
! Find the rank of the comp leader in peer_comm
iam = -1
call mpi_allreduce(iam, comp_leader, 1, mpi_integer, MPI_MAX, peer_comm, ierr)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__FILE__,__LINE__)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__PIO_FILE__,__LINE__)
! create the intercomm
call mpi_intercomm_create(io_comm, 0, peer_comm, comp_leader, i, iosystem(i)%intercomm, ierr)
! create the union_comm
Expand All @@ -1999,7 +1999,7 @@ subroutine init_intercom(component_count, peer_comm, comp_comms, io_comm, iosyst
! Find the rank of the io leader in peer_comm
iam = -1
call mpi_allreduce(iam, io_leader, 1, mpi_integer, MPI_MAX, peer_comm, ierr)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__FILE__,__LINE__)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__PIO_FILE__,__LINE__)

! Find the rank of the comp leader in peer_comm
iosystem(i)%comp_rank = -1
Expand All @@ -2012,7 +2012,7 @@ subroutine init_intercom(component_count, peer_comm, comp_comms, io_comm, iosyst
end if
end if
call mpi_allreduce(iam, comp_leader, 1, mpi_integer, MPI_MAX, peer_comm, ierr)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__FILE__,__LINE__)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__PIO_FILE__,__LINE__)

! create the intercomm
call mpi_intercomm_create(comp_comms(i), 0, peer_comm, io_leader, i, iosystem(i)%intercomm, ierr)
Expand Down Expand Up @@ -2062,11 +2062,11 @@ subroutine init_intercom(component_count, peer_comm, comp_comms, io_comm, iosyst
if(Debugasync) print *,__PIO_FILE__,__LINE__

call MPI_allreduce(iosystem(i)%comproot, j, 1, MPI_INTEGER, MPI_MAX,iosystem(i)%union_comm,ierr)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__FILE__,__LINE__)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__PIO_FILE__,__LINE__)

iosystem%comproot=j
call MPI_allreduce(iosystem(i)%ioroot, j, 1, MPI_INTEGER, MPI_MAX,iosystem(i)%union_comm,ierr)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__FILE__,__LINE__)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__PIO_FILE__,__LINE__)

iosystem%ioroot=j

Expand Down Expand Up @@ -2097,7 +2097,7 @@ subroutine init_intercom(component_count, peer_comm, comp_comms, io_comm, iosyst
call alloc_check(iosystem(i)%ioranks, iosystem(i)%num_iotasks,'init:n_ioranks')
if(Debugasync) print *,__PIO_FILE__,__LINE__,iotmp
call MPI_allreduce(iotmp,iosystem(i)%ioranks,iosystem(i)%num_iotasks,MPI_INTEGER,MPI_MAX,iosystem(i)%union_comm,ierr)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__FILE__,__LINE__)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__PIO_FILE__,__LINE__)

if(Debugasync) print *,__PIO_FILE__,__LINE__,iosystem(i)%ioranks
call dealloc_check(iotmp)
Expand Down Expand Up @@ -2200,7 +2200,7 @@ subroutine pio_recommend_iotasks(comm, ioproc, numiotasks, miniotasks, maxiotask
endif
iotmp2(:)=0
call MPI_allreduce(iotmp,iotmp2,num_tasks,MPI_INTEGER,MPI_SUM,comm,ierr)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__FILE__,__LINE__)
call CheckMPIReturn('Call to MPI_ALLREDUCE()',ierr,__PIO_FILE__,__LINE__)

numiotasks=SUM(iotmp2)

Expand Down
2 changes: 1 addition & 1 deletion pio/pionfatt_mod.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ contains
! case(iotype_netcdf,PIO_iotype_netcdf4c,PIO_iotype_netcdf4p)
case(iotype_netcdf,PIO_iotype_netcdf4c)
if (Ios%io_rank==0) then
if(debug) print *,__FILE__,__LINE__,name,value
if(debug) print *,__PIO_FILE__,__LINE__,name,value
ierr=nf90_put_att(File%fh,varid,name,value)
endif
case(PIO_iotype_netcdf4p)
Expand Down
4 changes: 2 additions & 2 deletions pio/pionfput_mod.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ contains
ierr = nfmpi_begin_indep_data(File%fh)

if(Ios%io_rank==0 .and. (ierr==NF_EINDEP .or. ierr==PIO_NOERR)) then
print *,__FILE__,__LINE__,index,count,trim(ival)
print *,__PIO_FILE__,__LINE__,index,count,trim(ival)
ierr = nfmpi_put_vara (File%fh, varid, int(index,kind=PIO_OFFSET), &
int(count,kind=PIO_OFFSET), ival, int(count,kind=PIO_OFFSET), &
MPI_CHARACTER)
Expand All @@ -134,7 +134,7 @@ contains
ierr = nfmpi_end_indep_data(File%fh)
end if
!#else
! print *,__FILE__,__LINE__,index,count,trim(ival)
! print *,__PIO_FILE__,__LINE__,index,count,trim(ival)
! ierr = nfmpi_put_vara_all (File%fh, varid, int(index,kind=PIO_OFFSET), &
! int(count,kind=PIO_OFFSET), ival)
!#endif
Expand Down
7 changes: 4 additions & 3 deletions pio/pionfwrite_mod.F90.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define __PIO_FILE__ "pionfwrite_mod.F90"
!>
!! @file
!! $Revision$
Expand Down Expand Up @@ -121,11 +122,11 @@ contains
! allocate space on root for copy of iobuf etc.
iobuf_size=size(IOBUF)
if(File%iosystem%num_iotasks>1) then
if(Debug) print *,__FILE__,__LINE__
if(Debug) print *,__PIO_FILE__,__LINE__
call MPI_ALLREDUCE(iobuf_size,max_iobuf_size, &
1,MPI_INTEGER,MPI_MAX,File%iosystem%IO_comm,mpierr)
call CheckMPIReturn(subName, mpierr)
if(Debug) print *,__FILE__,__LINE__,iobuf_size
if(Debug) print *,__PIO_FILE__,__LINE__,iobuf_size
if (File%iosystem%io_rank==0) then
call alloc_check(temp_iobuf,max_iobuf_size)
else
Expand All @@ -147,7 +148,7 @@ contains

temp_count(1:ndims)=int(count(1:ndims))

if(Debug) print *,__FILE__,__LINE__,ndims,temp_start(1:ndims),temp_count(1:ndims)
if(Debug) print *,__PIO_FILE__,__LINE__,ndims,temp_start(1:ndims),temp_count(1:ndims)

! Every i/o proc send data to root

Expand Down

0 comments on commit c39db3e

Please sign in to comment.