From 25dcdef61abe7f64d1835715174d24aa24d11bd9 Mon Sep 17 00:00:00 2001 From: Aidan Chalk <aidan.chalk@stfc.ac.uk> Date: Thu, 13 Apr 2017 10:04:13 +0100 Subject: [PATCH] Version 0 of the FORTRAN bindings for FORTRAN --- src/qsched.F90 | 121 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 src/qsched.F90 diff --git a/src/qsched.F90 b/src/qsched.F90 new file mode 100644 index 0000000..5f6198f --- /dev/null +++ b/src/qsched.F90 @@ -0,0 +1,121 @@ +Module quicksched + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + Interface + + !!TODO May need a qsched_get_qsched to get a pointer? + + Subroutine qsched_init(s, nr_queues, flags) BIND(C) + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + + Type(C_PTR), Intent(InOut), VALUE :: s + Integer(Kind=C_INT), Intent(In), VALUE :: nr_queues + Integer(Kind=C_INT), Intent(In), VALUE :: flags + End Subroutine + + Integer(Kind=C_INT) Function qsched_addres(s, owner, parent) BIND(C) + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + Integer(Kind=C_INT), Intent(In), VALUE :: owner + Integer(Kind=C_INT), Intent(In), VALUE :: parent + End Function + + Subroutine qsched_addlock(s, t, res) BIND(C) + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + Integer(Kind=C_INT), Intent(In), VALUE :: t + Integer(Kind=C_INT), Intent(In), VALUE :: res + End Subroutine + + Subroutine qsched_addunlock(s, ta, tb) BIND(C) + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + Integer(Kind=C_INT), Intent(In), VALUE :: ta + Integer(Kind=C_INT), Intent(In), VALUE :: tb + + End Subroutine + + Integer(Kind=C_INT) Function qsched_addtask(s, types, flags, data, data_size, cost) BIND(C) + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + Integer(Kind=C_INT), Intent(In), VALUE :: types + Integer(Kind=C_INT), Intent(In), VALUE :: flags !TODO Careful with unsigned + Type(C_PTR), Intent(In), VALUE :: data + Integer(Kind=C_INT), Intent(In), VALUE :: data_size + IntegeR(Kind=C_INT), Intent(In), VALUE :: cost + + End Function + + Subroutine qsched_adduse(s, t, res) BIND(C) + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + Integer(Kind=C_INT), Intent(In), VALUE :: t + Integer(Kind=C_INT), Intent(In), VALUE :: res + End Subroutine + + Subroutine qsched_free(s) BIND(C) + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + + End Subroutine + + Subroutine qsched_run(s, nr_threads, fun) BIND(C) + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + Integer(Kind=C_INT), Intent(In), VALUE :: nr_threads + Type(C_FUNPTR), INTENT(In), VALUE :: fun + End Subroutine + + Subroutine qsched_reset(s) BIND(C) + Use, Intrinsic :: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + + End Subroutine + +!TODO Not supporting qsched_addtask_dynamic yet. + + Subroutine qsched_ensure(s, nr_tasks, nr_res, nr_deps, nr_locks, nr_uses, size_data) + Use, Intrinsic:: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + Integer(Kind=C_INT), Intent(In), VALUE :: nr_tasks + Integer(Kind=C_INT), Intent(In), VALUE :: nr_res + Integer(Kind=C_INT), Intent(In), VALUE :: nr_deps + Integer(Kind=C_INT), Intent(In), VALUE :: nr_locks + Integer(Kind=C_INT), Intent(In), VALUE :: nr_uses + Integer(Kind=C_INT), Intent(In), VALUE :: size_data + + End Subroutine + + Subroutine qsched_res_own(s, res, owner) + Use, Intrinsic:: ISO_C_BINDING + Implicit None + + Type(C_PTR), Intent(InOut), VALUE :: s + Integer(Kind=C_INT), Intent(In), VALUE :: res + Integer(Kind=C_INT), Intent(In), VALUE :: owner + + End Subroutine + End Interface + +End Module quicksched -- GitLab