File1: #include <omp.h>\n#include <stdio.h>\n\nint main(int argc, char* argv[])\n{\n  int var = 0, i, res;\n  int sum1 = 0;\n  int sum2 = 0;\n\n  res = omp_get_max_threads();\n\n  #pragma omp parallel reduction(+: var)\n  {\n    #pragma omp for schedule(static) reduction(+: sum1)\n    for (i=0; i<5; i++)\n    sum1+=i;\n    #pragma omp for schedule(static) reduction(+: sum2)\n    for (i=0; i<5; i++)\n    sum2+=i;\n\n    var = sum1 + sum2;\n  }\n\n  int error = (var != 20*res);\n  if (error) printf("%d %d\n",var,20*res);\n  return error;\n}\n
File2: program DRB121_reduction_orig_no\n    use omp_lib\n    implicit none\n\n    integer :: var, i, sum1, sum2\n\n    var = 0\n    sum1 = 0\n    sum2 = 0\n\n    !$omp parallel reduction(+: var)\n        !$omp do schedule(static) reduction(+: sum1)\n        do i = 1, 5\n            sum1 = sum1+i\n        end do\n        !$omp end do\n\n        !$omp do schedule(static) reduction(+: sum2)\n        do i = 1, 5\n            sum2 = sum2+i\n        end do\n        !$omp end do\n\n        var = sum1 + sum2\n    !$omp end parallel\n\n    print 100, var\n    100 format ('var =',3i8)\nend program