最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

fortran - Problem with construction BLOCK and openmp in gfortran - Stack Overflow

programmeradmin0浏览0评论

I wrote the following program :

program my_pgm

    use omp_lib
    implicit none
        
    CALL OMP_set_dynamic(.FALSE.)
    CALL OMP_set_num_threads(2)
    
    !$OMP PARALLEL DEFAULT(SHARED)
    
    my_parallel_block : BLOCK

        integer :: my_idx
 
        DO my_idx = 0, 3
            WRITE(*,*) 'my_idx , thread_num, ',my_idx,omp_get_thread_num()
        END DO
    
    END BLOCK my_parallel_block
    
    !$OMP END PARALLEL
    
end program my_pgm

At compilation time (gfortran -fopenmp mypgm.f90), I got the following errors :

fortranblock.f90:19:31:

19 | END BLOCK my_parallel_block | 1 Error: Syntax error in END BLOCK statement at (1) fortranblock.f90:21:22:

21 | !$OMP END PARALLEL | 1 Error: Unexpected !$OMP END PARALLEL statement at (1) fortranblock.f90:23:3:

23 | end program my_pgm | 1 Error: Expecting END BLOCK statement at (1) f951: Error: Unexpected end of file in 'fortranblock.f90'

To avoid it, I need to remove the block name after END BLOCK: END BLOCK my_parallel_block => END BLOCK !my_parallel_block (! to comment if of course)

Is it specific to GNU Fortran compiler. And is it possible to keep this name with some compilation options or something else ?

发布评论

评论列表(0)

  1. 暂无评论