cpp
stringlengths 74
8.89k
| fortran
stringlengths 112
13.8k
|
---|---|
#include <stdio.h>\nint a[100][100];\nint main()\n{\n int i,j;\n#pragma omp parallel for collapse(2)\n for (i=0;i<100;i++)\n for (j=0;j<100;j++)\n a[i][j]=a[i][j]+1;\n return 0;\n}\n\n | program DRB093_doall2_collapse_orig_no\n use omp_lib\n use DRB093\n implicit none\n\n integer :: len, i, j\n len = 100\n\n allocate (a(len,len))\n\n !$omp parallel do collapse(2)\n do i = 1, len\n do j = 1, len\n a(i,j) = a(i,j)+1\n end do\n end do\n !$omp end parallel do\nend program |
#include <stdio.h>\n#if (_OPENMP<201511)\n#error "An OpenMP 4.5 compiler is needed to compile this test."\n#endif\n\n#include <stdio.h>\nint a[100][100];\nint main()\n{\n int i, j;\n#pragma omp parallel\n {\n#pragma omp single\n {\n#pragma omp taskloop collapse(2)\n for (i = 0; i < 100; i++)\n for (j = 0; j < 100; j++)\n a[i][j]+=1; \n }\n }\n printf ("a[50][50]=%d\n", a[50][50]);\n return 0;\n}\n | program DRB096_doall2_taskloop_collapse_orig_no\n use omp_lib\n use DRB096\n implicit none\n\n integer :: len, i, j\n len = 100\n\n allocate (a(len,len))\n\n !$omp parallel\n !$omp single\n !$omp taskloop collapse(2)\n do i = 1, len\n do j = 1, len\n a(i,j) = a(i,j)+1\n end do\n end do\n !$omp end taskloop\n !$omp end single\n !$omp end parallel\n\n print 100, a(50,50)\n 100 format ('a(50,50) =',i3)\n\nend program |
#include <stdio.h>\nint main(int argc, char* argv[])\n{\n int i;\n int len=100;\n int a[100], b[100];\n\n for (i=0;i<len;i++)\n {\n a[i]=i;\n b[i]=i+1;\n }\n\n#pragma omp simd \n for (i=0;i<len-1;i++)\n a[i+1]=a[i]+b[i];\n\n for (i=0;i<len;i++)\n printf("i=%d a[%d]=%d\n",i,i,a[i]);\n return 0;\n}\n | program DRB024_simdtruedep_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, len\n integer, dimension(:), allocatable :: a\n integer, dimension(:), allocatable :: b\n\n len = 100\n\n allocate (a(len))\n allocate (b(len))\n\n do i = 1, len\n a(i) = i\n b(i) = i+1\n end do\n\n !$omp simd\n do i = 1, len-1\n a(i+1) = a(i) + b(i)\n end do\n\n do i = 1, len\n write(6,*) 'Values for i and a(i) are:', i, a(i)\n end do\n\n deallocate(a,b)\nend program |
#include <stdio.h>\n#include <omp.h>\n\nvoid foo(){\n int x = 0, y = 2;\n\n #pragma omp task depend(inout: x) shared(x)\n x++; // 1st child task\n\n #pragma omp task depend(in: x) depend(inout: y) shared(x, y)\n y -= x; //2nd child task\n\n #pragma omp task depend(in: x) if(0) // 1st taskwait\n {}\n\n printf("x=%d\n",x);\n printf("y=%d\n",y);\n\n #pragma omp taskwait // 2nd taskwait\n\n}\n\nint main(){\n #pragma omp parallel\n #pragma omp single\n foo();\n\n return 0;\n}\n\n | program DRB134_taskdep4_orig_yes_omp_45\n use omp_lib\n implicit none\n\n !$omp parallel\n !$omp single\n call foo()\n !$omp end single\n !$omp end parallel\ncontains\n subroutine foo()\n implicit none\n integer :: x, y\n x = 0\n y = 2\n\n !$omp task depend(inout: x) shared(x)\n x = x+1 !!1st Child Task\n !$omp end task\n\n !$omp task depend(in: x) depend(inout: y) shared(x, y)\n y = y-x !!2nd child task\n !$omp end task\n\n !$omp task depend(in: x) if(.FALSE.) !!1st taskwait\n !$omp end task\n\n print*, "x=", x\n print*, "y=", y\n\n !$omp taskwait !!2nd taskwait\n end subroutine foo\nend program |
#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#define N 180\nint indexSet[N] = {\n521, 523, 525, 527, 529, 531,\n547, 549, 551, 553, 555, 557,\n573, 575, 577, 579, 581, 583,\n599, 601, 603, 605, 607, 609,\n625, 627, 629, 631, 633, 635,\n\n651, 653, 655, 657, 659, 661,\n859, 861, 863, 865, 867, 869,\n885, 887, 889, 891, 893, 895,\n911, 913, 915, 917, 919, 921, \n937, 939, 941, 943, 945, 947,\n\n963, 965, 967, 969, 971, 973,\n989, 991, 993, 995, 997, 999,\n1197, 1199, 1201, 1203, 1205, 1207,\n1223, 1225, 1227, 1229, 1231, 1233,\n1249, 1251, 1253, 1255, 1257, 1259,\n\n1275, 1277, 1279, 1281, 1283, 1285,\n1301, 1303, 1305, 1307, 1309, 1311,\n1327, 1329, 1331, 1333, 1335, 1337,\n1535, 1537, 1539, 1541, 1543, 1545,\n1561, 1563, 1565, 1567, 1569, 1571,\n\n1587, 1589, 1591, 1593, 1595, 1597,\n1613, 1615, 1617, 1619, 1621, 1623,\n1639, 1641, 1643, 1645, 1647, 1649,\n1665, 1667, 1669, 1671, 1673, 1675,\n1873, 1875, 1877, 1879, 1881, 1883,\n\n1899, 1901, 1903, 1905, 1907, 1909,\n1925, 1927, 1929, 1931, 1933, 1935,\n1951, 1953, 1955, 1957, 1959, 1961,\n1977, 1979, 1981, 1983, 1985, 1987,\n2003, 2005, 2007, 2009, 2011, 2013};\n\nint main (int argc, char* argv[])\n{\n double * base = (double*) malloc(sizeof(double)* (2013+12+1));\n if (base == 0)\n {\n printf("Error, malloc() returns NULL. End execution. \n");\n return 1; \n }\n\n double * xa1 = base;\n double * xa2 = base + 12;\n int i;\n\n for (i =521; i<= 2025; ++i)\n {\n base[i]=0.0;\n }\n\n#pragma omp parallel for\n for (i =0; i< N; ++i) // this level of loop has no loop carried dependence\n {\n int idx = indexSet[i];\n xa1[idx]+= 1.0;\n xa2[idx]+= 3.0;\n }\n\n // verify the results, no overlapping of xa1 vs. xa2, no addition happens to the same element twice\n for (i =521; i<= 2025; ++i)\n {\n //printf ("%f ", base[i]);\n assert (base[i]!=4.0);\n }\n\n free (base);\n return 0;\n}\n\n | program DRB052_indirectaccesssharebase_orig_no\n use omp_lib\n implicit none\n\n integer, dimension(:), allocatable :: indexSet\n integer, parameter :: dp = kind(1.0d0)\n real(dp), dimension(:), pointer :: xa1, xa2\n real(dp), dimension(:), allocatable, target :: base\n integer :: N = 180\n integer:: i, idx1,idx2\n\n allocate (xa1(2025))\n allocate (xa2(2025))\n allocate (base(2025))\n allocate (indexSet(180))\n xa1 => base(1:2025)\n xa2 => base(1:2025)\n\n indexSet = (/ 521, 523, 525, 527, 529, 531, 547, 549, &\n 551, 553, 555, 557, 573, 575, 577, 579, 581, 583, 599, &\n 601, 603, 605, 607, 609, 625, 627, 629, 631, 633, 635, &\n 651, 653, 655, 657, 659, 661, 859, 861, 863, 865, 867, &\n 869, 885, 887, 889, 891, 893, 895, 911, 913, 915, 917, &\n 919, 921, 937, 939, 941, 943, 945, 947, 963, 965, 967, &\n 969, 971, 973, 989, 991, 993, 995, 997, 999, 1197, 1199, &\n 1201, 1203, 1205, 1207, 1223, 1225, 1227, 1229, 1231, &\n 1233, 1249, 1251, 1253, 1255, 1257, 1259, 1275, 1277, &\n 1279, 1281, 1283, 1285, 1301, 1303, 1305, 1307, 1309, &\n 1311, 1327, 1329, 1331, 1333, 1335, 1337, 1535, 1537, &\n 1539, 1541, 1543, 1545, 1561, 1563, 1565, 1567, 1569, &\n 1571, 1587, 1589, 1591, 1593, 1595, 1597, 1613, 1615, &\n 1617, 1619, 1621, 1623, 1639, 1641, 1643, 1645, 1647, &\n 1649, 1665, 1667, 1669, 1671, 1673, 1675, 1873, 1875, &\n 1877, 1879, 1881, 1883, 1899, 1901, 1903, 1905, 1907, &\n 1909, 1925, 1927, 1929, 1931, 1933, 1935, 1951, 1953, &\n 1955, 1957, 1959, 1961, 1977, 1979, 1981, 1983, 1985, &\n 1987, 2003, 2005, 2007, 2009, 2011, 2013 /)\n\n do i = 521, 2025\n base(i) = 0.0\n end do\n\n !$omp parallel do private(idx1,idx2)\n do i = 1, N\n idx1 = indexSet(i)\n idx2 = indexSet(i)+12\n base(idx1) = base(idx1)+1.0\n base(idx2) = base(idx2)+3.0\n end do\n !$omp end parallel do\n\n do i = 521, 2025\n if (base(i) == 4.0) then\n print*,'i= ',i,' base =',base(i)\n end if\n end do\n\n deallocate(base,indexSet)\n nullify(xa1,xa2)\nend program |
#include <stdlib.h>\n#include <stdio.h>\n\nvoid foo(int n, int * restrict a, int * restrict b, int * restrict c)\n{\n int i;\n#pragma omp parallel for \n for (i = 0; i < n; i++)\n a[i] = b[i] + c[i]; \n}\n\nint main()\n{\n int n = 1000;\n int * a , *b, *c;\n\n a = (int*) malloc (n* sizeof (int));\n if (a ==0)\n {\n fprintf (stderr, "skip the execution due to malloc failures.\n");\n return 1;\n }\n\n b = (int*) malloc (n* sizeof (int));\n if (b ==0)\n {\n fprintf (stderr, "skip the execution due to malloc failures.\n");\n return 1;\n }\n\n c = (int*) malloc (n* sizeof (int));\n if (c ==0)\n {\n fprintf (stderr, "skip the execution due to malloc failures.\n");\n return 1;\n }\n\n foo (n, a, b,c);\n\n free (a);\n free (b);\n free (c);\n return 0;\n} \n\n | program DRB068_restrictpointer2_orig_no\n use omp_lib\n use DRB068\n implicit none\n\n integer :: n = 1000\n integer, dimension(:), pointer :: a=>null(), b=>null(), c=>null(), d=>null()\n\n allocate (a(n))\n allocate (b(n))\n allocate (c(n))\n allocate (d(n))\n\n call foo(n,a,b,c,d)\n\n if(associated(a))nullify(a)\n if(associated(b))nullify(b)\n if(associated(c))nullify(c)\n if(associated(d))nullify(d)\n\nend program |
#include <stdio.h>\nint n=100, m=100;\ndouble b[100][100];\n\nvoid foo()\n{\n int i,j;\n#pragma omp parallel for private(j)\n for (i=0;i<n;i++)\n for (j=0;j<m-1;j++) // Be careful about bounds of j\n b[i][j]=b[i][j+1];\n}\n\nint main()\n{\n foo();\n return 0;\n}\n | program DRB063_outeronly1_orig_no\n use omp_lib\n implicit none\n\n call foo()\ncontains\n subroutine foo()\n integer :: i, j, n, m, len\n real, dimension(:,:), allocatable :: b\n\n len = 100\n allocate (b(len,len))\n n = len\n m = len\n !$omp parallel do private(j)\n do i = 1, n\n do j = 1, m-1\n b(i,j) = b(i,j+1)\n end do\n end do\n !$omp end parallel do\n\n end subroutine foo\nend program |
#include<iostream>\n#include<cassert>\nusing namespace std;\n\nclass A {\npublic:\nstatic int counter;\nstatic int pcounter;\n#pragma omp threadprivate(pcounter)\n};\n\nint A::counter=0;\nint A::pcounter=0;\n\nA a;\n\nvoid foo()\n{\na.counter++;\na.pcounter++;\n}\n\nint main()\n{\n#pragma omp parallel\n{\nfoo();\n}\nassert (A::pcounter == 1);\ncout<<A::counter <<" "<< A::pcounter<<endl;\nreturn 0;\n} | program DRB086_static_data_member_orig_yes\n use omp_lib\n use DRB086\n implicit none\n\n type(A) :: c\n c = A(0,0)\n\n !$omp parallel\n call foo()\n !$omp end parallel\n\n print *,counter,pcounter\nend program |
#include <stdio.h>\nvoid foo()\n{\n static int q; \n q += 1;\n}\n\nint main()\n{ \n #pragma omp parallel \n {\n foo();\n }\n return 0; \n}\n\n | program DRB082_declared_in_func_orig_yes\n use omp_lib\n use global_foo\n implicit none\n\n !$omp parallel\n call foo()\n !$omp end parallel\nend program |
#include <stdio.h>\n#include <omp.h>\n\nint main(){\n\n int i, m=2, n=4;\n int b[4] = {};\n\n #pragma omp simd safelen(2)\n for (i = m; i<n; i++)\n b[i] = b[i-m] - 1.0f;\n\n printf("Expected: -1; Real: %d\n",b[3]);\n return 0;\n}\n\n\n | program DRB137_simdsafelen_orig_no\n use omp_lib\n implicit none\n\n integer :: i, m, n\n real :: b(4)\n\n m = 2\n n = 4\n\n !$omp simd safelen(2)\n do i = m+1, n\n b(i) = b(i-m) - 1.0\n end do\n\n print*, b(3)\nend program |
#include <stdio.h>\n#include <omp.h>\n#include <stdlib.h>\n#define N 100\n\nint main(){\n int var[N];\n for(int i=0; i<N; i++){\n var[i]=0;\n }\n\n #pragma omp target map(tofrom:var[0:N]) device(0)\n #pragma omp teams distribute parallel for\n for (int i=1; i<N; i++){\n var[i]=var[i-1]+1;\n }\n\n for(int i=0; i<N; i++){\n if(var[i]!=i){\n printf("Data Race Present\n");\n return 0;\n }\n }\n return 0;\n}\n | program DRB156_missingordered_orig_gpu_yes\n use omp_lib\n implicit none\n\n integer :: var(100)\n integer :: i\n\n do i = 1, 100\n var(i) = 1\n end do\n\n !$omp target map(tofrom:var) device(0)\n !$omp teams distribute parallel do\n do i = 2, 100\n var(i) = var(i-1)+1\n end do\n !$omp end teams distribute parallel do\n !$omp end target\n\n print*,var(100)\nend program |
#include <stdio.h>\n#include <omp.h>\n\nvoid foo(){\n int x = 0, y = 2;\n\n #pragma omp task depend(inout: x) shared(x)\n x++; // 1st child task\n\n #pragma omp task depend(in: x) depend(inout: y) shared(x, y)\n y = y-x; //2nd child task\n\n #pragma omp task depend(in: x) if(0) // 1st taskwait\n {}\n\n printf("x=%d\n",x);\n\n #pragma omp taskwait // 2nd taskwait\n\n printf("y=%d\n",y);\n}\n\nint main(){\n #pragma omp parallel\n #pragma omp single\n foo();\n\n return 0;\n}\n\n | program DRB133_taskdep5_orig_no_omp45\n use omp_lib\n implicit none\n\n !$omp parallel\n !$omp single\n call foo()\n !$omp end single\n !$omp end parallel\ncontains\n subroutine foo()\n implicit none\n integer :: x, y\n x = 0\n y = 2\n\n !$omp task depend(inout: x) shared(x)\n x = x+1 !!1st Child Task\n !$omp end task\n\n !$omp task depend(in: x) depend(inout: y) shared(x, y)\n y = y-x !!2nd child task\n !$omp end task\n\n !$omp task depend(in: x) if(.FALSE.) !!1st taskwait\n !$omp end task\n\n print*, "x=", x\n\n !$omp taskwait !!2nd taskwait\n\n print*, "y=", y\n\n end subroutine\nend program |
#include <stdlib.h>\nint main(int argc, char* argv[])\n{\n int i;\n int tmp;\n int len=100;\n if (argc>1)\n len = atoi(argv[1]);\n int a[len];\n for (i=0;i<len;i++)\n a[i]=i;\n\n#pragma omp parallel for\n for (i=0;i<len;i++)\n {\n tmp =a[i]+i;\n a[i] = tmp;\n }\n return 0;\n}\n | program DRB020_privatemissing_var_yes\n use omp_lib\n implicit none\n\n integer :: i, tmp, len, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n integer, dimension (:), allocatable :: a\n\n len = 100\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n allocate (a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n !$omp parallel do\n do i = 1, len\n tmp = a(i) + i\n a(i) = tmp\n end do\n !$omp end parallel do\n\n print 100, a(50)\n 100 format ("a(50)=",i3)\n\n deallocate(args,a)\n\nend program |
#include<stdio.h>\n#include<assert.h>\n\nvoid f1(int *q)\n{\n#pragma omp critical\n *q = 1;\n#pragma omp flush\n}\n\nint main()\n{ \n int i=0, sum=0; \n \n #pragma omp parallel reduction(+:sum) num_threads(10) \n {\n f1(&i);\n sum+=i;\n }\n assert (sum==10);\n printf("sum=%d\n", sum);\n return 0; \n}\n | program DRB074_flush_orig_yes\n use omp_lib\n use DRB074\n implicit none\n\n integer :: i, sum\n i = 0\n sum = 0\n\n !$omp parallel reduction(+:sum) num_threads(10)\n call f1(i)\n sum = sum+i\n !$omp end parallel\n\n if (sum /= 10) then\n print*,'sum =',sum\n end if\nend program |
#include <stdio.h>\n#define num_steps 2000000000 \n\n#include <stdio.h>\nint main(int argc, char** argv)\n{\n double pi = 0.0;\n long int i;\n double x, interval_width;\n interval_width = 1.0/(double)num_steps;\n\n#pragma omp parallel for reduction(+:pi) private(x)\n for (i = 0; i < num_steps; i++) {\n x = (i+ 0.5) * interval_width;\n pi += 1.0 / (x*x + 1.0);\n }\n\n pi = pi * 4.0 * interval_width;\n printf ("PI=%f\n", pi);\n return 0;\n}\n | program DRB065_pireduction_orig_no\n use omp_lib\n implicit none\n\n real(kind = 16) :: x, interval_width, pi\n integer(kind = 8) :: i, num_steps\n\n pi = 0.0\n num_steps = 2000000000\n interval_width = 1.0/num_steps\n\n !$omp parallel do reduction(+:pi) private(x)\n do i = 1, num_steps\n x = (i + 0.5) * interval_width\n pi = pi + 1.0 / (x*x + 1.0);\n end do\n !$omp end parallel do\n\n pi = pi * 4.0 * interval_width;\n print 100, pi\n 100 format ("PI =",F24.20)\n\nend program |
#include <omp.h>\n#include <stdio.h>\n\n\nint main(){\n int x = 2;\n\n #pragma omp task shared(x) mergeable\n {\n x++;\n }\n #pragma omp taskwait\n\n printf("%d\n",x);\n return 0;\n}\n | program DRB130_mergeable_taskwait_orig_no\n use omp_lib\n implicit none\n\n integer :: x\n x = 2\n\n !$omp task shared(x) mergeable\n x = x+1\n !$omp end task\n\n print 100, x\n 100 format ('x =',3i8)\nend program |
#include <stdio.h>\nint main(int argc, char* argv[])\n{\n int i,x;\n int len = 10000;\n\n#pragma omp parallel for private (i) \n for (i=0;i<len;i++)\n x=i;\n\n printf("x=%d",x);\n return 0;\n}\n\n | program DRB009_lastprivatemissing_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, x, len\n len = 10000\n\n !$omp parallel do private(i)\n do i = 0, len\n x = i\n end do\n !$omp end parallel do\n\n write(*,*) 'x =', x\nend program |
#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 parallel for\n for(int i=0; i<N*2; i++){\n #pragma omp critical\n var++;\n }\n\n printf("%d\n ",var);\n\n return 0;\n}\n | program DRB144_atomiccritical_orig_gpu_yes\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 parallel do\n do i = 1, 200\n !$omp critical\n var = var+1\n !$omp end critical\n end do\n !$omp end teams distribute parallel do\n !$omp end target\n\n print*,var\nend program |
#include<iostream>\n#include<cassert>\nusing namespace std;\n\nclass A {\npublic:\nstatic int counter;\nstatic int pcounter;\n#pragma omp threadprivate(pcounter)\n};\n\nint A::counter=0;\nint A::pcounter=0;\n\nA a;\n\nint main()\n{\n#pragma omp parallel\n{\na.counter++;\na.pcounter++;\n}\nassert (A::pcounter == 1);\ncout<<A::counter <<" "<< A::pcounter<<endl;\nreturn 0;\n} | program DRB087_static_data_member2_orig_yes\n use omp_lib\n use DRB087\n implicit none\n\n type(A) :: c\n c = A(0,0)\n\n !$omp parallel\n counter = counter+1\n pcounter = pcounter+1\n !$omp end parallel\n\n print *,counter,pcounter\nend program |
#include <stdlib.h>\nint main(int argc,char *argv[])\n{\n int i, j;\n int len = 20; \n\n if (argc>1)\n len = atoi(argv[1]);\n\n double a[len][len];\n\n for (i=0; i< len; i++)\n for (j=0; j<len; j++)\n a[i][j] = 0.5; \n\n#pragma omp parallel for private(j)\n for (i = 0; i < len - 1; i += 1) {\n for (j = 0; j < len ; j += 1) {\n a[i][j] += a[i + 1][j];\n }\n }\n return 0;\n}\n\n | program DRB004_antidep2_var_yes\n use omp_lib\n implicit none\n\n integer :: i, j, len, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n real, dimension (:,:), allocatable :: a\n len = 1000\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n allocate (a(len,len))\n\n\n do i = 1, len\n do j = 1, len\n a(i,j) = 0.5\n end do\n end do\n\n !$omp parallel do private(j)\n do i = 1, len-1\n do j = 1, len\n a(i,j) = a(i,j) + a(i+1,j)\n end do\n end do\n !$omp end parallel do\n\n write(*,*) 'a(10,10) =', a(10,10)\n\n deallocate(a)\n deallocate(args)\n\nend program |
#include <stdio.h>\n\nvoid foo()\n{\n int i,x;\n#pragma omp parallel for private (i) lastprivate (x)\n for (i=0;i<100;i++)\n x=i;\n printf("x=%d",x);\n}\n\nint main()\n{\n foo();\n return 0;\n}\n\n | program DRB059_lastprivate_orig_no\n use omp_lib\n implicit none\n !$omp parallel\n call foo()\n !$omp end parallel\ncontains\n subroutine foo()\n integer :: i, x\n !$omp parallel do private(i) lastprivate(x)\n do i = 1, 100\n x = i\n end do\n !$omp end parallel do\n print 100, x\n 100 format ("x =",i3)\n end subroutine foo\nend program |
#include <stdlib.h>\n#include <stdio.h>\nint main(int argc, char* argv[])\n{\n int i;\n int tmp;\n int len=100;\n int a[100];\n for (i=0;i<len;i++)\n a[i]=i;\n\n#pragma omp parallel for\n for (i=0;i<len;i++)\n {\n tmp =a[i]+i;\n a[i] = tmp;\n }\n\n printf("a[50]=%d\n", a[50]);\n return 0;\n}\n | program DRB028_privatemissing_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, tmp, len\n integer, dimension(:), allocatable :: a\n\n len = 100\n allocate (a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n !$omp parallel do\n do i = 1, len\n tmp = a(i) + i\n a(i) = tmp\n end do\n !$omp end parallel do\n\n print 100, a(50)\n 100 format ('a(50)=',i3)\n\n deallocate(a)\nend program |
#include <stdio.h>\n#include <omp.h>\n#include <stdlib.h>\n#define N 100\n#define C 16\n\nint main(){\n int var[N];\n\n for(int i=0; i<N; i++){\n var[i]=0;\n }\n\n #pragma omp target map(tofrom:var[0:N]) device(0)\n #pragma omp teams distribute parallel for simd safelen(C)\n for (int i=C; i<N; i++){\n var[i]=var[i-C]+1;\n }\n\n printf("%d\n",var[97]);\n\n return 0;\n}\n | program DRB157_missingorderedsimd_orig_gpu_yes\n use omp_lib\n implicit none\n\n integer :: var(100)\n integer :: i\n\n do i = 1, 100\n var(i) = 1\n end do\n\n !$omp target map(tofrom:var) device(0)\n !$omp teams distribute parallel do simd safelen(16)\n do i = 17, 100\n var(i) = var(i-16)+1\n end do\n !$omp end teams distribute parallel do simd\n !$omp end target\n\n print*,var(98)\nend program |
#include <stdio.h>\n#include <stdlib.h>\n\nvoid load_from_input(int *data, int size)\n{\n for(int i = 0; i < size; i++) {\n data[i] = size-i;\n } \n}\n\n\nint main(int argc, char *argv[]) {\n\n int *A; \n int N = 100;\n\n if (argc>1)\n N = atoi(argv[1]);\n\n A = (int*) malloc(sizeof(int) * N);\n\n load_from_input(A, N);\n \n#pragma omp parallel for shared(A)\n for(int i = 0; i < N; i++) {\n A[i] = i;\n if (N > 10000) \n { \n A[0] = 1; \n }\n }\n\n free(A);\n return 0;\n}\n | program DRB171_input_dependence_var_yes\n use omp_lib\n implicit none\n\n integer :: i, N, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n integer, dimension(:), allocatable :: a\n\n N = 100\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) N\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n allocate (a(N))\n\n call load_from_input(a, N)\n\n \n !$omp parallel do shared(a)\n do i = 1, N\n a(i) = i\n if(N .gt. 10000) a(1) = 1\n end do\n !$omp end parallel do\n\nend program |
#include <stdio.h>\n#if (_OPENMP<201511)\n#error "An OpenMP 4.5 compiler is needed to compile this test."\n#endif\n#include <stdio.h>\nint a[100][100];\nint main()\n{\n int i, j;\n#pragma omp parallel\n {\n#pragma omp single\n {\n#pragma omp taskloop\n for (i = 0; i < 100; i++)\n for (j = 0; j < 100; j++)\n a[i][j]+=1; \n }\n }\n printf ("a[50][50]=%d\n", a[50][50]);\n return 0;\n}\n | program DRB095_doall2_taskloop_orig_yes\n use omp_lib\n use DRB095\n implicit none\n\n integer :: len, i, j\n len = 100\n allocate (a(len,len))\n\n !$omp parallel\n !$omp single\n !$omp taskloop\n do i = 1, len\n do j = 1, len\n a(i,j) = a(i,j)+1\n end do\n end do\n !$omp end taskloop\n !$omp end single\n !$omp end parallel\n\n print 100, a(50,50)\n 100 format ('a(50,50) =',i3)\n\nend program |
#include <omp.h>\n#include <stdio.h>\n\nint tp;\n#pragma omp threadprivate(tp)\nint var;\n\nint main(){\n #pragma omp task\n {\n #pragma omp task\n {\n tp = 1;\n #pragma omp task\n {\n }\n var = tp;\n }\n }\n return 0;\n}\n | module DRB128\ninteger :: tp, var\n!$omp threadprivate(tp)\ncontains\nsubroutine foo\n!$omp task\n!$omp task\ntp = 1\n!$omp task\n!$omp end task\nvar = tp\n!$omp end task\n!$omp end task\nend subroutine\nend module program DRB128_tasking_threadprivate2_orig_no\n use omp_lib\n use DRB128\n implicit none\n\n call foo()\n print*,var\nend program |
#include <stdio.h>\nint main(int argc, char* argv[])\n{\n int i,j;\n float temp, sum=0.0;\n int len=100;\n\n float u[100][100];\n for (i = 0; i < len; i++)\n for (j = 0; j < len; j++)\n u[i][j] = 0.5; \n\n#pragma omp parallel for private (temp,i,j)\n for (i = 0; i < len; i++)\n for (j = 0; j < len; j++)\n {\n temp = u[i][j];\n sum = sum + temp * temp;\n }\n\n printf ("sum = %f\n", sum); \n return 0;\n}\n | program DRB021_reductionmissing_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, j, len\n real :: temp, getSum\n real, dimension (:,:), allocatable :: u\n\n len = 100\n getSum = 0.0\n\n allocate (u(len, len))\n\n do i = 1, len\n do j = 1, len\n u(i,j) = 0.5\n end do\n end do\n\n !$omp parallel do private(temp, i, j)\n do i = 1, len\n do j = 1, len\n temp = u(i,j)\n getSum = getSum + temp * temp\n end do\n end do\n !$omp end parallel do\n\n print*,"sum =", getSum\n deallocate(u)\nend program |
#include <assert.h> \n#include <stdio.h>\n/* This is a program based on a test contributed by Yizi Gu@Rice Univ.\n * Proper user of ordered directive and clause, no data races\n * */\nint main()\n{\n int x =0;\n#pragma omp parallel for ordered \n for (int i = 0; i < 100; ++i) {\n#pragma omp ordered\n {\n x++;\n }\n }\n assert (x==100);\n printf ("x=%d\n",x);\n return 0;\n} \n | program DRB110_ordered_orig_no\n use omp_lib\n implicit none\n\n integer x, i\n x=0\n \n !$omp parallel do ordered\n do i = 1, 100\n !$omp ordered\n x = x+1\n !$omp end ordered\n end do\n !$omp end parallel do \n\n print*,'x =',x\nend program |
#include <stdio.h> \n#include <assert.h> \n#include <unistd.h>\nint main()\n{\n int i=0, j, k;\n#pragma omp parallel\n#pragma omp single\n {\n#pragma omp task depend (out:i)\n {\n sleep(3);\n i = 1; \n }\n#pragma omp task depend (in:i)\n j =i; \n#pragma omp task depend (in:i)\n k =i; \n }\n printf ("j=%d k=%d\n", j, k);\n assert (j==1 && k==1);\n return 0;\n} \n | program DRB079_taskdep3_orig_no\n use omp_lib\n implicit none\n\n integer :: i, j, k\n i = 0\n\n !$omp parallel\n !$omp single\n !$omp task depend (out:i)\n call sleep(3)\n i = 1\n !$omp end task\n !$omp task depend (in:i)\n j = i\n !$omp end task\n !$omp task depend (in:i)\n k = i\n !$omp end task\n !$omp end single\n !$omp end parallel\n\n print 100, j, k\n 100 format ('j =',i3,2x,'k =',i3)\n\n if (j /= 1 .and. k /= 1) then\n print*, 'Race Condition'\n end if\n\nend program |
#include <stdlib.h>\n#include <stdio.h>\nint main(int argc, char* argv[])\n{\n int i;\n int len=100;\n int a[100];\n\n for (i=0;i<len;i++)\n a[i]=i;\n\n#pragma omp parallel for\n for (i=0;i<len-1;i++)\n a[i+1]=a[i]+1;\n\n printf("a[50]=%d\n", a[50]); \n return 0;\n}\n | program DRB029_truedep1_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, len\n integer, dimension(:), allocatable :: a\n\n len = 100\n allocate (a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n !$omp parallel do\n do i = 1, len-1\n a(i+1) = a(i)+1\n end do\n !$omp end parallel do\n\n print 100, a(50)\n 100 format ('a(50)=',i3)\n\n deallocate(a)\nend program |
#include <stdio.h>\n#include <stdlib.h>\n#include <omp.h>\n#define C 64\n\nfloat a;\nfloat x[C];\nfloat y[C];\n\nint main(){\n for(int i=0; i<C; i++){\n a=5;\n x[i]=0;\n y[i]=3;\n }\n\n #pragma omp target map(to:y[0:C],a) map(tofrom:x[0:C]) device(0)\n {\n for(int i=0; i<C; i++){\n #pragma omp task depend(inout:x[i])\n {\n x[i] = a * x[i];\n }\n #pragma omp task depend(inout:x[i])\n {\n x[i] = x[i] + y[i];\n }\n }\n }\n\n for(int i=0; i<C; i++){\n if(x[i]!=3){\n printf("Data Race Detected\n");\n return 0;\n }\n }\n\n #pragma omp taskwait\n return 0;\n}\n | program DRB158_missingtaskbarrier_orig_gpu_no\n use omp_lib\n use DRB158\n implicit none\n\n do i = 1, 64\n x(i) = 0\n y(i) = 3\n end do\n\n a = 5\n\n !$omp target map(to:y,a) map(tofrom:x) device(0)\n do i = 1, 64\n !$omp task depend(inout:x(i))\n x(i) = a*x(i)\n !$omp end task\n\n !$omp task depend(inout:x(i))\n x(i) = x(i)+y(i)\n !$omp end task\n end do\n !$omp end target\n\n do i = 1, 64\n if (x(i) /= 3) then\n print*,x(i)\n end if\n end do\n\n !$omp taskwait\n\nend program |
#include <stdio.h>\n#include <omp.h>\n\nint main(){\n\n int x = 0, y;\n\n #pragma omp parallel num_threads(2)\n {\n int thrd = omp_get_thread_num();\n if (thrd == 0) {\n #pragma omp critical\n { x = 10; }\n #pragma omp atomic write\n y = 1;\n } else {\n int tmp = 0;\n while (tmp == 0) {\n #pragma omp atomic read acquire\n tmp = y;\n }\n #pragma omp critical\n { if (x!=10) printf("x = %d\n", x); }\n }\n }\n return 0;\n}\n | program DRB142_acquirerelease_orig_yes\n use omp_lib\n implicit none\n\n integer :: x, y, thrd\n integer :: tmp\n x = 0\n\n !$omp parallel num_threads(2) private(thrd) private(tmp)\n thrd = omp_get_thread_num()\n if (thrd == 0) then\n !$omp critical\n x = 10\n !$omp end critical\n !$omp atomic write\n y = 1\n !$omp end atomic\n else\n tmp = 0\n do while(tmp == 0)\n !$omp atomic read acquire ! or seq_cst\n tmp = x\n !$omp end atomic\n end do\n !$omp critical\n print *, "x = ", x\n !$omp end critical\n end if\n !$omp end parallel\nend program |
#include <omp.h>\n#include <assert.h> \nint main()\n{\n omp_lock_t lck;\n int i=0;\n omp_init_lock(&lck);\n#pragma omp parallel sections\n {\n#pragma omp section\n {\n omp_set_lock(&lck);\n i += 1; \n omp_unset_lock(&lck);\n }\n#pragma omp section\n {\n omp_set_lock(&lck);\n i += 2; \n omp_unset_lock(&lck);\n }\n }\n\n omp_destroy_lock(&lck);\n assert (i==3);\n return 0;\n} \n | program DRB069_sectionslock1_orig_no\n use omp_lib\n implicit none\n\n integer (kind=omp_lock_kind) lock\n integer :: i\n i = 0\n call omp_init_lock(lock)\n\n !$omp parallel sections\n !$omp section\n call omp_set_lock(lock)\n i = i + 1\n call omp_unset_lock(lock)\n !$omp section\n call omp_set_lock(lock)\n i = i + 2\n call omp_unset_lock(lock)\n !$omp end parallel sections\n\n call omp_destroy_lock(lock)\n\n print 100, i\n 100 format ('I =',i3)\nend program |
#include <stdio.h>\nint main()\n{\n int i,error;\n int len = 1000;\n int a[len], b=5;\n\n for (i=0; i<len; i++)\n a[i]= i;\n \n#pragma omp parallel shared(b, error) \n {\n#pragma omp for nowait\n for(i = 0; i < len; i++)\n a[i] = b + a[i]*5;\n\n#pragma omp single\n error = a[9] + 1;\n }\n\n printf ("error = %d\n", error);\n return 0;\n} \n | program DRB013_nowait_orig_yes\n use omp_lib\n implicit none\n\n integer i, error, len, b\n integer, dimension (:), allocatable :: a\n\n b = 5\n len = 1000\n\n allocate (a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n !$omp parallel shared(b, error)\n !$omp parallel\n !$omp do\n do i = 1, len\n a(i) = b + a(i)*5\n end do\n !$omp end do nowait\n !$omp single\n error = a(10) + 1;\n !$omp end single\n !$omp end parallel\n !$omp end parallel\n\n print*,"error =",error\n\n deallocate(a)\nend program |
#include <stdio.h>\n#include <omp.h>\n\nvoid foo(){\n\n int x = 0, y = 2;\n\n #pragma omp task depend(inout: x) shared(x)\n x++; //1st Child Task\n\n #pragma omp task shared(y)\n y--; // 2nd child task\n\n #pragma omp taskwait depend(in: x) // 1st taskwait\n\n printf("x=%d\n",x);\n\n #pragma omp taskwait // 2nd taskwait\n\n printf("y=%d\n",y);\n}\n\n\nint main(){\n #pragma omp parallel\n #pragma omp single\n foo();\n\n return 0;\n}\n\n | program DRB166_taskdep4_orig_no_omp50\n use omp_lib\n implicit none\n\n !$omp parallel\n !$omp single\n call foo()\n !$omp end single\n !$omp end parallel\ncontains\n subroutine foo()\n implicit none\n integer :: x, y\n x = 0\n y = 2\n\n !$omp task depend(inout: x) shared(x)\n x = x+1 !!1st Child Task\n !$omp end task\n\n !$omp task shared(y)\n y = y-1 !!2nd child task\n !$omp end task\n\n !$omp taskwait depend(in: x) !!1st taskwait\n\n print*, "x=", x\n\n !$omp taskwait !!2nd taskwait\n\n print*, "y=", y\n\n end subroutine\nend program |
#include <omp.h>\n#include <stdio.h>\n\nint main(){\n\n int var=0,i;\n\n #pragma omp target map(tofrom:var) device(0)\n #pragma omp teams distribute parallel for\n for (int i=0; i<100; i++){\n var++;\n }\n\n printf("%d\n",var);\n return 0;\n}\n | program DRB151_missinglock3_orig_gpu_yes\n use omp_lib\n implicit none\n\n integer :: var, i\n\n !$omp target map(tofrom:var) device(0)\n !$omp teams distribute parallel do\n do i = 1, 100\n var = var+1\n end do\n !$omp end teams distribute parallel do\n !$omp end target\n\n print*, var\nend program |
#include <stdio.h>\n#include <assert.h>\nint sum0=0, sum1=0;\n//#pragma omp threadprivate(sum0)\n\nint main()\n{\n int i, sum=0;\n#pragma omp parallel\n {\n#pragma omp for\n for (i=1;i<=1000;i++)\n {\n sum0=sum0+i;\n } \n#pragma omp critical\n {\n sum= sum+sum0;\n } \n } \n/* reference calculation */\n for (i=1;i<=1000;i++)\n {\n sum1=sum1+i;\n }\n printf("sum=%d; sum1=%d\n",sum,sum1);\n// assert(sum==sum1);\n return 0;\n}\n\n | program DRB092_threadprivatemissing2_orig_yes\n use omp_lib\n use DRB092\n implicit none\n\n integer :: i, sum\n sum = 0\n sum0 = 0\n sum1 = 0\n\n !$omp parallel\n !$omp do\n do i = 1, 1001\n sum0 = sum0+i\n end do\n !$omp end do\n !$omp critical\n sum = sum+sum0\n !$omp end critical\n !$omp end parallel\n\n do i = 1, 1001\n sum1=sum1+i\n end do\n\n print*,'sum =',sum,'sum1 =',sum1\n\nend program |
#include <assert.h> \n#include <stdio.h> \nint main()\n{\n int i=0;\n#pragma omp parallel\n#pragma omp single\n {\n#pragma omp task\n i = 1; \n#pragma omp task\n i = 2; \n }\n\n printf ("i=%d\n",i);\n return 0;\n} \n | program DRB027_taskdependmissing_orig_yes\n use omp_lib\n implicit none\n\n integer :: i\n i=0\n\n !$omp parallel\n !$omp single\n !$omp task\n i = 1\n !$omp end task\n !$omp task\n i = 2\n !$omp end task\n !$omp end single\n !$omp end parallel\n\n print 100, i\n 100 format ("i=",i3)\n\nend program |
#include <stdio.h>\nint n=100, m=100;\ndouble b[100][100];\n\nvoid foo()\n{\n int i,j;\n#pragma omp parallel for private(j)\n for (i=0;i<n;i++)\n for (j=1;j<m;j++) // Be careful about bounds of j\n b[i][j]=b[i][j-1];\n}\n\nint main()\n{\n foo();\n return 0;\n}\n | program DRB064_outeronly2_orig_no\n use omp_lib\n implicit none\n\n call foo()\ncontains\n subroutine foo()\n integer :: i, j, n, m, len\n real, dimension(:,:), allocatable :: b\n\n len = 100\n allocate (b(len,len))\n n = len\n m = len\n\n !$omp parallel do private(j)\n do i = 1, n\n do j = 2, m\n b(i,j) = b(i,j-1)\n end do\n end do\n !$omp end parallel do\n end subroutine foo\nend program |
#include <stdlib.h>\nint main(int argc, char* argv[])\n{ \n int i; \n int tmp;\n tmp = 10;\n int len=100;\n\n if (argc>1)\n len = atoi(argv[1]);\n\n int a[len];\n#pragma omp parallel for\n for (i=0;i<len;i++)\n { \n a[i] = tmp;\n tmp =a[i]+i;\n } \n return 0; \n}\n\n | program DRB036_truedepscalar_var_yes\n use omp_lib\n implicit none\n\n integer i, tmp, len, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n integer, dimension(:), allocatable :: a\n\n len = 100\n tmp = 10\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n allocate (a(len))\n\n !$omp parallel do\n do i = 1, len\n a(i) = tmp\n tmp = a(i) + i\n end do\n !$omp end parallel do\n\n deallocate(args,a)\nend program |
#include <omp.h>\n#include <stdio.h>\n#include <unistd.h>\n\nint main(int argc, char* argv[])\n{\n int var = 0;\n int i;\n\n #pragma omp parallel sections \n {\n for (i = 0; i < 10; i++) {\n #pragma omp task shared(var) if(0)\n {\n var++;\n }\n }\n }\n\n printf("%d\n",var);\n return 0;\n}\n | program DRB122_taskundeferred_orig_no\n use omp_lib\n implicit none\n\n integer :: var, i\n var = 0\n\n !$omp parallel sections\n do i = 1, 10\n !$omp task shared(var) if(.FALSE.)\n var = var+1;\n !$omp end task\n end do\n !$omp end parallel sections\n\n print 100, var\n 100 format ('var =', 3i8)\nend program |
#include <stdlib.h> \nint main(int argc, char* argv[]) \n{\n int i;\n int len=100;\n\n if (argc>1)\n len = atoi(argv[1]);\n\n int numNodes=len, numNodes2=0; \n int x[len]; \n\n for (i=0; i< len; i++)\n {\n if (i%2==0)\n x[i]=5;\n else\n x[i]= -5;\n }\n\n#pragma omp parallel for\n for (i=numNodes-1 ; i>-1 ; --i) {\n if (x[i]<=0) {\n numNodes2-- ;\n }\n } \n return 0;\n} \n | program DRB012_minusminus_var_yes\n use omp_lib\n implicit none\n\n integer :: i, len, numNodes, numNodes2, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n integer, dimension (:), allocatable :: x\n\n len = 100\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n allocate (x(len))\n\n numNodes=len\n numNodes2=0\n !initialize x()\n do i = 1, len\n if (MOD(i,2) == 0) then\n x(i) = 5\n else\n x(i) = -5\n end if\n end do\n\n !$omp parallel do\n do i = numNodes, 1, -1\n if (x(i) <= 0) then\n numNodes2 = numNodes2-1\n end if\n end do\n !$omp end parallel do\n\n print*,"numNodes2 =", numNodes2\n\n deallocate(args,x)\nend program |
#include <stdlib.h>\ntypedef double real8;\n\nvoid foo(real8 * restrict newSxx, real8 * restrict newSyy, int length)\n{\n int i;\n\n#pragma omp parallel for private (i) firstprivate (length)\n for (i = 0; i <= length - 1; i += 1) {\n newSxx[i] = 0.0;\n newSyy[i] = 0.0;\n }\n}\n\nint main()\n{\n int length=1000;\n real8* newSxx = malloc (length* sizeof (real8));\n real8* newSyy = malloc (length* sizeof (real8));\n\n foo(newSxx, newSyy, length);\n\n free (newSxx);\n free (newSyy);\n return 0;\n}\n\n | program DRB067_restrictpointer1_orig_no\n use omp_lib\n use DRB067\n implicit none\n\n integer :: len = 1000\n integer, parameter :: dp = kind(1.0d0)\n real(dp),dimension(:), pointer :: newSxx, newSyy\n\n allocate (newSxx(len))\n allocate (newSyy(len))\n\n call foo(newSxx, newSyy, len)\n\n if(associated(newSxx))nullify(newSxx)\n if(associated(newSyy))nullify(newSyy)\nend program |
#include <stdio.h>\n#include <omp.h>\n#define N 100\n#define C 64\n\nint main(){\n int var[C];\n\n for(int i=0; i<C; i++){\n var[i]=0;\n }\n\n #pragma omp target map(tofrom:var[0:C]) device(0)\n #pragma omp teams distribute parallel for reduction(+:var) \n for (int i=0; i<N; i++){\n #pragma omp simd\n for(int i=0; i<C; i++){\n var[i]++;\n }\n }\n\n for(int i=0; i<C; i++){\n if(var[i]!=100){\n printf("%d\n",var[i]);\n }\n }\n\n return 0;\n}\n | program DRB163_simdmissinglock1_orig_gpu_no\n use omp_lib\n use DRB163\n implicit none\n\n do i = 1, 16\n var(i) = 0\n end do\n\n !$omp target map(tofrom:var) device(0)\n !$omp teams distribute parallel do reduction(+:var)\n do i = 1, 20\n !$omp simd\n do j = 1, 16\n var(j) = var(j)+1\n end do\n !$omp end simd\n end do\n !$omp end teams distribute parallel do\n !$omp end target\n\n do i = 1, 16\n if (var(i) /= 20) then\n print*, var(i), i\n end if\n end do\n\nend program |
#include <stdio.h>\n#include <stdlib.h>\n#include <omp.h>\n#define N 100\n#define C 8\n\n\nint a;\nint b[C];\nint c[C];\nint temp[C];\n\nint main(){\n for(int i=0; i<C; i++){\n b[i]=0;\n c[i]=2;\n temp[i]=0;\n }\n a=2;\n\n #pragma omp target map(tofrom:b[0:C]) map(to:c[0:C],temp[0:C],a) device(0)\n #pragma omp parallel\n {\n for(int i=0; i<N ;i++){\n #pragma omp for\n for(int i=0; i<C; i++){\n temp[i] = b[i] + c[i];\n }\n\n #pragma omp for\n for(int i=C-1; i>=0; i--){\n b[i] = temp[i] * a;\n }\n }\n }\n\n int val = 0;\n\n for(int i=0; i<N; i++){\n val = val + 2;\n val = val * 2;\n }\n\n for(int i=0; i<C; i++){\n if(b[i]!=val){\n printf("expected %d real %d \n",val, b[i]);\n return 0;\n }\n }\n\n return 0;\n}\n | program DRB159_nobarrier_orig_gpu_no\n use omp_lib\n use DRB159\n implicit none\n\n do i = 1, 8\n b(i) = 0\n c(i) = 2\n temp(i) = 0\n end do\n\n a = 2\n\n !$omp target map(tofrom:b) map(to:c,temp,a) device(0)\n !$omp parallel\n do i = 1, 100\n !$omp do\n do j = 1, 8\n temp(j) = b(j)+c(j)\n end do\n !$omp end do\n\n !$omp do\n do j = 8, 1, k-1\n b(j) = temp(j)*a\n end do\n !$omp end do\n end do\n !$omp end parallel\n !$omp end target\n\n do i = 1, 100\n val = val+2\n val = val*2\n end do\n\n do i = 1, 8\n if (val /= b(i)) then\n print*,b(i),val\n end if\n end do\n\nend program |
#include <stdio.h>\nvoid foo1(double o1[], double c[], int len)\n{ \n int i ;\n#pragma omp parallel for\n for (i = 0; i < len; ++i) {\n double volnew_o8 = 0.5 * c[i];\n o1[i] = volnew_o8;\n } \n}\n\ndouble o1[100];\ndouble c[100];\nint main()\n{\n foo1 (o1, c, 100);\n return 0;\n}\n | program DRB050_functionparameter_orig_no\n use omp_lib\n use DRB050\n implicit none\n\n allocate (o1(100))\n allocate (c(100))\n\n call foo1(o1, c, 100)\nend program |
#include <stdlib.h>\n#include <stdio.h>\n\nint main(int argc, char* argv[])\n{\n int i;\n int len=100;\n\n if (argc>1)\n len = atoi(argv[1]);\n\n int a[len];\n for (i=0;i<len;i++)\n a[i]=i;\n\n#pragma omp parallel for\n for (i=0;i<len-1;i++)\n a[i+1]=a[i]+1;\n\n return 0;\n}\n | program DRB030_truedep1_var_yes\n use omp_lib\n implicit none\n\n integer :: i, len, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n integer, dimension(:), allocatable :: a\n\n len = 100\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n allocate (a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n !$omp parallel do\n do i = 1, len-1\n a(i+1) = a(i)+1\n end do\n !$omp end parallel do\n\n print 100, a(50)\n 100 format ('a(50)=',i3)\n\n deallocate(args,a)\nend program |
#include <stdio.h>\n#include <stdlib.h>\n#include <stdio.h>\n\nint main (int argc, char **argv)\n{\n int init, local;\n\n #pragma omp parallel shared(init) private(local)\n {\n #pragma omp master\n {\n init = 10;\n }\n\n local = init;\n }\n\n return 0;\n}\n\n\n | program DRB124_master_orig_yes\n use omp_lib\n implicit none\n\n integer :: init, local\n\n !$omp parallel shared(init) private(local)\n !$omp master\n init = 10\n !$omp end master\n local = init\n !$omp end parallel\n\nend program |
#include <stdio.h>\n#include <omp.h>\n#define N 100\n\nint main(){\n omp_lock_t lck;\n int var=0;\n omp_init_lock(&lck);\n\n #pragma omp target map(tofrom:var) device(0)\n #pragma omp teams num_teams(1)\n #pragma omp distribute parallel for\n for (int i=0; i<N; i++){\n omp_set_lock(&lck);\n var++;\n omp_unset_lock(&lck);\n }\n\n omp_destroy_lock(&lck);\n printf("%d\n",var);\n return 0;\n}\n | program DRB152_missinglock2_orig_gpu_no\n use omp_lib\n implicit none\n\n integer (kind=omp_lock_kind) :: lck\n integer :: var, i\n var = 0\n\n !$omp target map(tofrom:var) device(0)\n !$omp teams num_teams(1)\n !$omp distribute parallel do\n do i = 1, 100\n call omp_set_lock(lck)\n var = var+1\n call omp_unset_lock(lck)\n end do\n !$omp end distribute parallel do\n !$omp end teams\n !$omp end target\nend program |
#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#define N 180\nint indexSet[N] = {\n521, 523, 525, 527, 529, 533, // 521+12=533\n547, 549, 551, 553, 555, 557,\n573, 575, 577, 579, 581, 583,\n599, 601, 603, 605, 607, 609,\n625, 627, 629, 631, 633, 635,\n\n651, 653, 655, 657, 659, 661,\n859, 861, 863, 865, 867, 869,\n885, 887, 889, 891, 893, 895,\n911, 913, 915, 917, 919, 921, \n937, 939, 941, 943, 945, 947,\n\n963, 965, 967, 969, 971, 973,\n989, 991, 993, 995, 997, 999, \n1197, 1199, 1201, 1203, 1205, 1207,\n1223, 1225, 1227, 1229, 1231, 1233,\n1249, 1251, 1253, 1255, 1257, 1259,\n\n1275, 1277, 1279, 1281, 1283, 1285,\n1301, 1303, 1305, 1307, 1309, 1311,\n1327, 1329, 1331, 1333, 1335, 1337,\n1535, 1537, 1539, 1541, 1543, 1545,\n1561, 1563, 1565, 1567, 1569, 1571,\n\n1587, 1589, 1591, 1593, 1595, 1597,\n1613, 1615, 1617, 1619, 1621, 1623,\n1639, 1641, 1643, 1645, 1647, 1649,\n1665, 1667, 1669, 1671, 1673, 1675,\n1873, 1875, 1877, 1879, 1881, 1883,\n\n1899, 1901, 1903, 1905, 1907, 1909,\n1925, 1927, 1929, 1931, 1933, 1935,\n1951, 1953, 1955, 1957, 1959, 1961,\n1977, 1979, 1981, 1983, 1985, 1987,\n2003, 2005, 2007, 2009, 2011, 2013};\n\nint main (int argc, char* argv[])\n{\n double * base = (double*) malloc(sizeof(double)* (2013+12+1));\n\n if (base == 0)\n {\n printf ("Error in malloc(). Aborting ...\n");\n return 1; \n }\n double * xa1 = base;\n double * xa2 = xa1 + 12;\n int i;\n\n // initialize segments touched by indexSet\n for (i =521; i<= 2025; ++i)\n {\n base[i]=0.5*i;\n }\n\n#pragma omp parallel for // default static even scheduling may not trigger data race!\n for (i =0; i< N; ++i) \n {\n int idx = indexSet[i];\n xa1[idx]+= 1.0;\n xa2[idx]+= 3.0;\n }\n printf("x1[999]=%f xa2[1285]=%f\n", xa1[999], xa2[1285]);\n free (base);\n return 0;\n}\n\n | program DRB006_indirectaccess2_orig_yes\n use omp_lib\n use DRB006\n implicit none\n\n integer :: i, idx1, idx2\n integer, parameter :: dp = kind(1.0d0)\n real(dp), dimension(:), pointer :: xa1=>NULL(), xa2=>NULL()\n real(dp), dimension(2025), target :: base\n\n allocate (xa1(2025))\n allocate (xa2(2025))\n\n xa1 => base(1:2025)\n xa2 => base(1:2025)\n\n n=180\n\n indexSet = (/ 521, 523, 525, 527, 529, 531, 547, 549, &\n 551, 553, 555, 557, 573, 575, 577, 579, 581, 583, 599, &\n 601, 603, 605, 607, 609, 625, 627, 629, 631, 633, 635, &\n 651, 653, 655, 657, 659, 661, 859, 861, 863, 865, 867, &\n 869, 885, 887, 889, 891, 893, 895, 911, 913, 915, 917, &\n 919, 921, 937, 939, 941, 943, 945, 947, 963, 965, 967, &\n 969, 971, 973, 989, 991, 993, 995, 997, 999, 1197, 1199, &\n 1201, 1203, 1205, 1207, 1223, 1225, 1227, 1229, 1231, &\n 1233, 1249, 1251, 1253, 1255, 1257, 1259, 1275, 1277, &\n 1279, 1281, 1283, 1285, 1301, 1303, 1305, 1307, 1309, &\n 1311, 1327, 1329, 1331, 1333, 1335, 1337, 1535, 1537, &\n 1539, 1541, 1543, 1545, 1561, 1563, 1565, 1567, 1569, &\n 1571, 1587, 1589, 1591, 1593, 1595, 1597, 1613, 1615, &\n 1617, 1619, 1621, 1623, 1639, 1641, 1643, 1645, 1647, &\n 1649, 1665, 1667, 1669, 1671, 1673, 1675, 1873, 1875, &\n 1877, 1879, 1881, 1883, 1899, 1901, 1903, 1905, 1907, &\n 1909, 1925, 1927, 1929, 1931, 1933, 1935, 1951, 1953, &\n 1955, 1957, 1959, 1961, 1977, 1979, 1981, 1983, 1985, &\n 1987, 2003, 2005, 2007, 2009, 2011, 2013 /)\n\n do i = 521, 2025\n base(i) = 0.5*i\n end do\n\n !$omp parallel do\n do i = 1, n\n idx1 = indexSet(i)\n idx2 = indexSet(i)+12\n base(idx1) = base(idx1)+1.0\n base(idx2) = base(idx2)+3.0\n end do\n !$omp end parallel do\n\n print*,'xa1(999) =',base(999),' xa2(1285) =',base(1285)\n \n nullify(xa1,xa2)\nend program |
#include <stdlib.h>\nint main(int argc, char* argv[]) \n{\n int i,j;\n int len = 1000;\n if (argc>1)\n len = atoi(argv[1]);\n\n int n=len, m=len;\n double b[n][m];\n\n for (i=0;i<n;i++)\n#pragma omp parallel for\n for (j=1;j<m;j++)\n b[i][j]=b[i][j-1];\n\n return 0;\n}\n\n | program DRB038_truedepseconddimension_var_yes\n use omp_lib\n implicit none\n\n integer i, j, n, m, len, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n real, dimension(:,:), allocatable :: b\n\n len = 1000\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n n = len\n m = len\n\n allocate (b(len,len))\n\n do i = 1, n\n !$omp parallel do\n do j = 2, m\n b(i,j) = b(i,j-1)\n end do\n !$omp end parallel do\n end do\n! print 100, b(5,5)\n! 100 format ('b(5,5) =', F20.6)\n\n deallocate(args,b)\nend program |
#include <stdio.h>\n#include <omp.h>\n\nint main(){\n\n int i, m=1, n=4;\n int b[4] = {};\n\n #pragma omp simd safelen(2)\n for (i = m; i<n; i++)\n b[i] = b[i-m] - 1.0f;\n\n printf("Expected: -1; Real: %d\n",b[3]);\n return 0;\n}\n | program DRB137_simdsafelen_orig_no\n use omp_lib\n implicit none\n\n integer :: i, m, n\n real :: b(4)\n\n m = 1\n n = 4\n\n !$omp simd safelen(2)\n do i = m+1, n\n b(i) = b(i-m) - 1.0\n end do\n\n print*, b(3)\nend program |
#include <omp.h>\n#include <stdio.h>\n\nint tp;\n#pragma omp threadprivate(tp)\nint var;\n\nint main(){\n #pragma omp task\n {\n #pragma omp task\n {\n tp = 1;\n #pragma omp task\n {\n }\n var = tp;\n }\n tp=2;\n }\n\n if(var==2) printf("%d\n",var);\n return 0;\n}\n | module DRB127\ninteger :: tp, var\n!$omp threadprivate(tp)\ncontains\nsubroutine foo\n!$omp task\n!$omp task\ntp = 1\n!$omp task\n!$omp end task\nvar = tp ! value of var can be 1 or 2\n!$omp end task\ntp = 2\n!$omp end task\nend subroutine\nend module program DRB127_tasking_threadprivate1_orig_no\n use omp_lib\n use DRB127\n implicit none\n\n call foo()\n\nend program |
#include <stdio.h>\n#include <omp.h>\n\nint main(){\n int a, i;\n\n #pragma omp parallel shared(a) private(i)\n {\n #pragma omp master\n a = 0;\n\n #pragma omp for reduction(+:a)\n for (i=0; i<10; i++){\n a = a + i;\n }\n\n #pragma omp single\n printf("Sum is %d\n", a);\n }\n\n return 0;\n}\n | program DRB140_reduction_barrier_orig_yes\n use omp_lib\n implicit none\n\n integer :: a, i\n\n !$omp parallel shared(a) private(i)\n !$omp master\n a = 0\n !$omp end master\n\n !$omp do reduction(+:a)\n do i = 1, 10\n a = a+i\n end do\n !$omp end do\n\n !$omp single\n print*, "Sum is ", A\n !$omp end single\n\n !$omp end parallel\nend program |
#include <stdlib.h>\nint main(int argc, char* argv[])\n{ \n int i;\n int len = 1000;\n\n if (argc>1)\n len = atoi(argv[1]);\n\n int a[len];\n\n for (i=0; i<len; i++)\n a[i]= i; \n\n#pragma omp parallel for\n for (i=0;i< len -1 ;i++)\n a[i]=a[i+1]+1;\n\n return 0;\n} \n | program DRB002_antidep1_var_yes\n use omp_lib\n implicit none\n integer :: i, len, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n integer, dimension (:), allocatable :: a\n len = 1000\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n allocate (a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n !$omp parallel do\n do i = 1, len-1\n a(i) = a(i+1)+1\n end do\n !$omp end parallel do\n\n deallocate(a)\n deallocate(args)\n\nend program |
#include <stdio.h>\n/*\nTwo-dimensional array computation using loops: missing private(j).\nReferences to j in the loop cause data races.\nData race pairs (we allow multiple ones to preserve the pattern):\n Write_set = {j@61:10, j@61:20}\n Read_set = {j@62:20, j@62:12, j@61:14, j@61:20}\n Any pair from Write_set vs. Write_set and Write_set vs. Read_set is a data race pair.\n*/\nint a[100][100];\nint main()\n{\n int i,j;\n#pragma omp parallel for\n for (i=0;i<100;i++)\n for (j=0;j<100;j++)\n a[i][j]=a[i][j]+1;\n return 0;\n}\n\n | program DRB073_doall2_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, j, len\n integer, dimension(:,:), allocatable :: a\n len = 100\n\n allocate (a(len,len))\n\n !$omp parallel do\n do i = 1, 100\n do j = 1, 100\n a(i,j) = a(i,j)+1\n end do\n end do\n !$omp end parallel do\n\n\n deallocate(a)\nend program |
#include <stdio.h>\n#include <omp.h>\n\nint main(){\n int a, i;\n\n #pragma omp parallel shared(a) private(i)\n {\n #pragma omp master\n a = 0;\n\n #pragma omp barrier\n\n #pragma omp for reduction(+:a)\n for (i=0; i<10; i++){\n a += i;\n }\n\n #pragma omp single\n printf("Sum is %d\n", a);\n }\n\n return 0;\n}\n | program DRB141_reduction_barrier_orig_no\n use omp_lib\n implicit none\n\n integer :: a, i\n\n !$omp parallel shared(a) private(i)\n !$omp master\n a = 0\n !$omp end master\n \n !$omp barrier \n\n !$omp do reduction(+:a)\n do i = 1, 10\n a = a+i\n end do\n !$omp end do\n\n !$omp single\n print*, "Sum is ", A\n !$omp end single\n\n !$omp end parallel\nend program |
#include <stdlib.h>\n#include <stdio.h>\nint main(int argc, char* argv[])\n{\n int i,j;\n int n=1000, m=1000;\n double b[1000][1000];\n\n for (i=0; i<n; i++)\n for (j=0; j<m; j++)\n b[i][j] = 0.5; \n\n#pragma omp parallel for private(j)\n for (i=1;i<n;i++)\n for (j=1;j<m;j++)\n b[i][j]=b[i-1][j-1];\n\n printf("b[500][500]=%f\n", b[500][500]); \n return 0;\n}\n | program DRB031_truedepfirstdimension_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, j, n, m\n real, dimension(:,:), allocatable :: b\n\n n = 1000\n m = 1000\n allocate (b(n,m))\n\n do i = 1, n\n do j = 1, m\n b(i,j) = 0.5\n end do\n end do\n\n !$omp parallel do private(j)\n do i = 2, n\n do j = 2, m\n b(i,j) = b(i-1, j-1)\n end do\n end do\n !$omp end parallel do\n\n print 100, b(500,500)\n 100 format ('b(500,500) =',F10.6)\n\n deallocate(b)\nend program |
#include <stdio.h>\n\n/*\nuse of omp target + teams \nWithout protection, master threads from two teams cause data races.\nData race pair: a@66:5:W vs. a@66:5:W\n*/\nint main(int argc, char* argv[])\n{\n int i;\n int len = 100;\n double a[len];\n\n /*Initialize with some values*/\n for (i=0; i<len; i++)\n a[i]= ((double)i)/2.0;\n\n#pragma omp target map(tofrom: a[0:len]) \n#pragma omp teams num_teams(2) \n {\n a[50]*=2.0;\n }\n\n printf ("a[50]=%f\n", a[50]);\n return 0;\n}\n | program DRB116_target_teams_orig_yes\n use omp_lib\n implicit none\n\n integer i, len\n integer, parameter :: dp = kind(1.0d0)\n real(dp), dimension(:), allocatable :: a\n\n len = 100\n allocate (a(len))\n\n do i = 1, len\n a(i) = (real(i,dp))/2.0\n end do\n\n !$omp target map(tofrom: a(0:len))\n !$omp teams num_teams(2)\n a(50) = a(50)*2.0\n !$omp end teams\n !$omp end target\n\n print*,'a(50)=',a(50)\n\n deallocate(a)\nend program |
#include <stdio.h>\n#include <stdlib.h>\n#include <omp.h>\n#define C 100\n\nint *a;\nint *b;\nint *c;\n\nint main(){\n a = malloc(C*sizeof(int));\n b = malloc(C*C*sizeof(int));\n c = malloc(C*sizeof(int));\n\n for(int i=0; i<C; i++){\n for(int j=0; j<C; j++){\n b[j+i*C]=1;\n }\n a[i]=1;\n c[i]=0;\n }\n\n #pragma omp target map(to:a[0:C],b[0:C*C]) map(tofrom:c[0:C]) device(0)\n {\n #pragma omp teams distribute parallel for\n for(int i=0; i<C; i++){\n for(int j=0; j<C; j++){\n c[i]+=b[j+i*C]*a[j];\n }\n }\n }\n\n for(int i=0; i<C; i++){\n if(c[i]!=C){\n printf("Data Race\n");\n return 1;\n }\n }\n\n free(a);\n free(b);\n free(c);\n\n return 0;\n}\n | program DRB149_missingdata1_orig_gpu_no\n use omp_lib\n implicit none\n\n integer :: len, i, j\n integer, dimension(:), allocatable :: a, b, c\n\n len = 100\n\n allocate (a(len))\n allocate (b(len+len*len))\n allocate (c(len))\n\n do i = 1, len\n do j = 1, len\n b(j+i*len)=1\n end do\n a(i) = 1\n c(i) = 0\n end do\n\n !$omp target map(to:a,b) map(tofrom:c) device(0)\n !$omp teams distribute parallel do\n do i = 1, len\n do j = 1, len\n c(i) = c(i)+a(j)*b(j+i*len)\n end do\n end do\n !$omp end teams distribute parallel do\n !$omp end target\n\n do i = 1, len\n if (c(i)/=len) then\n print*, c(i)\n end if\n end do\n\n deallocate(a,b,c)\nend program |
#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 parallel for reduction(+:var)\n for (int i=0; i<N; i++){\n var++;\n }\n\n printf("%d\n",var);\n return 0;\n}\n | program DRB145_atomiccritical_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 parallel do reduction(+:var)\n do i = 1, 200\n if (var<101) then\n var = var+1\n end if\n end do\n !$omp end teams distribute parallel do\n !$omp end target\n\nend program |
#include <stdio.h>\n#include <omp.h>\n\nint main(){\n\n int i = 1;\n\n #pragma omp parallel sections\n {\n #pragma omp section\n {\n #pragma omp critical (name)\n {\n #pragma omp parallel\n {\n #pragma omp single\n {\n i++;\n }\n }\n }\n }\n }\n\n printf("%d\n",i);\n return 0;\n}\n | program DRB139_worksharingcritical_orig_no\n use omp_lib\n implicit none\n\n integer :: i\n i = 1\n\n !$OMP PARALLEL SECTIONS\n !$OMP SECTION\n !$OMP CRITICAL (NAME)\n !$OMP PARALLEL\n !$OMP SINGLE\n i = i + 1\n !$OMP END SINGLE\n !$OMP END PARALLEL\n !$OMP END CRITICAL (NAME)\n !$OMP END PARALLEL SECTIONS\n\n print 100,i\n 100 format ("i = ", 3i8)\nend program |
#include <stdio.h>\n#include <omp.h>\n\nint main(){\n int a, b, c, d;\n\n #pragma omp parallel\n #pragma omp single\n {\n #pragma omp task depend(out: c)\n c = 1;\n #pragma omp task depend(out: a)\n a = 2;\n #pragma omp task depend(out: b)\n b = 3;\n #pragma omp task depend(in: a)\n c += a;\n #pragma omp task depend(in: b)\n c += b;\n #pragma omp task depend(in: c)\n d = c;\n }\n\n printf("%d\n",d);\n return 0;\n}\n | program DRB135_taskdep_mutexinoutset_orig_no_omp50\n use omp_lib\n implicit none\n\n integer :: a, b, c, d\n\n !$omp parallel\n !$omp single\n !$omp task depend(out: c)\n c = 1 ! Task T1\n !$omp end task\n !$omp task depend(out: a)\n a = 2 ! Task T2\n !$omp end task\n !$omp task depend(out: b)\n b = 3 ! Task T3\n !$omp end task\n !$omp task depend(in: a)\n c = c + a ! Task T4\n !$omp end task\n !$omp task depend(in: b) \n c = c + b ! Task T5\n !$omp end task\n !$omp task depend(in: c)\n d = c ! Task T6\n !$omp end task\n !$omp end single\n !$omp end parallel\n\n print *, d\nend program |
#include <stdio.h> \nint main(int argc, char* argv[])\n{\n int i;\n int len = 1000;\n int a[1000];\n\n for (i=0; i<len; i++)\n a[i]= i;\n\n#pragma omp target map(a[0:len])\n#pragma omp parallel for\n for (i=0;i< len -1 ;i++)\n a[i]=a[i+1]+1;\n\n return 0;\n}\n | program DRB026_targetparallelfor_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, len\n integer, dimension(:), allocatable :: a\n\n len = 1000\n\n allocate (a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n !$omp target map(a)\n !$omp parallel do\n do i = 1, len-1\n a(i) = a(i+1) + 1\n end do\n !$omp end parallel do\n !$omp end target\n\n do i = 1, len\n write(6,*) 'Values for i and a(i) are:', i, a(i)\n end do\n\n deallocate(a)\nend program |
#include <string.h>\nint main(int argc,char *argv[])\n{\n int i;\n int j;\n double a[20][20];\n memset(a,0,(sizeof(a)));\n\n for (i = 0; i < 20 -1; i += 1) {\n#pragma omp parallel for\n for (j = 0; j < 20; j += 1) {\n a[i][j] += a[i + 1][j];\n }\n }\n return 0;\n}\n | program DRB053_inneronly1_orig_no\n use omp_lib\n implicit none\n\n integer :: i, j\n\n real, dimension(:,:), allocatable :: a\n allocate (a(20,20))\n\n do i = 1, 20\n do j = 1, 20\n a(i,j) = 0.0\n end do\n end do\n\n do i = 1, 19\n !$omp parallel do\n do j = 1, 20\n a(i,j) = a(i,j)+a(i+1,j)\n end do\n !$omp end parallel do\n end do\n\n deallocate(a)\nend program |
#include <stdio.h>\nint a[100], b[100], c[100];\nint main()\n{\n int i;\n#pragma omp simd\n for (i=0;i<100;i++)\n a[i]=b[i]*c[i];\n return 0;\n}\n | program DRB070_simd1_orig_no\n use omp_lib\n implicit none\n\n integer :: len, i\n integer, dimension(:), allocatable :: a, b, c\n len = 100\n allocate (a(len))\n allocate (b(len))\n allocate (c(len))\n\n !$omp simd\n do i = 1, len\n a(i) = b(i) + c(i)\n end do\n !$omp end simd\n\n deallocate(a,b,c)\nend program |
#include <stdio.h>\n#include <stdlib.h>\nint main(int argc, char* argv[])\n{\n int i,x;\n int len = 10000;\n if (argc>1)\n len = atoi(argv[1]);\n\n#pragma omp parallel for private (i) \n for (i=0;i<len;i++)\n x=i;\n printf("x=%d",x);\n return 0;\n}\n\n | program DRB010_lastprivatemissing_var_yes\n use omp_lib\n implicit none\n\n integer :: i, len, argCount, allocStatus, rdErr, x, ix\n character(len=80), dimension(:), allocatable :: args\n len = 10000\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n !$omp parallel do private(i)\n do i = 0, len\n x = i\n end do\n !$omp end parallel do\n write(*,*) 'x =', x\n\n deallocate(args)\nend program |
#include <stdio.h>\n#include <omp.h>\n\nint main(){\n omp_lock_t lck;\n int var = 0;\n omp_init_lock(&lck);\n\n #pragma omp target map(tofrom:var) device(0)\n #pragma omp teams distribute reduction(+:var)\n for (int i=0; i<100; i++){\n omp_set_lock(&lck);\n var++;\n omp_unset_lock(&lck);\n }\n\n omp_destroy_lock(&lck);\n printf("%d\n ",var);\n return 0;\n}\n | program DRB154_missinglock3_orig_gpu_no\n use omp_lib\n implicit none\n\n integer (kind=omp_lock_kind) :: lck\n integer :: var, i\n var = 0\n\n call omp_init_lock (lck)\n\n !$omp target map(tofrom:var) device(0)\n !$omp teams distribute reduction(+:var)\n do i = 1, 100\n call omp_set_lock(lck)\n var = var+1\n call omp_unset_lock(lck)\n end do\n !$omp end teams distribute\n !$omp end target\n\n call omp_destroy_lock(lck)\n\n print*, var\nend program |
#include <stdio.h>\nint a[100][100];\nint main()\n{\n int i,j;\n#pragma omp parallel for private(j)\n for (i=0;i<100;i++)\n for (j=0;j<100;j++)\n a[i][j]=a[i][j]+1;\n return 0;\n}\n\n | program DRB046_doall2_orig_no\n use omp_lib\n implicit none\n\n integer :: i, j\n integer :: a(100,100)\n\n !$omp parallel do private(j)\n do i = 1, 100\n do j = 1, 100\n a(i,j) = a(i,j)+1\n end do\n end do\n !$omp end parallel do\nend program |
#include <stdlib.h>\n#include <stdio.h>\n\nint main(int argc, char* argv[])\n{ \n int i; \n int tmp;\n tmp = 10;\n int len=100;\n\n int a[100];\n\n#pragma omp parallel for\n for (i=0;i<len;i++)\n { \n a[i] = tmp;\n tmp =a[i]+i;\n }\n\n printf("a[50]=%d\n", a[50]);\n return 0; \n}\n\n | program DRB035_truedepscalar_orig_yes\n use omp_lib\n implicit none\n\n integer i, tmp, len\n integer, dimension(:), allocatable :: a\n\n len = 100\n tmp = 10\n allocate (a(len))\n\n !$omp parallel do\n do i = 1, len\n a(i) = tmp\n tmp = a(i) + i\n end do\n !$omp end parallel do\n\n print 100, a(50)\n 100 format ('a(50) =',i3)\n\n deallocate(a)\nend program |
#include <stdlib.h>\n#include <stdio.h>\nint input[1000]; \nint output[1000];\n\nint main()\n{\n int i ;\n int inLen=1000 ; \n int outLen = 0;\n\n for (i=0; i<inLen; ++i) \n input[i]= i; \n\n#pragma omp parallel for\n for (i=0; i<inLen; ++i) \n {\n output[outLen++] = input[i] ;\n } \n\n printf("output[500]=%d\n",output[500]);\n\n return 0;\n}\n | program DRB018_plusplus_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, inLen, outLen\n integer :: input(1000)\n integer :: output(1000)\n\n inLen = 1000\n outLen = 1\n\n do i = 1, inLen\n input(i) = i\n end do\n\n !$omp parallel do\n do i = 1, inLen\n output(outLen) = input(i)\n outLen = outLen + 1\n end do\n !$omp end parallel do\n\n print 100, output(500)\n 100 format ("output(500)=",i3)\nend program |
#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#define N 180\nint indexSet[N] = {\n521, 523, 525, 527, 529, 531,\n547, 549, 551, 553, 555, 557,\n573, 575, 577, 579, 581, 583,\n599, 601, 603, 605, 607, 609,\n625, 627, 629, 631, 633, 635,\n\n651, 653, 655, 657, 659, 661,\n859, 861, 863, 865, 867, 869,\n885, 887, 889, 891, 893, 895,\n911, 913, 915, 917, 919, 923, // change original 921 to 923 = 911+12\n937, 939, 941, 943, 945, 947,\n\n963, 965, 967, 969, 971, 973,\n989, 991, 993, 995, 997, 999, \n1197, 1199, 1201, 1203, 1205, 1207,\n1223, 1225, 1227, 1229, 1231, 1233,\n1249, 1251, 1253, 1255, 1257, 1259,\n\n1275, 1277, 1279, 1281, 1283, 1285,\n1301, 1303, 1305, 1307, 1309, 1311,\n1327, 1329, 1331, 1333, 1335, 1337,\n1535, 1537, 1539, 1541, 1543, 1545,\n1561, 1563, 1565, 1567, 1569, 1571,\n\n1587, 1589, 1591, 1593, 1595, 1597,\n1613, 1615, 1617, 1619, 1621, 1623,\n1639, 1641, 1643, 1645, 1647, 1649,\n1665, 1667, 1669, 1671, 1673, 1675,\n1873, 1875, 1877, 1879, 1881, 1883,\n\n1899, 1901, 1903, 1905, 1907, 1909,\n1925, 1927, 1929, 1931, 1933, 1935,\n1951, 1953, 1955, 1957, 1959, 1961,\n1977, 1979, 1981, 1983, 1985, 1987,\n2003, 2005, 2007, 2009, 2011, 2013};\n\nint main (int argc, char* argv[])\n{\n // max index value is 2013. +12 to obtain a valid xa2[idx] after xa1+12.\n // +1 to ensure a reference like base[2015] is within the bound.\n double * base = (double*) malloc(sizeof(double)* (2013+12+1));\n if (base == 0)\n {\n printf ("Error in malloc(). Aborting ...\n");\n return 1; \n }\n\n double * xa1 = base;\n double * xa2 = xa1 + 12;\n int i;\n\n // initialize segments touched by indexSet\n for (i =521; i<= 2025; ++i)\n {\n base[i]=0.5*i;\n }\n// default static even scheduling may not trigger data race, using static,1 instead.\n#pragma omp parallel for schedule(static,1)\n for (i =0; i< N; ++i) \n {\n int idx = indexSet[i];\n xa1[idx]+= 1.0 + i;\n xa2[idx]+= 3.0 + i;\n }\n\n printf("x1[999]=%f xa2[1285]=%f\n", xa1[999], xa2[1285]);\n free (base);\n return 0;\n}\n\n | module DRB005\n implicit none\n\n integer, dimension(180) :: indexSet\n integer :: n\n\nend module\n\n\nprogram DRB005_indirectaccess1_orig_yes\n use omp_lib\n use DRB005\n implicit none\n\n integer :: i, idx1, idx2\n integer, parameter :: dp = kind(1.0d0)\n real(dp), dimension(:), pointer :: xa1=>NULL(), xa2=>NULL()\n real(dp), dimension(2025), target :: base\n\n allocate (xa1(2025))\n allocate (xa2(2025))\n\n xa1 => base(1:2025)\n xa2 => base(1:2025)\n\n n=180\n\n indexSet = (/ 521, 523, 525, 527, 529, 531, 547, 549, &\n 551, 553, 555, 557, 573, 575, 577, 579, 581, 583, 599, &\n 601, 603, 605, 607, 609, 625, 627, 629, 631, 633, 635, &\n 651, 653, 655, 657, 659, 661, 859, 861, 863, 865, 867, &\n 869, 885, 887, 889, 891, 893, 895, 911, 913, 915, 917, &\n 919, 921, 937, 939, 941, 943, 945, 947, 963, 965, 967, &\n 969, 971, 973, 989, 991, 993, 995, 997, 999, 1197, 1199, &\n 1201, 1203, 1205, 1207, 1223, 1225, 1227, 1229, 1231, &\n 1233, 1249, 1251, 1253, 1255, 1257, 1259, 1275, 1277, &\n 1279, 1281, 1283, 1285, 1301, 1303, 1305, 1307, 1309, &\n 1311, 1327, 1329, 1331, 1333, 1335, 1337, 1535, 1537, &\n 1539, 1541, 1543, 1545, 1561, 1563, 1565, 1567, 1569, &\n 1571, 1587, 1589, 1591, 1593, 1595, 1597, 1613, 1615, &\n 1617, 1619, 1621, 1623, 1639, 1641, 1643, 1645, 1647, &\n 1649, 1665, 1667, 1669, 1671, 1673, 1675, 1873, 1875, &\n 1877, 1879, 1881, 1883, 1899, 1901, 1903, 1905, 1907, &\n 1909, 1925, 1927, 1929, 1931, 1933, 1935, 1951, 1953, &\n 1955, 1957, 1959, 1961, 1977, 1979, 1981, 1983, 1985, &\n 1987, 2003, 2005, 2007, 2009, 2011, 2013 /)\n\n do i = 521, 2025\n base(i) = 0.5*i\n end do\n\n !$omp parallel do schedule(static,1)\n do i = 1, n\n idx1 = indexSet(i)\n idx2 = indexSet(i)+12\n base(idx1) = base(idx1)+1.0\n base(idx2) = base(idx2)+3.0\n end do\n !$omp end parallel do\n\n print*,'xa1(999) =',base(999),' xa2(1285) =',base(1285)\n\n nullify(xa1,xa2)\nend program |
#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#define N 180\nint indexSet[N] = {\n521, 533, 525, 527, 529, 531, // 521+12=533\n547, 549, 551, 553, 555, 557,\n573, 575, 577, 579, 581, 583,\n599, 601, 603, 605, 607, 609,\n625, 627, 629, 631, 633, 635,\n\n651, 653, 655, 657, 659, 661,\n859, 861, 863, 865, 867, 869,\n885, 887, 889, 891, 893, 895,\n911, 913, 915, 917, 919, 921, \n937, 939, 941, 943, 945, 947,\n\n963, 965, 967, 969, 971, 973,\n989, 991, 993, 995, 997, 999, \n1197, 1199, 1201, 1203, 1205, 1207,\n1223, 1225, 1227, 1229, 1231, 1233,\n1249, 1251, 1253, 1255, 1257, 1259,\n\n1275, 1277, 1279, 1281, 1283, 1285,\n1301, 1303, 1305, 1307, 1309, 1311,\n1327, 1329, 1331, 1333, 1335, 1337,\n1535, 1537, 1539, 1541, 1543, 1545,\n1561, 1563, 1565, 1567, 1569, 1571,\n\n1587, 1589, 1591, 1593, 1595, 1597,\n1613, 1615, 1617, 1619, 1621, 1623,\n1639, 1641, 1643, 1645, 1647, 1649,\n1665, 1667, 1669, 1671, 1673, 1675,\n1873, 1875, 1877, 1879, 1881, 1883,\n\n1899, 1901, 1903, 1905, 1907, 1909,\n1925, 1927, 1929, 1931, 1933, 1935,\n1951, 1953, 1955, 1957, 1959, 1961,\n1977, 1979, 1981, 1983, 1985, 1987,\n2003, 2005, 2007, 2009, 2011, 2013};\n\nint main (int argc, char* argv[])\n{\n double * base = (double*) malloc(sizeof(double)* (2013+12+1));\n if (base == 0)\n {\n printf ("Error in malloc(). Aborting ...\n");\n return 1; \n }\n double * xa1 = base;\n double * xa2 = xa1 + 12;\n int i;\n\n // initialize segments touched by indexSet\n for (i =521; i<= 2025; ++i)\n {\n base[i]=0.5*i;\n }\n\n#pragma omp parallel for // default static even scheduling may not trigger data race!\n for (i =0; i< N; ++i) \n {\n int idx = indexSet[i];\n xa1[idx]+= 1.0;\n xa2[idx]+= 3.0;\n }\n printf("x1[999]=%f xa2[1285]=%f\n", xa1[999], xa2[1285]);\n free (base);\n return 0;\n}\n\n | program DRB008_indirectaccess4_orig_yes\n use omp_lib\n use DRB008\n implicit none\n\n integer :: i, idx1, idx2\n integer, parameter :: dp = kind(1.0d0)\n real(dp), dimension(:), pointer :: xa1=>NULL(), xa2=>NULL()\n real(dp), dimension(2025), target :: base\n\n allocate (xa1(2025))\n allocate (xa2(2025))\n\n xa1 => base(1:2025)\n xa2 => base(1:2025)\n\n n=180\n\n indexSet = (/ 521, 533, 525, 527, 529, 531, 547, 549, &\n 551, 553, 555, 557, 573, 575, 577, 579, 581, 583, 599, &\n 601, 603, 605, 607, 609, 625, 627, 629, 631, 633, 635, &\n 651, 653, 655, 657, 659, 661, 859, 861, 863, 865, 867, &\n 869, 885, 887, 889, 891, 893, 895, 911, 913, 915, 917, &\n 919, 921, 937, 939, 941, 943, 945, 947, 963, 965, 967, &\n 969, 971, 973, 989, 991, 993, 995, 997, 999, 1197, 1199, &\n 1201, 1203, 1205, 1207, 1223, 1225, 1227, 1229, 1231, &\n 1233, 1249, 1251, 1253, 1255, 1257, 1259, 1275, 1277, &\n 1279, 1281, 1283, 1285, 1301, 1303, 1305, 1307, 1309, &\n 1311, 1327, 1329, 1331, 1333, 1335, 1337, 1535, 1537, &\n 1539, 1541, 1543, 1545, 1561, 1563, 1565, 1567, 1569, &\n 1571, 1587, 1589, 1591, 1593, 1595, 1597, 1613, 1615, &\n 1617, 1619, 1621, 1623, 1639, 1641, 1643, 1645, 1647, &\n 1649, 1665, 1667, 1669, 1671, 1673, 1675, 1873, 1875, &\n 1877, 1879, 1881, 1883, 1899, 1901, 1903, 1905, 1907, &\n 1909, 1925, 1927, 1929, 1931, 1933, 1935, 1951, 1953, &\n 1955, 1957, 1959, 1961, 1977, 1979, 1981, 1983, 1985, &\n 1987, 2003, 2005, 2007, 2009, 2011, 2013 /)\n\n do i = 521, 2025\n base(i) = 0.5*i\n end do\n\n !$omp parallel do\n do i = 1, n\n idx1 = indexSet(i)\n idx2 = indexSet(i)+12\n base(idx1) = base(idx1)+1.0\n base(idx2) = base(idx2)+3.0\n end do\n !$omp end parallel do\n\n print*,'xa1(999) =',base(999),' xa2(1285) =',base(1285)\n\n nullify(xa1,xa2)\nend program |
#include <stdio.h>\n/* This is a program based on a test contributed by Yizi Gu@Rice Univ.\n * Missing the ordered clause\n * Data race pair: x@56:5:W vs. x@56:5:W\n * */\nint main()\n{\n int x =0;\n#pragma omp parallel for ordered \n for (int i = 0; i < 100; ++i) {\n x++;\n }\n printf ("x=%d\n",x);\n return 0;\n} \n | program DRB109_orderedmissing_orig_yes\n use omp_lib\n implicit none\n\n integer x,i\n\n !$omp parallel do ordered\n do i = 1, 100\n x = x+1\n end do\n !$omp end parallel do\n\n print*,'x =',x\n\nend program |
#include <stdio.h>\n#if (_OPENMP<201511)\n#error "An OpenMP 4.5 compiler is needed to compile this test."\n#endif\n#include <stdio.h>\nint main()\n{\n int len=100;\n double a[len], b[len], c[len];\n int i,j=0;\n\n for (i=0;i<len;i++)\n {\n a[i]=((double)i)/2.0; \n b[i]=((double)i)/3.0; \n c[i]=((double)i)/7.0; \n }\n\n#pragma omp parallel for linear(j)\n for (i=0;i<len;i++)\n {\n c[j]+=a[i]*b[i];\n j++;\n }\n\n printf ("c[50]=%f\n",c[50]);\n return 0;\n}\n | program DRB112_linear_orig_no\n use omp_lib\n implicit none\n\n integer len, i, j\n integer, parameter :: dp = kind(1.0d0)\n real(dp), dimension(:), allocatable :: a,b,c\n\n len = 100\n i = 0\n j = 0\n\n allocate (a(len))\n allocate (b(len))\n allocate (c(len))\n\n do i = 1, len\n a(i) = (real(i,dp))/2.0\n b(i) = (real(i,dp))/3.0\n c(i) = (real(i,dp))/7.0\n end do\n\n !$omp parallel do linear(j)\n do i = 1, len\n c(j) = c(j)+a(i)*b(i)\n j = j+1\n end do\n !$omp end parallel do\n\n !print*,'c(50) =',c(50)\n\n if(allocated(a))deallocate(a)\n if(allocated(b))deallocate(b)\nend program |
#include <omp.h>\n#include <stdio.h>\n\nint main(int argc, char* argv[])\n{\n int var = 0;\n\n #pragma omp parallel shared(var)\n {\n #pragma omp single\n var++;\n\n #pragma omp barrier\n\n #pragma omp single\n var++;\n }\n\n if(var != 2) printf("%d\n",var);\n int error = (var != 2);\n return error;\n}\n | program DRB120_barrier_orig_no\n use omp_lib\n implicit none\n\n integer :: var\n\n !$omp parallel shared(var)\n !$omp single\n var = var + 1;\n !$omp end single\n !$omp barrier\n\n !$omp single\n var = var + 1;\n !$omp end single\n !$omp end parallel\n\n print 100, var\n 100 format ('var =',i3)\nend program |
#include <stdio.h>\n\nint main(int argc,char *argv[])\n{\n int i, j;\n int len = 20; \n\n double a[20][20];\n\n for (i=0; i< len; i++)\n for (j=0; j<len; j++)\n a[i][j] = 0.5; \n\n#pragma omp parallel for private(j)\n for (i = 0; i < len - 1; i += 1) {\n for (j = 0; j < len ; j += 1) {\n a[i][j] += a[i + 1][j];\n }\n }\n\n printf ("a[10][10]=%f\n", a[10][10]);\n return 0;\n}\n\n | program DRB003_antidep2_orig_yes\n use omp_lib\n implicit none\n\n integer :: i, j, len\n real :: a(20,20)\n\n len = 20\n\n do i = 1, len\n do j = 1, len\n a(i,j) = 0.5\n end do\n end do\n\n !$omp parallel do private(j)\n do i = 1, len-1\n do j = 1, len\n a(i,j) = a(i,j) + a(i+1,j)\n end do\n end do\n !$omp end parallel do\n\n write(*,*) 'a(10,10) =', a(10,10)\n\nend program |
#include <assert.h> \n#include <unistd.h>\nint main()\n{\n int i=0;\n#pragma omp parallel\n#pragma omp single\n {\n#pragma omp task depend (out:i)\n {\n sleep(3);\n i = 1; \n }\n#pragma omp task depend (out:i)\n i = 2; \n }\n\n assert (i==2);\n return 0;\n} \n | program DRB078_taskdep2_orig_no\n use omp_lib\n implicit none\n\n integer :: i\n i = 0\n\n !$omp parallel\n !$omp single\n !$omp task depend (out:i)\n call sleep(3)\n i=3\n !$omp end task\n !$omp task depend (out:i)\n i=2\n !$omp end task\n !$omp end single\n !$omp end parallel\n\n if (i /=2 ) then\n print 100, i\n 100 format (i3)\n end if\nend program |
#include <omp.h>\n#include <stdio.h>\n\nint main(){\n\n omp_lock_t lck;\n int var=0,i;\n omp_init_lock(&lck);\n\n #pragma omp target map(tofrom:var) device(0)\n #pragma omp teams distribute parallel for\n for (int i=0; i<100; i++){\n omp_set_lock(&lck);\n var++;\n omp_unset_lock(&lck);\n }\n\n omp_destroy_lock(&lck);\n\n printf("%d\n",var);\n return 0;\n}\n | program DRB150_missinglock1_orig_gpu_yes\n use omp_lib\n implicit none\n\n integer :: var, i\n integer (kind=omp_lock_kind) :: lck\n call omp_init_lock (lck)\n\n !$omp target map(tofrom:var) device(0)\n !$omp teams distribute parallel do\n do i = 1, 10\n call omp_set_lock(lck)\n var = var+1\n call omp_unset_lock(lck)\n end do\n !$omp end teams distribute parallel do\n !$omp end target\n\n call omp_destroy_lock(lck)\n\n print*, var\nend program |
#include <stdio.h>\n#define N 20\n#define C 8\n\nint main(){\n int var[C];\n\n for(int i=0; i<C; i++){\n var[i] = 0;\n }\n\n #pragma omp target map(tofrom:var) device(0)\n #pragma omp teams num_teams(1) thread_limit(1048) \n #pragma omp distribute parallel for \n for (int i=0; i<N; i++){\n #pragma omp simd\n for(int i=0; i<C; i++){\n var[i]++;\n }\n }\n\n for(int i=0; i<C; i++){\n if(var[i]!=N) printf("%d\n ",var[i]);\n }\n\n return 0;\n}\n | program DRB161_nolocksimd_orig_gpu_yes\n use omp_lib\n implicit none\n\n integer :: var(8)\n integer :: i, j\n\n do i = 1, 8\n var(i) = 0\n end do\n\n !$omp target map(tofrom:var) device(0)\n !$omp teams num_teams(1) thread_limit(1048)\n !$omp distribute parallel do\n do i = 1, 20\n !$omp simd\n do j = 1, 8\n var(j) = var(j)+1\n end do\n !$omp end simd\n end do\n !$omp end distribute parallel do\n !$omp end teams\n !$omp end target\n\n print*,var(8)\nend program |
#include <stdlib.h>\nint main(int argc, char* argv[])\n{\n int i,j;\n int len = 1000;\n if (argc>1)\n len = atoi(argv[1]);\n\n int n=len, m=len;\n double b[len][len];\n\n for (i=0; i<n; i++)\n for (j=0; j<m; j++)\n b[i][j] = 0.5; \n\n#pragma omp parallel for private(j)\n for (i=1;i<n;i++)\n for (j=1;j<m;j++)\n b[i][j]=b[i-1][j-1];\n\n return 0;\n}\n | program DRB032_truedepfirstdimension_var_yes\n use omp_lib\n implicit none\n\n integer :: i, j, n, m, len, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n real, dimension(:,:), allocatable :: b\n\n len = 1000\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n n = len\n m = len\n allocate (b(n,m))\n\n do i = 1, n\n do j = 1, m\n b(i,j) = 0.5\n end do\n end do\n\n !$omp parallel do private(j)\n do i = 2, n\n do j = 2, m\n b(i,j) = b(i-1, j-1)\n end do\n end do\n !$omp end parallel do\n\n print 100, b(500,500)\n 100 format ('b(500,500) =',F10.6)\n\n\n deallocate(args,b)\nend program |
#include <stdio.h>\n#include <assert.h>\nint main()\n{\n int i,error;\n int len = 1000;\n int a[len], b=5;\n\n for (i=0; i<len; i++)\n a[i]= i;\n \n#pragma omp parallel shared(b, error) \n {\n#pragma omp for nowait\n for(i = 0; i < len; i++)\n a[i] = b + a[i]*5;\n\n#pragma omp barrier\n\n#pragma omp single\n error = a[9] + 1;\n }\n assert (error == 51);\n printf ("error = %d\n", error);\n return 0;\n} \n | program DRB104_nowait_barrier_orig_no\n use omp_lib\n implicit none\n\n integer i, error, len, b\n integer, dimension(:), allocatable :: a\n\n len = 1000\n b = 5\n allocate (a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n !$omp parallel shared(b, error)\n !$omp do\n do i = 1, len\n a(i) = b+a(i)*5\n end do\n !$omp end do nowait\n !$omp end parallel\n\n !$omp barrier\n !$omp single\n error = a(9)+1\n !$omp end single\n\n print 100, error\n 100 format ('error =',3i8)\n\n deallocate(a)\nend program |
#include <stdio.h>\n#include <math.h>\n\n#define MSIZE 200\nint n=MSIZE, m=MSIZE, mits=1000;\ndouble tol=0.0000000001, relax = 1.0, alpha = 0.0543;\ndouble u[MSIZE][MSIZE], f[MSIZE][MSIZE], uold[MSIZE][MSIZE];\ndouble dx, dy;\n\nvoid\ninitialize ()\n{\n int i, j, xx, yy;\n\n dx = 2.0 / (n - 1);\n dy = 2.0 / (m - 1);\n\n/* Initialize initial condition and RHS */\n//#pragma omp parallel for private(i,j,xx,yy)\n for (i = 0; i < n; i++)\n for (j = 0; j < m; j++)\n {\n xx = (int) (-1.0 + dx * (i - 1)); /* -1 < x < 1 */\n yy = (int) (-1.0 + dy * (j - 1)); /* -1 < y < 1 */\n u[i][j] = 0.0;\n f[i][j] = -1.0 * alpha * (1.0 - xx * xx) * (1.0 - yy * yy)\n - 2.0 * (1.0 - xx * xx) - 2.0 * (1.0 - yy * yy);\n\n }\n}\n\nvoid\njacobi ()\n{\n double omega;\n int i, j, k;\n double error, resid, ax, ay, b;\n\n omega = relax;\n/* Initialize coefficients */\n\n dx = 2.0 / (n - 1); \n dy = 2.0 / (m - 1);\n\n ax = 1.0 / (dx * dx); /* X-direction coef */\n ay = 1.0 / (dy * dy); /* Y-direction coef */\n b = -2.0 / (dx * dx) - 2.0 / (dy * dy) - alpha; /* Central coeff */\n\n error = 10.0 * tol;\n k = 1;\n\n while (k <= mits)\n {\n error = 0.0;\n\n/* Copy new solution into old */\n#pragma omp parallel\n {\n#pragma omp for private(i,j)\n for (i = 0; i < n; i++)\n for (j = 0; j < m; j++)\n uold[i][j] = u[i][j];\n#pragma omp for private(i,j,resid) reduction(+:error) nowait\n for (i = 1; i < (n - 1); i++)\n for (j = 1; j < (m - 1); j++)\n {\n resid = (ax * (uold[i - 1][j] + uold[i + 1][j])\n + ay * (uold[i][j - 1] + uold[i][j + 1]) +\n b * uold[i][j] - f[i][j]) / b;\n\n u[i][j] = uold[i][j] - omega * resid;\n error = error + resid * resid;\n }\n }\n/* omp end parallel */\n\n/* Error check */\n\n k = k + 1;\n error = sqrt (error) / (n * m);\n } /* End iteration loop */\n\n printf ("Total Number of Iterations:%d\n", k);\n printf ("Residual:%E\n", error);\n}\n\nint main()\n{\n initialize();\n jacobi();\n return 0;\n}\n | module DRB058\nuse omp_lib\nimplicit none\n\ninteger :: MSIZE\ninteger :: n,m,mits\ninteger, parameter :: dp = kind(1.0d0)\nreal(dp), dimension(:,:), pointer :: u,f,uold\nreal(dp) :: dx,dy,tol,relax,alpha\n\ncontains\nsubroutine initialize()\ninteger :: i,j,xx,yy\n\nMSIZE = 200\nmits = 1000\ntol=0.0000000001\nrelax = 1.0\nalpha = 0.0543\nn = MSIZE\nm = MSIZE\nallocate(u(MSIZE,MSIZE))\nallocate(f(MSIZE,MSIZE))\nallocate(uold(MSIZE,MSIZE))\n\ndx = 2.0D0 / DBLE(n-1)\ndy = 2.0D0 / DBLE(m-1)\n\ndo i = 1, n\ndo j = 1, m\nxx = int(-1.0 + dx * (i-1))\nyy = int(-1.0 + dy * (i-1))\nu(i,j) = 0.0\nf(i,j) = -1.0 * alpha * (1.0-xx*xx) * (1.0-yy*yy) - 2.0* (1.0-xx*xx) -2.0 * (1.0-yy*yy)\nend do\nend do\n\nend subroutine\n\nsubroutine jacobi()\ninteger, parameter :: dp = kind(1.0d0)\nreal(dp) :: omega\ninteger :: i, j, k\nreal(dp) :: error, resid, ax, ay, b\n\nMSIZE = 200\nmits = 1000\ntol=0.0000000001\nrelax = 1.0\nalpha = 0.0543\nn = MSIZE\nm = MSIZE\n\nomega = relax\ndx = 2.0D0 / DBLE(n-1)\ndy = 2.0D0 / DBLE(m-1)\n\nax = 1.0D0 / (dx * dx); !/* X-direction coef */\nay = 1.0D0 / (dy * dy); !/* Y-direction coef */\nb = -2.0D0 / (dx * dx) - 2.0D0 / (dy * dy) - alpha;\n\nerror = 10.0 * tol\nk = 1\n\ndo k = 1, mits\nerror = 0.0\n\n!Copy new solution into old\n!$omp parallel\n!$omp do private(i,j)\ndo i = 1, n\ndo j = 1, m\nuold(i,j) = u(i,j)\nend do\nend do\n!$omp end do\n!$omp do private(i,j,resid) reduction(+:error)\ndo i = 2, (n-1)\ndo j = 2, (m-1)\nresid = (ax * (uold(i - 1,j) + uold(i + 1,j)) + ay * (uold(i,j - 1) + uold(i,j + 1)) + b * uold(i,j) - f(i,j)) / b\nu(i,j) = uold(i,j) - omega * resid\nerror = error + resid * resid\nend do\nend do\n!$omp end do nowait\n!$omp end parallel\n\n!Error check\nerror = sqrt(error)/(n*m)\nend do\n\nprint*,"Total number of iterations: ",k\nprint*,"Residual: ",error\n\nend subroutine\nend module program DRB058_jacobikernel_orig_no\n use omp_lib\n use DRB058\n implicit none\n\n call initialize()\n call jacobi()\nend program |
#include <stdlib.h>\nint main(int argc, char* argv[])\n{\n int i;\n int len=100;\n\n if (argc>1)\n len = atoi(argv[1]);\n\n int a[len], b[len];\n for (i=0;i<len;i++)\n {\n a[i]=i;\n b[i]=i+1;\n }\n#pragma omp simd\n for (i=0;i<len-1;i++)\n a[i+1]=a[i]*b[i];\n return 0;\n}\n | program DRB025_simdtruedep_var_yes\n use omp_lib\n implicit none\n\n integer :: i, len, argCount, allocStatus, rdErr, ix\n character(len=80), dimension(:), allocatable :: args\n integer, dimension(:), allocatable :: a\n integer, dimension(:), allocatable :: b\n\n len = 100\n\n argCount = command_argument_count()\n if (argCount == 0) then\n write (*,'(a)') "No command line arguments provided."\n end if\n\n allocate(args(argCount), stat=allocStatus)\n if (allocStatus > 0) then\n write (*,'(a)') "Allocation error, program terminated."\n stop\n end if\n\n do ix = 1, argCount\n call get_command_argument(ix,args(ix))\n end do\n\n if (argCount >= 1) then\n read (args(1), '(i10)', iostat=rdErr) len\n if (rdErr /= 0 ) then\n write (*,'(a)') "Error, invalid integer value."\n end if\n end if\n\n allocate (a(len))\n allocate (b(len))\n\n do i = 1, len\n a(i) = i\n b(i) = i+1\n end do\n\n !$omp simd\n do i = 1, len-1\n a(i+1) = a(i) + b(i)\n end do\n\n do i = 1, len\n write(6,*) 'Values for i and a(i) are:', i, a(i)\n end do\n\n deallocate(args,a,b)\n\nend program |
#include <stdio.h>\nint main(int argc, char* argv[])\n{\n int i;\n int len = 1000;\n int a[len];\n\n for (i=0; i<len; i++)\n a[i]= i;\n\n#pragma omp target map(a[0:len])\n#pragma omp parallel for\n for (i=0;i< len;i++)\n a[i]=a[i]+1;\n\n return 0;\n}\n | program DRB071_targetparallelfor_orig_no\n use omp_lib\n implicit none\n\n integer :: i, len\n integer, dimension(:), allocatable :: a\n\n allocate(a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n !$omp target map(a(1:len))\n !$omp parallel do\n do i = 1, len\n a(i) = a(i)+1\n end do\n !$omp end target\n\n deallocate(a)\nend program |
#include <stdlib.h>\n#include <stdio.h>\n#include <time.h>\nint main(int argc, char* argv[])\n{\n int i;\n int len=100;\n int a[100];\n\n for (i=0;i<len;i++)\n a[i]=i;\n \n srand(time(NULL));\n#pragma omp parallel for if (rand()%2)\n for (i=0;i<len-1;i++)\n a[i+1]=a[i]+1;\n\n printf("a[50]=%d\n", a[50]); \n return 0;\n}\n | program DRB114_if_orig_yes\n use omp_lib\n implicit none\n\n integer i, len, rem, j\n real :: u\n integer, parameter :: dp = kind(1.0d0)\n real(dp), dimension(:), allocatable :: a\n\n len = 100\n allocate (a(len))\n\n do i = 1, len\n a(i) = i\n end do\n\n call random_number(u)\n j = FLOOR(100*u)\n\n !$omp parallel do if (MOD(j,2)==0)\n do i = 1, len-1\n a(i+1) = a(i)+1\n end do\n !$omp end parallel do\n\n print*,'a(50) =',a(50)\n\n deallocate(a)\nend program |
#include <stdio.h>\nint a[100];\n\nint main()\n{\n int len=100; \n int i,x=10;\n\n#pragma omp parallel for \n for (i=0;i<len;i++)\n {\n a[i] = x;\n x=i;\n }\n printf("x=%d",x); \n return 0;\n} \n\n | program DRB016_outputdep_orig_yes\n use omp_lib\n use globalArray\n\n implicit none\n\n integer len, i, x\n\n len = 100\n x = 10\n\n call useGlobalArray(len)\n\n !$omp parallel do\n do i = 1, len\n a(i) = x\n x = i\n end do\n !$omp end parallel do\n\n write(*,*) "x =",x\nend program |
#include <stdio.h>\n#if (_OPENMP<201511)\n#error "OpenMP 4.5 compilers (e.g. GCC 6.x or later ) are needed to compile this test."\n#endif\n\n#include <stdio.h>\n#define MYLEN 100\nint a[MYLEN];\n\nvoid gen_task(int& i)\n{\n#pragma omp task\n{\na[i]= i+1;\n}\n}\n\nint main()\n{\nint i=0;\n#pragma omp parallel\n{\n#pragma omp single\n{\nfor (i=0; i<MYLEN; i++)\n{\ngen_task(i);\n}\n}\n}\n\n/* correctness checking */\nfor (i=0; i<MYLEN; i++)\n{\n//assert (a[i]==i+1);\nif (a[i]!= i+1)\n{\nprintf("warning: a[%d] = %d, not expected %d\n", i, a[i], i+1);\n}\n}\nreturn 0;\n} | program DRB100_task_reference_orig_no\n use omp_lib\n use DRB100\n implicit none\n\n integer :: i\n allocate (a(100))\n\n !$omp parallel\n !$omp single\n do i = 1, 100\n call gen_task(i)\n end do\n !$omp end single\n !$omp end parallel\n\n do i = 1, 100\n if (a(i) /= i+1) then\n print*,'warning: a(',i,') =',a(i),' not expected',i+1\n end if\n! print*,a(i),i+1\n end do\nend program |
#include <stdio.h>\n#include <omp.h>\n\nvoid foo(){\n\n int x = 0, y = 2;\n\n #pragma omp task depend(inout: x) shared(x)\n x++; //1st Child Task\n\n #pragma omp task shared(y)\n y--; // 2nd child task\n\n #pragma omp task depend(in: x) if(0) // 1st taskwait\n {}\n\n printf("x=%d\n",x);\n printf("y=%d\n",y);\n #pragma omp taskwait // 2nd taskwait\n}\n\n\nint main(){\n #pragma omp parallel\n #pragma omp single\n foo();\n\n return 0;\n}\n | program DRB131_taskdep4_orig_yes_omp_45\n use omp_lib\n implicit none\n\n !$omp parallel\n !$omp single\n call foo()\n !$omp end single\n !$omp end parallel\ncontains\n subroutine foo()\n implicit none\n integer :: x, y\n x = 0\n y = 2\n\n !$omp task depend(inout: x) shared(x)\n x = x+1 !!1st Child Task\n !$omp end task\n\n !$omp task shared(y)\n y = y-1 !!2nd child task\n !$omp end task\n\n !$omp task depend(in: x) if(.FALSE.) !!1st taskwait\n !$omp end task\n\n print*, "x=", x\n print*, "y=", y\n\n !$omp taskwait !!2nd taskwait\n end subroutine foo\nend program |
#include <stdio.h>\n#include <omp.h>\n#include <stdlib.h>\n#define N 100\n#define C 16\n\n\nint a;\nint b[C];\nint c[C];\nint temp[C];\n\nint main(){\n for(int i=0; i<C; i++){\n b[i]=0;\n c[i]=2;\n temp[i]=0;\n }\n a=2;\n\n #pragma omp target map(tofrom:b[0:C]) map(to:c[0:C],temp[0:C],a) device(0)\n {\n #pragma omp teams\n for(int i=0; i<N ;i++){\n #pragma omp distribute\n for(int i=0; i<C; i++){\n temp[i] = b[i] + c[i];\n }\n\n #pragma omp distribute\n for(int i=C-1; i>=0; i--){\n b[i] = temp[i] * a;\n }\n }\n }\n\n int val = 0;\n\n for(int i=0; i<N; i++){\n val = val + 2;\n val = val * 2;\n }\n\n for(int i=0; i<C; i++){\n if(b[i]!=val){\n printf("index: %d val: %d\n",i, b[i]);\n }\n }\n\n return 0;\n}\n | program DRB160_nobarrier_orig_gpu_yes\n use omp_lib\n use DRB160\n implicit none\n\n do i = 1, 8\n b(i) = 0\n c(i) = 2\n temp(i) = 0\n end do\n\n a = 2\n val = 0\n\n !$omp target map(tofrom:b) map(to:c,temp,a) device(0)\n !$omp teams\n do i = 1, 100\n !$omp distribute\n do j = 1, 8\n temp(j) = b(j)+c(j)\n end do\n !$omp end distribute\n\n !$omp distribute\n do j = 8, 1, k-1\n b(j) = temp(j)*a\n end do\n !$omp end distribute\n end do\n !$omp end teams\n !$omp end target\n\n do i = 1, 100\n val = val+2\n val = val*2\n end do\n\n do i = 1, 8\n if (val /= b(i)) then\n print*,b(i),val\n end if\n end do\n\nend program |
#include <stdio.h>\n#include <omp.h>\n\nint main(){\n int a, b, c, d;\n\n #pragma omp parallel\n #pragma omp single\n {\n #pragma omp task depend(out: c)\n c = 1;\n #pragma omp task depend(out: a)\n a = 2;\n #pragma omp task depend(out: b)\n b = 3;\n #pragma omp task depend(in: a) depend(mutexinoutset: c)\n c += a;\n #pragma omp task depend(in: b) depend(mutexinoutset: c)\n c += b;\n #pragma omp task depend(in: c)\n d = c;\n }\n\n printf("%d\n",d);\n return 0;\n}\n | program DRB135_taskdep_mutexinoutset_orig_no_omp50\n use omp_lib\n implicit none\n\n integer :: a, b, c, d\n\n !$omp parallel\n !$omp single\n !$omp task depend(out: c)\n c = 1 ! Task T1\n !$omp end task\n !$omp task depend(out: a)\n a = 2 ! Task T2\n !$omp end task\n !$omp task depend(out: b)\n b = 3 ! Task T3\n !$omp end task\n !$omp task depend(in: a) depend(mutexinoutset: c)\n c = c + a ! Task T4\n !$omp end task\n !$omp task depend(in: b) depend(mutexinoutset: c)\n c = c + b ! Task T5\n !$omp end task\n !$omp task depend(in: c)\n d = c ! Task T6\n !$omp end task\n !$omp end single\n !$omp end parallel\n\n print *, d\nend program |
#include <stdio.h>\n#include <omp.h>\n\nvoid foo(){\n int x = 0, y = 2;\n\n #pragma omp task depend(inout: x) shared(x)\n x++; // 1st child task\n\n #pragma omp task depend(in: x) depend(inout: y) shared(x, y)\n y -= x; //2nd child task\n\n #pragma omp taskwait depend(in: x) // 1st taskwait\n\n printf("x=%d\n",x);\n printf("y=%d\n",y);\n\n #pragma omp taskwait // 2nd taskwait\n\n}\n\nint main(){\n #pragma omp parallel\n #pragma omp single\n foo();\n\n return 0;\n}\n\n | program DRB168_taskdep5_orig_yes_omp_50\n use omp_lib\n implicit none\n\n !$omp parallel\n !$omp single\n call foo()\n !$omp end single\n !$omp end parallel\ncontains\n subroutine foo()\n implicit none\n integer :: x, y\n x = 0\n y = 2\n\n !$omp task depend(inout: x) shared(x)\n x = x+1 !!1st Child Task\n !$omp end task\n\n !$omp task shared(y)\n y = y-x !!2nd child task\n !$omp end task\n\n !$omp taskwait depend(in: x) !!1st taskwait\n\n print*, "x=", x\n print*, "y=", y\n\n !$omp taskwait !!2nd taskwait\n end subroutine foo\nend program |
#include <stdio.h>\n/*\n * Test if atomic can be recognized properly. No data races.\n * */\nint main (void)\n{\n int a=0;\n#pragma omp parallel \n {\n#pragma omp atomic\n a+=1;\n }\n printf ("a=%d\n",a);\n return 0;\n}\n\n | program DRB108_atomic_orig_no\n use omp_lib\n implicit none\n\n integer a\n a = 0\n\n !$omp parallel\n !$omp atomic\n a = a+1\n !$omp end atomic\n !$omp end parallel\n\n print 100, a\n 100 format ('a =',3i8)\nend program |
#include <stdlib.h>\n#include <stdio.h>\nint main (int argc, char* argv[])\n{\n int len=1000;\n int i; \n\n int a[1000];\n a[0] = 2;\n\n#pragma omp parallel for\n for (i=0;i<len;i++)\n a[i]=a[i]+a[0];\n\n printf("a[500]=%d\n", a[500]);\n return 0;\n}\n | program DRB039_truedepsingleelement_orig_yes\n use omp_lib\n implicit none\n\n integer :: len, i\n integer, dimension(:), allocatable :: a\n\n len = 1000\n allocate (a(len))\n\n a(1) = 2\n\n !$omp parallel do\n do i = 1, len\n a(i) = a(i)+a(1)\n end do\n !$omp end parallel do\n\n print 100, a(500)\n 100 format ('a(500) =',i3)\n\n deallocate(a)\nend program |
#include <stdio.h>\nint main(int argc, char* argv[])\n{\n int i;\n int len=100;\n int a[100], b[100];\n\n for (i=0;i<len;i++)\n {\n a[i]=i;\n b[i]=i+1;\n }\n\n#pragma omp parallel for simd \n for (i=0;i<len-1;i++)\n a[i+1]=a[i]+b[i];\n\n printf("a[50]=%d\n",a[50]);\n return 0;\n}\n | program DRB115_forsimd_orig_yes\n use omp_lib\n implicit none\n\n integer i, len\n integer, dimension(:), allocatable :: a,b\n\n len = 100\n allocate (a(len))\n allocate (b(len))\n\n do i = 1, len\n a(i) = i\n b(i) = i+1\n end do\n\n !$omp simd\n do i = 1, len-1\n a(i+1)=a(i)+b(i)\n end do\n\n print*,'a(50) =',a(50)\n\n deallocate(a,b)\nend program |
#include <stdio.h>\n#include <omp.h>\n\nvoid foo(){\n\n int x = 0, y = 2;\n\n #pragma omp task depend(inout: x) shared(x)\n x++; //1st Child Task\n\n #pragma omp task shared(y)\n y--; // 2nd child task\n\n #pragma omp task depend(in: x) if(0) // 1st taskwait\n {}\n\n printf("x=%d\n",x);\n\n #pragma omp taskwait // 2nd taskwait\n\n printf("y=%d\n",y);\n}\n\n\nint main(){\n #pragma omp parallel\n #pragma omp single\n foo();\n\n return 0;\n}\n\n | program DRB132_taskdep4_orig_no_omp45\n use omp_lib\n implicit none\n\n !$omp parallel\n !$omp single\n call foo()\n !$omp end single\n !$omp end parallel\ncontains\n subroutine foo()\n implicit none\n integer :: x, y\n x = 0\n y = 2\n\n !$omp task depend(inout: x) shared(x)\n x = x+1 !!1st Child Task\n !$omp end task\n\n !$omp task shared(y)\n y = y-1 !!2nd child task\n !$omp end task\n\n !$omp task depend(in: x) if(.FALSE.) !!1st taskwait\n !$omp end task\n\n print*, "x=", x\n\n !$omp taskwait !!2nd taskwait\n\n print*, "y=", y\n\n end subroutine\nend program |
#include<stdio.h>\n#include<assert.h>\nvoid f1(int *q)\n{\n *q = 1;\n}\n\nint main()\n{ \n int i=0, sum=0; \n #pragma omp parallel reduction(+:sum) num_threads(10) private(i)\n {\n f1(&i);\n sum+= i; \n }\n assert (sum==10);\n printf("sum=%d\n", sum);\n return 0; \n}\n | program DRB076_flush_orig_no\n use omp_lib\n use DRB076\n implicit none\n\n integer :: i, sum\n i = 0\n sum = 0\n\n !$omp parallel reduction(+:sum) num_threads(10) private(i)\n call f1(i)\n sum = sum + i\n !$omp end parallel\n\n if (sum /= 10) then\n print*,'sum =',sum\n end if\nend program |
#include <omp.h>\n#include <stdio.h>\n\n#define N 100\n\nint var = 0;\n\nint main(){\n\n #pragma omp target map(tofrom:var) device(0)\n #pragma omp teams distribute parallel for\n for(int i=0; i<N; i++){\n #pragma omp atomic\n var++;\n\n #pragma omp atomic\n var -= 2;\n }\n\n printf("%d\n",var);\n return 0;\n}\n | program DRB147_critical1_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 parallel do\n do i = 0, 100\n !$omp atomic\n var = var+1\n !$omp atomic\n var = var-2\n end do\n !$omp end teams distribute parallel do\n !$omp end target\n\n print*, var\nend program |
#include <stdio.h>\nint main(int argc, char* argv[])\n{\n int i;\n int ret;\n FILE* pfile;\n int len=1000;\n\n int A[1000];\n\n for (i=0; i<len; i++)\n A[i]=i;\n\n pfile = fopen("mytempfile.txt","a+");\n if (pfile ==NULL)\n {\n fprintf(stderr,"Error in fopen()\n");\n }\n\n#pragma omp parallel for\n for (i=0; i<len; ++i)\n {\n fprintf(pfile, "%d\n", A[i] );\n }\n\n fclose(pfile);\n ret = remove("mytempfile.txt");\n if (ret != 0)\n {\n fprintf(stderr, "Error: unable to delete mytempfile.txt\n");\n }\n return 0;\n}\n\n | program DRB049_fprintf_orig_no\n use omp_lib\n implicit none\n\n integer i, ret, len, stat\n integer :: a(1000)\n logical :: exist\n\n len = 1000\n\n do i = 1, len\n a(i) = i\n end do\n\n inquire(file="mytempfile.txt", exist=exist)\n\n if (exist) then\n open(6, file="mytempfile.txt", iostat=stat, status="old", position="append", action="write")\n else\n open(6, file="mytempfile.txt", iostat=stat, status="new", action="write")\n end if\n\n !$omp parallel do\n do i = 1, len\n write(6, *) a(i)\n end do\n !$omp end parallel do\n\n if (stat == 0) close(6, status='delete')\n\nend program |
#include <stdio.h>\nint a[100];\nint main()\n{\nint i;\n#pragma omp parallel for\n for (i=0;i<100;i++)\n a[i]=a[i]+1;\n return 0;\n} \n | program DRB045_doall1_orig_no\n use omp_lib\n implicit none\n\n integer :: i\n integer :: a(100)\n\n !$omp parallel do\n do i = 1, 100\n a(i) = a(i)+1\n end do\n !$omp end parallel do\n\nend program |