Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Application throws segmentation fault after some time on calling a procedure (containing local coarrays) in a loop

subham_m_
Beginner
387 Views

I am trying to call a subroutine in a loop. This subroutine has a local coarray. Following is the code that I am using:

! Test local coarray in procedure called in a loop.
!
program main
    use, intrinsic :: iso_fortran_env, only : input_unit, output_unit, error_unit

    implicit none

    ! Variable declaration.
    integer :: me, ti
    integer :: GHOST_WIDTH, TSTART, TSTEPS

    sync all

    ! Initialize.
    GHOST_WIDTH = 1
    TSTART = 0
    TSTEPS = 10000
    me = this_image()

    ! Iterate.
    do ti = TSTART + 1, TSTART + TSTEPS
        call Aldeal( GHOST_WIDTH )
        if ( me == 1 ) write( output_unit, * ) ti
    end do

    if ( me == 1 ) write( output_unit, * ) "All done!"

    contains
        subroutine Aldeal( width )
            integer, intent(in) :: width

            integer, allocatable, dimension(:), codimension[:] :: shell1_Co, shell2_Co, shell3_Co

            allocate( shell1_Co(width)
  • , shell2_Co(width)
  • , shell3_Co(width)
  • , source=0 ) deallocate( shell1_Co, shell2_Co, shell3_Co ) return end subroutine Aldeal end program main
  • Right now the subroutine is not doing anything other than allocating the local coarray and deallocating it. But even while doing this, the program is throwing me the following error after some iterations:

    forrtl: severe (174): SIGSEGV, segmentation fault occurred
    In coarray image 1
    Image              PC                Routine            Line        Source             
    coarray_main       0000000000406063  Unknown               Unknown  Unknown
    libpthread-2.17.s  00007F21D8B845F0  Unknown               Unknown  Unknown
    libicaf.so         00007F21D90970D5  for_rtl_ICAF_CO_D     Unknown  Unknown
    coarray_main       0000000000405054  main_IP_aldeal_            36  coarray_main.f90
    coarray_main       0000000000404AEC  MAIN__                     22  coarray_main.f90
    coarray_main       0000000000404A22  Unknown               Unknown  Unknown
    libc-2.17.so       00007F21D85C5505  __libc_start_main     Unknown  Unknown
    coarray_main       0000000000404929  Unknown               Unknown  Unknown
    
    Abort(0) on node 0 (rank 0 in comm 496): application called MPI_Abort(comm=0x84000003, 0) - process 0
    

    And the same error is repeated for other images as well.

    I am not able to understand what exactly I am doing wrong. Please help.

     

    P.S. I am using Centos 7 with Intel(R) Parallel Studio XE 2019 Update 4 for Linux.

    0 Kudos
    0 Replies
    Reply