Skip to content

Commit

Permalink
Minor update: add finaliser for fclProgram object
Browse files Browse the repository at this point in the history
  • Loading branch information
LKedward committed Jul 10, 2023
1 parent 1ada250 commit 3f80eb3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Focal.f90
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ module Focal
!! Type wrapper for openCL program objects
private
integer(c_intptr_t) :: cl_program !! openCL program pointer
contains
final :: fclReleaseProgram
end type fclProgram

type :: fclKernelPointer
Expand Down Expand Up @@ -1262,6 +1264,11 @@ module function fclGetProgramKernel(prog,kernelName,global_work_size,local_work_
type(fclKernel) :: kern !! Returns fclKernel object for execution
end function fclGetProgramKernel

module subroutine fclReleaseProgram(prog)
!! Release underlying memory associated with OpenCL program pointer
type(fclProgram), intent(in) :: prog !! Compiled program object containing kernel
end subroutine fclReleaseProgram

end interface

interface fclLaunchKernelAfter
Expand Down
10 changes: 10 additions & 0 deletions src/Focal_Setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,16 @@
! ---------------------------------------------------------------------------


module procedure fclReleaseProgram !(prog)
!! Release underlying memory associated with OpenCL program pointer

integer :: errcode
errcode = clReleaseProgram(prog%cl_program)

end procedure fclReleaseProgram
! ---------------------------------------------------------------------------


module procedure fclLaunchKernelAfterEvent_1 !(kernel,cmdQ,event)
!! Specific interface for a single event dependency on a specific command queue

Expand Down

0 comments on commit 3f80eb3

Please sign in to comment.