Skip to content

Commit

Permalink
Minor tweaks to HIP (#242)
Browse files Browse the repository at this point in the history
- better error handling with hipGetDeviceCount
  • Loading branch information
jrmadsen committed Jan 4, 2022
1 parent 0de0f48 commit 431912b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/timemory/components/hip/backends.hpp
Expand Up @@ -132,9 +132,13 @@ inline int
device_count()
{
#if defined(TIMEMORY_USE_HIP)
int dc = 0;
if(hipGetDeviceCount(&dc) != success_v)
int dc = 0;
auto err = hipGetDeviceCount(&dc);
if(err != success_v)
{
fprintf(stderr, "No hip devices found (%i): %s\n", dc, get_error_string(err));
return 0;
}
return dc;
#else
return 0;
Expand Down
2 changes: 2 additions & 0 deletions source/timemory/ert/counter.hpp
Expand Up @@ -32,6 +32,7 @@

#include "timemory/backends/device.hpp"
#include "timemory/backends/dmp.hpp"
#include "timemory/backends/hip.hpp"
#include "timemory/components/cuda/backends.hpp"
#include "timemory/components/timing/ert_timer.hpp"
#include "timemory/ert/aligned_allocator.hpp"
Expand All @@ -40,6 +41,7 @@
#include "timemory/ert/data.hpp"
#include "timemory/ert/types.hpp"
#include "timemory/mpl/apply.hpp"
#include "timemory/mpl/policy.hpp"
#include "timemory/settings/declaration.hpp"
#include "timemory/tpls/cereal/archives.hpp"
#include "timemory/utility/filepath.hpp"
Expand Down

0 comments on commit 431912b

Please sign in to comment.