[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
program main
    use omp_lib
    integer maxthreads
    real omp_begin,omp_end,section_begin1,section_end1,section_begin2,section_end2
    maxthreads=omp_get_max_threads()
    print*,"你正在使用的计算机CPU个数=",maxthreads
    call omp_set_num_threads(2)
    !$omp parallel
    omp_begin=omp_get_wtime()
        !$omp sections
            !$omp section
                section_begin1=omp_get_wtime()
                call system('D:\test_al\inv1\run.cmd')
                section_end1=omp_get_wtime()
            !$omp section
                section_begin2=omp_get_wtime()
                call system('D:\test_al\inv2\run.cmd')
                section_end2=omp_get_wtime()
        !$omp end sections
    omp_end=omp_get_wtime()
    !$omp end parallel
    print*,"总时间=",omp_end-omp_begin
    print*,"线程1时间=",section_end1-section_begin1
    print*,"线程2时间=",section_end2-section_begin2
    pause
end program main
[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
use IFPORT
character(len=3) :: cDir
Do i = 1 , 8
  write( cDir , '(i3)' ) i
  k = ChangeDirQQ("D:\test_al\inv"\\adjustl(cDir))
  call system("start D:\test_al\program.exe abc.iter m > m.log")
End Do