Skip to content

Commit

Permalink
Add test for NVTX in C
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Beggs-ECMWF committed Sep 25, 2024
1 parent 14751be commit 6117c1e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/drhook/drhook_nvtx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ ecbuild_add_test( TARGET fiat_test_drhook_nvtx_basic
ENVIRONMENT DR_HOOK=1 DR_HOOK_NVTX=1
CONDITION HAVE_DR_HOOK_NVTX )

# Test basic implementation in C

ecbuild_add_executable( TARGET drhook_nvtx_basic_c
SOURCES drhook_nvtx_basic_c.c
LIBS fiat
LINKER_LANGUAGE C
CONDITION HAVE_DR_HOOK_NVTX
NOINSTALL )

ecbuild_add_test( TARGET fiat_test_drhook_nvtx_basic_c
TYPE SCRIPT
COMMAND "nsys"
ARGS "profile" "--force-overwrite=true" "--trace=nvtx" "--kill=none" "--output=nsys.drhook_nvtx_basic_c.qdrep" "./drhook_nvtx_basic_c"
ENVIRONMENT DR_HOOK=1 DR_HOOK_NVTX=1
CONDITION HAVE_DR_HOOK_NVTX )

# Test abort on mismatched region names

ecbuild_add_executable( TARGET drhook_nvtx_mismatched_regions
Expand Down Expand Up @@ -77,7 +93,6 @@ ecbuild_add_test( TARGET fiat_test_drhook_nvtx_no_skip_spam_regions
COMMAND "nsys"
ARGS "profile" "--force-overwrite=true" "--trace=nvtx" "--kill=none" "--output=nsys.drhook_nvtx_no_skip_spam_regions.qdrep" "./drhook_nvtx_no_skip_spam_regions"
ENVIRONMENT DR_HOOK=1 DR_HOOK_NVTX=1 DR_HOOK_SILENT=0

CONDITION HAVE_DR_HOOK_NVTX )

set_tests_properties(fiat_test_drhook_nvtx_no_skip_spam_regions
Expand Down
23 changes: 23 additions & 0 deletions tests/drhook/drhook_nvtx/drhook_nvtx_basic_c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* (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.
*/

#include <stdio.h>

#include "drhook.h"

int main(int argc, char *argv[])
{
DRHOOK_START("main");

printf("Hello World!\n");

DRHOOK_END();
return 0;
}

0 comments on commit 6117c1e

Please sign in to comment.