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

I wrote the following program :program my_pgmuse omp_libimplicit noneCALL OMP_set_dynamic(.FALSE.)CALL

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 ?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743762432a4502877.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信