From a3a6f11c145e221a4629f85922f4adb8cdfd9421 Mon Sep 17 00:00:00 2001 From: axc67-pxs02 <axc67-pxs02@crb105.(none)> Date: Tue, 9 May 2017 14:09:15 +0100 Subject: [PATCH] fixed some typos --- fortran_examples/test_n2.F90 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/fortran_examples/test_n2.F90 b/fortran_examples/test_n2.F90 index 85315cb..0943a54 100644 --- a/fortran_examples/test_n2.F90 +++ b/fortran_examples/test_n2.F90 @@ -131,7 +131,7 @@ end do End Subroutine -Subroutine init_cells(cell_num, count) +Subroutine cell_init(cell_num, count) Integer, Intent(in) :: cell_num, count Allocate(cells(cell_num)%fx(1:count)) @@ -153,7 +153,7 @@ cells(cell_num)%dx = cells(cell_num)%dx * 10.0_dp cells(cell_num)%dy = cells(cell_num)%dy * 10.0_dp cells(cell_num)%dz = cells(cell_num)%dz * 10.0_dp -End Subroutine init_cells +End Subroutine cell_init Subroutine runner(typ, data) BIND(C) Use, Intrinsic :: ISO_C_BINDING @@ -167,7 +167,7 @@ Integer(Kind=C_INT), Pointer :: c(:) call c_f_pointer(data, c, [2]) If(typ == type_self) then -call Interact_self(c(1)) +call Interact_single(c(1)) else call Interact(c(1), c(2)) end if @@ -190,6 +190,13 @@ Type(C_PTR) :: dat_ptr Integer(Kind=C_INT), Dimension(1:1000) :: cell_res Type(C_FUNPTR) :: runner_func Double Precision :: t_start, t_total +Integer(Kind=C_INT) :: num_threads + +!$omp parallel +!$omp single +num_threads = omp_get_thread_num() +!$omp end single +!$omp end parallel runner_func = C_FUNLOC(runner) @@ -199,7 +206,7 @@ do i = 1, 1000 end do sched = f_qsched_create() -call qsched_init(sched, 24, 0) +call qsched_init(sched, num_threads, 0) do i=1, 1000 cell_res(i) = qsched_addres(sched, qsched_owner_none, qsched_res_none) @@ -219,7 +226,7 @@ end do t_start = omp_get_wtime() -call qsched_run(sched, 24, runner_func) +call qsched_run(sched, num_threads, runner_func) t_total = omp_get_wtime() - t_start print *, "Took", t_total -- GitLab