diff --git a/fortran_examples/build.sh b/fortran_examples/build.sh index 9f7e6c006441afa857e7def529936957d2f50873..07342f03140e316d16c1600b4777401f19dfc689 100755 --- a/fortran_examples/build.sh +++ b/fortran_examples/build.sh @@ -1,3 +1,5 @@ #!/bin/bash -gfortran test.F90 ../src/.libs/libquicksched.a -I../src/ -fopenmp +#gfortran test.F90 ../src/.libs/libquicksched.a -I../src/ -fopenmp + +ifort test_n2.F90 -g ../src/.libs/libquicksched.a -I../src/ -fopenmp -o test_n2 diff --git a/fortran_examples/test_n2.F90 b/fortran_examples/test_n2.F90 index 0943a542e5c3b4f013eaad741ffc78262a1b96ba..322bc742ed00110c15579270d74854ae350e9e99 100644 --- a/fortran_examples/test_n2.F90 +++ b/fortran_examples/test_n2.F90 @@ -153,6 +153,8 @@ 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 +cells(cell_num)%num_parts = count + End Subroutine cell_init Subroutine runner(typ, data) BIND(C) @@ -194,29 +196,31 @@ Integer(Kind=C_INT) :: num_threads !$omp parallel !$omp single -num_threads = omp_get_thread_num() +num_threads = Int(omp_get_num_threads(), C_INT) !$omp end single !$omp end parallel +print *, num_threads + runner_func = C_FUNLOC(runner) -Allocate(cells(1:1000)) -do i = 1, 1000 - call cell_init(i, 1000) +Allocate(cells(1:100)) +do i = 1, 100 + call cell_init(i, 500) end do sched = f_qsched_create() call qsched_init(sched, num_threads, 0) -do i=1, 1000 +do i=1, 100 cell_res(i) = qsched_addres(sched, qsched_owner_none, qsched_res_none) end do -do i=1, 1000 +do i=1, 100 data(0) = i temp = qsched_addtask(sched, type_self, 0, C_LOC(data(0)), int(c_sizeof(type_self), C_INT), 1) call qsched_addlock(sched, temp, cell_res(i)) - do j=i+1, 1000 + do j=i+1, 100 data(1) = j temp = qsched_addtask(sched, type_pair, 0, C_LOC(data(0)), int(c_sizeof(type_self)*2, C_INT), 1) call qsched_addlock(sched, temp, cell_res(i)) @@ -226,7 +230,9 @@ end do t_start = omp_get_wtime() +do i=1,10 call qsched_run(sched, num_threads, runner_func) +end do t_total = omp_get_wtime() - t_start print *, "Took", t_total