diff --git a/Parser/Makefile b/Parser/Makefile index fd43304f5738d7f5fd6c5313070cb0523a9d8646..ec6608ba0ed3eff06d8168d56753373def4ba545 100644 --- a/Parser/Makefile +++ b/Parser/Makefile @@ -1,5 +1,5 @@ -all: jastadd +all: rats jastadd ast: mkdir -p spec-gen diff --git a/Parser/test-data/OpenAcc/grep.f b/Parser/test-data/OpenAcc/grep.f deleted file mode 100644 index 9233e89b7a764453423cd6392d81067f831aee71..0000000000000000000000000000000000000000 --- a/Parser/test-data/OpenAcc/grep.f +++ /dev/null @@ -1,193 +0,0 @@ -!$acc data copy(T,r,f,x) copyin(stiffness_mat,mass_mat_diag,global_mass_inv) - - -!$acc update host(T) - - -!$acc parallel loop private(k,i) collapse(2) async(1) gang vector vector_length(16) -do k = 1, num_ele -end do -!$acc end parallel loop - - -!$acc parallel loop private(k,i) collapse(2) async(1) gang vector vector_length(16) -do k = 1, num_ele -end do -!$acc end parallel loop - - -!$acc parallel loop async(1) gang -do k = 2, num_ele -end do -!$acc end parallel loop - - -!$acc wait - - -!$acc update host(f(0:0,1),f(po:po,num_ele)) - - -!$acc update device(f(0:0,1),f(po:po,num_ele)) - - -!$acc parallel loop async(1) collapse(2) private(k,i) gang vector vector_length(16) -do k = 1, num_ele -end do -!$acc end parallel loop - - - -!$acc parallel loop async(1) collapse(2) private(k,i) gang vector vector_length(16) -do k = 1, num_ele -end do -!$acc end parallel loop - - -!$acc wait - - -!$acc update host(T) - - -!$acc end data - - - -!$acc data copy (T) create(f,r) - - -!$acc update host(T) - - -!$acc data present(T,r,f,stiffness_mat,global_mass_inv,mass_mat_diag) - - - -!$acc parallel loop private(k,i) async(1) gang worker vector_length(16) -do k = 1, num_ele - !$acc loop vector - do i = 0, po - end do -end do -!$acc end parallel loop - - -!$acc parallel loop private(k,i) async(1) gang, worker vector_length(16) -do k = 1, num_ele - !$acc loop vector private(j,sum) - do i = 0, po - end do -end do - -!$acc loop reduction(+:sum) -do j = 0, po -end do -!$acc end loop -end do -!$acc end parallel loop - - - -!$acc wait(1) -!$acc update host(f(0:0,1),f(po:po,num_ele)) async(2) - - - -!$acc parallel loop private(k) async(1) gang -do k = 2, num_ele -end do -!$acc end parallel loop -!$omp end do - - -!$acc wait(2) - - - -!$acc update device(f(0:0,1),f(po:po,num_ele)) async(2) -!$acc wait(1,2) -!$omp end single - - -!$acc parallel loop async(1) private(k,i) gang worker vector_length(16) -do k = 1, num_ele -!$acc loop vector -do i = 0, po -end do -!$acc end parallel loop - - -!$acc parallel loop async(1) private(k,i) gang worker vector_length(16) -do k = 1, num_ele -!$acc loop vector -do i = 0, po -end do -!$acc end parallel loop -end do - - -!$acc wait(1) -!$acc update host(T(:,:,0)) - - -!$acc end data - - - -!$acc end data - - -!$acc data present(T,r,f,stiffness_mat,global_mass_inv,mass_mat_diag) - - - -!$acc parallel loop private(k,i,j,sum) async(1) gang worker vector_length(16) -do k = 1, num_ele -!$acc loop vector -do i = 0, po - -end do -!$acc end parallel loop - - -!$acc parallel loop private(k,i) async(1) gang -do k = 2, num_ele -end do -!$acc end parallel loop - - -!$acc wait - - -!$acc update host(f(0:0,1),f(po:po,num_ele)) - - -!$acc update device(f(0:0,1),f(po:po,num_ele)) -!$omp end single - - -!$acc parallel loop async(1) private(k,i) gang worker vector_length(16) -do k = 1, num_ele -!$acc loop vector -do i = 0, po - - -!$acc end parallel -!$omp end do - - -!$acc parallel loop async(1) private(k,i) gang worker vector_length(16) -do k = 1, num_ele -!$acc loop vector -do i = 0, po -end do -!$acc end parallel loop - - -!$acc wait - - -!$acc end data - -end diff --git a/Parser/test-data/OpenAcc/rewrites.f b/Parser/test-data/OpenAcc/rewrites.f new file mode 100644 index 0000000000000000000000000000000000000000..5daf9e9fc9fb78cfbec161b7dd949cf31df9b1fa --- /dev/null +++ b/Parser/test-data/OpenAcc/rewrites.f @@ -0,0 +1,265 @@ +! OpenACC clause test + + x = 0 + + ! if =========================================================================== + + !$acc parallel if(1) + x = 1 + !$acc end parallel + + !$acc parallel if(a) + x = 1 + !$acc end parallel + + !$acc parallel if(a + 1) + x = 1 + !$acc end parallel + + !$acc parallel if(a%b) + x = 1 + !$acc end parallel + + !$acc parallel if(a(1,2)) + x = 1 + !$acc end parallel + + ! default(none) ================================================================ + + !$acc parallel default(none) + x = 1 + !$acc end parallel + + ! device type ================================================================== + + !$acc parallel device_type(t1) + x = 1 + !$acc end parallel + + !$acc parallel device_type(t1,t2) + x = 1 + !$acc end parallel + + !$acc parallel device_type(*) + x = 1 + !$acc end parallel + + ! short versions are expanded + + ! !$acc parallel dtype(t1) + ! x = 1 + ! !$acc end parallel + + ! !$acc parallel dtype(t1,t2) + ! x = 1 + ! !$acc end parallel + + ! !$acc parallel dtype(*) + ! x = 1 + ! !$acc end parallel + + ! tile ========================================================================= + + !$acc loop tile(myTile) + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + ! wait ========================================================================= + + !$acc parallel wait(x + 1,2,y) + x = 1 + !$acc end parallel + + ! collapse ===================================================================== + + !$acc loop collapse(4) + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + !$acc loop collapse(0) + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + !$acc loop collapse(#TEST#) + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + ! expression clauses =========================================================== + + !$acc parallel async(1 + x) + x = 1 + !$acc end parallel + + !$acc parallel num_gangs(1 + x) + x = 1 + !$acc end parallel + + !$acc parallel num_workers(1 + x) + x = 1 + !$acc end parallel + + !$acc parallel vector_length(1 + x) + x = 1 + !$acc end parallel + + ! reduction ==================================================================== + + ! operators + + !$acc parallel reduction(+:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(*:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(max:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(min:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(iand:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(ior:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(ieor:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(.and.:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(.or.:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(.eqv.:x) + x = 1 + !$acc end parallel + + !$acc parallel reduction(.neqv.:x) + x = 1 + !$acc end parallel + + ! variabes + + !$acc parallel reduction(+:x,y,z) + x = 1 + !$acc end parallel + + + ! variable list clauses ======================================================== + + !$acc enter data copy(x,y,z) + !$acc enter data copyin(x,y) + !$acc enter data copyout(x) + !$acc enter data create(x) + !$acc enter data delete(x) + !$acc enter data device(x) + !$acc enter data firstprivate(x) + !$acc enter data host(x) + !$acc enter data present(x) + !$acc enter data present_or_copy(x) + !$acc enter data present_or_copyin(x) + !$acc enter data present_or_copyout(x) + !$acc enter data present_or_create(x) + !$acc enter data private(x) + !$acc enter data self(x) + !$acc enter data use_device(x) + + ! short versions are expanded + ! !$acc enter data pcopy(x) + ! !$acc enter data pcopyin(x) + ! !$acc enter data pcopyout(x) + ! !$acc enter data pcreate(x) + + ! loop clauses ================================================================= + + !$acc loop gang + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + !$acc loop worker + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + !$acc loop vector + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + !$acc loop independent + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + !$acc loop gang(3) + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + !$acc loop worker(3) + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + !$acc loop vector(3) + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + !$acc loop shortloop + do i = 1,n(5) + x = 1 + end do + !$acc end loop + + ! seq ========================================================================== + + !$acc routine(myRoutine) seq + + ! bind ========================================================================= + + !$acc routine(myRoutine) bind(aName) + + !$acc routine(myRoutine) bind('some string...! x = 1') + + ! nohost ======================================================================= + + !$acc routine nohost + + ! device_resident ============================================================== + + !$acc declare device_resident(x,y,z) + + ! link ========================================================================= + + !$acc declare link(x,y,z) + +end