-
Notifications
You must be signed in to change notification settings - Fork 19
OMPVV Header File
Joshua Hoke Davis edited this page Jan 23, 2020
·
2 revisions
We would like to standardize the way we display results, error, warning and info messages, and the possibility of enable and disable error messages. This file contains macros that are used for this purpose.
Before The file is located in ompvv/ompvv.h. you need to include the file in your testfile (i.e #include "ompvv.h"
) and make sure that it is correctly added to the compilation path (i.e. -I./ompvv
)
Here is a list of the available macros
Macro | Information |
---|---|
OMPVV_INFOMSG(message, ...) |
If VERBOSE_MODE is defined, print an info message with the header [OMPVV_INFO filename.c:<line_number>] |
OMPVV_INFOMSG_IF(condition, message, ...) |
If VERBOSE_MODE is defined and (condition == true), print an info message with the header [OMPVV_INFO filename.c:<line_number>] |
OMPVV_WARNING(message, ...) |
If VERBOSE_MODE is defined, print a warning message with the header [OMPVV_WARNING filename.c:<line_number>] |
OMPVV_WARNING_IF(condition, message, ...) |
If VERBOSE_MODE is defined and (condition == true), print a warning message with the header [OMPVV_WARNING filename.c:<line_number>] |
OMPVV_ERROR(message, ...) |
If VERBOSE_MODE is define, print an error message in stderr with the header [OMPVV_ERROR filename.c:<line_number>] |
OMPVV_ERROR_IF(condition, message, ...) |
If VERBOSE_MODE is defined and (condition == true), print an error message in stderr with the header [OMPVV_ERROR filename.c:<line_number>] |
OMPVV_TEST_OFFLOADING |
check if offloading is enabled, fill this variable with such information. If VERBOSE_MODE is defined, print an info messages saying where the test is running (e.g. [OMPVV_INFO test.c:20] Test is running on device.). |
OMPVV_TEST_AND_SET_OFFLOADING(var2set) |
Same as OMPVV_TEST_OFFLOADING, but sets the variable var2set with the result to be used outside. |
OMPVV_TEST_AND_SET(err, errorCondition) |
If the errorCondition is true, error will be set to true. |
OMPVV_TEST_AND_SET_VERBOSE(err, errorCondition) |
If the errorCondition is true, error will be set to true. If VERBOSE_MODE, an error message will be generated when the errorCondition is true. The errorCondition is the condition that is required to generate an error |
OMPVV_REPORT(err) |
Based on the err variable, print if the test passes or fails (e.g. [OMPVV_RESULT] Test passed on the device). |
OMPVV_RETURN(err) |
Based on the err variable, return EXIT_SUCCESS or EXIT_FAILURE. err should be 0 if no error was encountered during the test |
OMPVV_REPORT_AND_RETURN(err) |
similar to calling OMPVV_REPORT and OMPVV_RETURN one after the other |
OMPVV_TEST_SHARED_ENVIRONMENT |
OpenMP allows devices to shared physical memory with the hosts. Some tests might have problems under these condition. This macro tests the condition and raises a warning if the device is shared environment |
OMPVV_TEST_AND_SET_SHARED_ENVIRONMENT(var2set) |
This is like OMPVV_TEST_SHARED_ENVIRONMENT but additionally it sets the var2set variable to the result of the check |
The file template/ompvv_template.c
contains examples of how to use this macros in the context of a tests. If you want to use the makefile you can use any of the following commands:
#!bash
# Testing with messages
make VERBOSE=1 VERBOSE_TESTS=1 MODULE_LOAD=1 CC=xlc SOURCES_C=template/ompvv_template.c
make VERBOSE=1 VERBOSE_TESTS=1 MODULE_LOAD=1 CC=gcc SOURCES_C=template/ompvv_template.c
make VERBOSE=1 VERBOSE_TESTS=1 MODULE_LOAD=1 CC=clang SOURCES_C=template/ompvv_template.c
# Testing with no messages
make VERBOSE=1 MODULE_LOAD=1 CC=xlc SOURCES_C=template/ompvv_template.c
make VERBOSE=1 MODULE_LOAD=1 CC=gcc SOURCES_C=template/ompvv_template.c
make VERBOSE=1 MODULE_LOAD=1 CC=clang SOURCES_C=template/ompvv_template.c