Skip to content

Commit

Permalink
Check enablement of managed memory in hmm test and example code (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfalders authored May 5, 2021
1 parent ffbc871 commit 313bfc2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions clients/include/testing_managed_malloc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ void testing_managed_malloc(Arguments& argus)

rocblas_int hot_calls = argus.iters;

// check managed memory enablement
int deviceID, hmm_enabled;
hipGetDevice(&deviceID);
hipDeviceGetAttribute(&hmm_enabled, hipDeviceAttributeManagedMemory, deviceID);
if(!hmm_enabled)
{
rocsolver_cout << "Managed memory not enabled on device. Skipping test..." << std::endl;
return;
}

// check non-supported values
// N/A

Expand Down
13 changes: 13 additions & 0 deletions clients/samples/example_hmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ int main() {
rocblas_handle handle;
rocblas_create_handle(&handle);

// check for enablement of managed memory
int deviceID, hmm_enabled;
hipGetDevice(&deviceID);
hipDeviceGetAttribute(&hmm_enabled,
hipDeviceAttributeManagedMemory,
deviceID);
if (!hmm_enabled)
{
printf("Managed memory not enabled on device %i\n", deviceID);
rocblas_destroy_handle(handle);
return 0;
}

// calculate the sizes of our arrays
size_t size_piv = (M < N) ? M : N; // count of Householder scalars

Expand Down

0 comments on commit 313bfc2

Please sign in to comment.