cpp: #include <stdio.h>\n#include <omp.h>\n#define N 100\n\nint var = 0;\n\nint main(){\n  #pragma omp target map(tofrom:var) device(0)\n  #pragma omp teams distribute\n  for (int i=0; i<N; i++){\n    #pragma omp atomic update\n    var++;\n  }\n  printf("%d\n ",var);\n  return 0;\n}\n
fortran: program DRB146_atomicupdate_orig_gpu_no\n    use omp_lib\n    implicit none\n\n    integer :: var, i\n    var = 0\n\n    !$omp target map(tofrom:var) device(0)\n        !$omp teams distribute\n        do i = 1, 100\n            !$omp atomic update\n            var = var+1\n            !$omp end atomic\n        end do\n        !$omp end teams distribute\n    !$omp end target\n\n  print*,var\nend program