0

I am trying to compile a code in which there is a nested loop where I use OpenMp for the first loop. The program is very similar to the one in this issue, including the use of FFTW. The error is:

 DO indiceY=1+2*window,ny-2*window
 ^
 internal compiler error: in gfc_omp_clause_default_ctor, at fortran/trans-openmp.c:481
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.

The code piece in which the problem is appointed:

call dfftw_init_threads(iret)
!nthreads = omp_get_num_thread()
call dfftw_plan_with_nthreads(nthreads)
!***********************************
CALL dfftw_plan_dft_3d(plan, filter_window, filter_window, filter_window, OUTPUT_FFTW, OUTPUT_FFTW, FFTW_FORWARD, FFTW_ESTIMATE)
!$OMP PARALLEL DO DEFAULT(SHARED) SHARED(matrix_in, window, filter_window, plan, nx, ny, nz) &
!$OMP PRIVATE(indiceX, indiceY, indiceZ, OUTPUT_FFTW, matrix_out)
DO indiceZ=1+2*window,nz-2*window
    DO indiceY=1+2*window,ny-2*window
        DO indiceX=1+2*window,nx-2*window
            OUTPUT_FFTW = ABS(matrix_in(indiceX-2*window:indiceX, indiceY-window:indiceY+window,& 
                                                                 indiceZ-window:indiceZ+window) - &
                              matrix_in(indiceX:indiceX+2*window, indiceY-window:indiceY+window,&
                                                                 indiceZ-window:indiceZ+window) )
            CALL dfftw_execute_dft(plan, OUTPUT_FFTW, OUTPUT_FFTW)
            matrix_outX(indiceX, indiceY, indiceZ) = SUM(ABS(OUTPUT_FFTW))
        END DO
    END DO
END DO
!$OMP END PARALLEL DO
CALL dfftw_destroy_plan(plan)
!***********************************
CALL dfftw_cleanup_threads()

Firstly, I suspected that it was a problem with memory (RAM) space, but I reduced the size of the 3D matrix in the calculation and the problem persisted. I have already looked if this is a reported bug (and really a bug but it doesn't appear to be).

I also suspected it was a problem with the gfortran version, so I installed gfortran-5, but the error persisted (internal compiler error: in gfc_omp_clause_default_ctor, at fortran/trans-openmp.c:481 I am using a 64 bit Ubuntu 14.04 (3.13.0-119-generic).

victortxa
  • 79
  • 10
  • 2
    Which exact gfortran version are you using? How does the full error message look like? We need to see the full code including all declarations and the `end program`. Try to reduce the code while keeping the error ([mcve]). `internal conpiler error` is a bug inside the compiler. The compiler crashed. It is the compiler's fault. It may be triggered by an error in your code, but the compiler should not crash anyway. – Vladimir F Героям слава May 24 '17 at 05:52
  • Try different gfortran versions. The error may be fixed in a different version. Even a different subversion like 5.1 vs 5.3. – Vladimir F Героям слава May 24 '17 at 05:53
  • The code you've posted differs from the code in the error message. Make sure that you post exactly the piece of code that produces the problem you are trying to solve. – Hristo Iliev May 24 '17 at 07:53
  • @HristoIliev sorry bout that, I was making some testing (I edited above). @vladimir-f the versions of gfortran are: `(Ubuntu 5.4.1-2ubuntu1~14.04) 5.4.1 20160904` `(Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4`. In both the error happened. I put the rest of the error message above. – victortxa May 24 '17 at 11:51
  • We need the full code! Try to reduce it ([mcve]). – Vladimir F Героям слава May 24 '17 at 12:08
  • I put the full code [here](https://github.com/victortxa/utils/tree/master/fortran). The compilation command used is in the main_error.f90 and also the error message (for gfortran 5). – victortxa May 24 '17 at 15:32
  • As a last test I installed `gfortran 6`. It has compilled...Now I am executing the code to verify if it is really fine. – victortxa May 24 '17 at 15:37
  • Thecode is still WAY too large. Try to delete, and delete, and delete, mericilessly, until you can't delete anything more while still having the error. Look at a good report here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77666 to see how a [mcve] looks like. If it is more than say 20 lines, you have A LOT to delete yet. – Vladimir F Героям слава May 25 '17 at 19:57

0 Answers0