forked from ecmwf-ifs/fiat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new NVTX tests for skipping regions
These two new tests, `drhook_nvtx_skip_spam_regions` & `drhook_nvtx_no_skip_spam_regions`, demonstrate the following behaviours: - drhook_nvtx_skip_spam_regions - Regions are successfully skipped when called frequently & with low total runtime - drhook_nvtx_no_skip_spam_regions - Regions are successfully not skipped when called frequently, but with sufficient total runtime
- Loading branch information
1 parent
eea2989
commit c721ed1
Showing
3 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
tests/drhook/drhook_nvtx/drhook_nvtx_no_skip_spam_regions.F90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
! (C) Copyright 2024- ECMWF. | ||
! | ||
! This software is licensed under the terms of the Apache Licence Version 2.0 | ||
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
! | ||
! In applying this licence, ECMWF does not waive the privileges and immunities | ||
! granted to it by virtue of its status as an intergovernmental organisation | ||
! nor does it submit to any jurisdiction. | ||
|
||
program drhook_nvtx_no_skip_spam_regions | ||
|
||
use yomhook, only : jphook, dr_hook | ||
|
||
implicit none | ||
|
||
real(jphook) :: zhook_handle | ||
call dr_hook('drhook_nvtx_no_skip_spam_regions', 0, zhook_handle) | ||
call foo(-1) | ||
call foo(0) | ||
call dr_hook('drhook_nvtx_no_skip_spam_regions', 1, zhook_handle) | ||
|
||
contains | ||
|
||
recursive subroutine foo (depth) | ||
integer, intent(in) :: depth | ||
real(jphook) :: zhook_handle | ||
|
||
call dr_hook('foo', 0, zhook_handle) | ||
|
||
if (depth == -1) then | ||
call sleep(1) | ||
call dr_hook('foo', 1, zhook_handle) | ||
return | ||
end if | ||
|
||
if (depth < 10) then | ||
call foo(depth + 1) | ||
end if | ||
|
||
call dr_hook('foo', 1, zhook_handle) | ||
end subroutine | ||
|
||
end program drhook_nvtx_no_skip_spam_regions | ||
|
37 changes: 37 additions & 0 deletions
37
tests/drhook/drhook_nvtx/drhook_nvtx_skip_spam_regions.F90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
! (C) Copyright 2024- ECMWF. | ||
! | ||
! This software is licensed under the terms of the Apache Licence Version 2.0 | ||
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
! | ||
! In applying this licence, ECMWF does not waive the privileges and immunities | ||
! granted to it by virtue of its status as an intergovernmental organisation | ||
! nor does it submit to any jurisdiction. | ||
|
||
program drhook_nvtx_skip_spam_regions | ||
|
||
use yomhook, only : jphook, dr_hook | ||
|
||
implicit none | ||
|
||
real(jphook) :: zhook_handle | ||
call dr_hook('drhook_nvtx_skip_spam_regions', 0, zhook_handle) | ||
call foo(0) | ||
call dr_hook('drhook_nvtx_skip_spam_regions', 1, zhook_handle) | ||
|
||
contains | ||
|
||
recursive subroutine foo (depth) | ||
integer, intent(in) :: depth | ||
real(jphook) :: zhook_handle | ||
|
||
call dr_hook('foo', 0, zhook_handle) | ||
|
||
if (depth < 10) then | ||
call foo(depth + 1) | ||
end if | ||
|
||
call dr_hook('foo', 1, zhook_handle) | ||
end subroutine | ||
|
||
end program drhook_nvtx_skip_spam_regions | ||
|