diff --git a/External/HIP/CMakeLists.txt b/External/HIP/CMakeLists.txt --- a/External/HIP/CMakeLists.txt +++ b/External/HIP/CMakeLists.txt @@ -5,8 +5,12 @@ # Create targets for HIP tests that are part of the test suite. macro(create_local_hip_tests VariantSuffix) set(VariantOffload "hip") + # Set per-source compilation/link options + set_source_files_properties(with_fopenmp.hip PROPERTIES + COMPILE_FLAGS -fopenmp) # Add HIP tests to be added to hip-tests-simple list(APPEND HIP_LOCAL_TESTS empty) + list(APPEND HIP_LOCAL_TESTS with_fopenmp) list(APPEND HIP_LOCAL_TESTS saxpy) foreach(_hip_test IN LISTS HIP_LOCAL_TESTS) create_one_local_test(${_hip_test} ${_hip_test}.hip diff --git a/External/HIP/with-fopenmp.hip b/External/HIP/with-fopenmp.hip new file mode 100644 --- /dev/null +++ b/External/HIP/with-fopenmp.hip @@ -0,0 +1,33 @@ +#include +#include + +// Test use of std::isnan in device and host code. + +namespace TestIsNan { +__device__ bool DevPass = false; + +__global__ void kernel() { + double X = 1.0; + DevPass = !std::isnan(X); +} + +bool test() { + double X = 1.0; + kernel<<<1, 1>>>(); + bool Pass; + hipMemcpyFromSymbol(&Pass, DevPass, sizeof(DevPass)); + return Pass & !std::isnan(X); +} +} + +int main() { + bool Pass = TestIsNan::test(); + + if (!Pass) { + printf("FAILED!\n"); + return 1; + } + + printf("PASSED!\n"); + return 0; +} diff --git a/External/HIP/with-fopenmp.reference_output b/External/HIP/with-fopenmp.reference_output new file mode 100644 --- /dev/null +++ b/External/HIP/with-fopenmp.reference_output @@ -0,0 +1,2 @@ +PASSED! +exit 0