diff --git a/CMakeLists.txt b/CMakeLists.txt index bd80cba..e7cd019 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ add_executable(hipmalloc_hipmemset hipmalloc_hipmemset.cpp) add_executable(hipmallocmanaged_devaccess hipmallocmanaged_devaccess.cpp) add_executable(hipmallocmanaged_hostaccess hipmallocmanaged_hostaccess.cpp) add_executable(hipmallocmanaged_hipmemset hipmallocmanaged_hipmemset.cpp) +add_executable(can_map_host_memory can_map_host_memory.cpp) +add_executable(gcn_arch_name gcn_arch_name.cpp) enable_testing() add_test(NAME hipMalloc+HostAccess COMMAND hipmalloc_hostaccess) diff --git a/can_map_host_memory.cpp b/can_map_host_memory.cpp new file mode 100644 index 0000000..905de50 --- /dev/null +++ b/can_map_host_memory.cpp @@ -0,0 +1,24 @@ +#include +#include + +#define HIP(e) \ +if (hipError_t err = (e); err != hipSuccess) { \ + std::cerr << __FILE__ << ":" << __LINE__ << " " << err << "\n"; \ + exit(1); \ +} + +int main(void) { + + hipDeviceProp_t props; + HIP(hipGetDeviceProperties(&props, 0)); + + std::cout << "canMapHostMemory: " << props.canMapHostMemory << "\n"; + + if (props.canMapHostMemory) { + return 0; + } else { + return 1; + } +} + + diff --git a/gcn_arch_name.cpp b/gcn_arch_name.cpp new file mode 100644 index 0000000..4add45d --- /dev/null +++ b/gcn_arch_name.cpp @@ -0,0 +1,20 @@ +#include +#include + +#define HIP(e) \ +if (hipError_t err = (e); err != hipSuccess) { \ + std::cerr << __FILE__ << ":" << __LINE__ << " " << err << "\n"; \ + exit(1); \ +} + +int main(void) { + + hipDeviceProp_t props; + HIP(hipGetDeviceProperties(&props, 0)); + + std::cout << "gcnArchName: " << props.gcnArchName << "\n"; + + return 0; +} + + diff --git a/run.sh b/run.sh index 5e55097..c0dcdd0 100755 --- a/run.sh +++ b/run.sh @@ -38,15 +38,21 @@ echo "= HSA_XNACK unset $arch =" echo "================================" unset HSA_XNACK ctest --test-dir "build-$arch" +"build-$arch"/can_map_host_memory +"build-$arch"/gcn_arch_name echo "================================" echo "= HSA_XNACK=1 $arch =" echo "================================" export HSA_XNACK=1 ctest --test-dir "build-$arch" +"build-$arch"/can_map_host_memory +"build-$arch"/gcn_arch_name echo "================================" echo "= HSA_XNACK=0 $arch =" echo "================================" export HSA_XNACK=0 ctest --test-dir "build-$arch" +"build-$arch"/can_map_host_memory +"build-$arch"/gcn_arch_name done;