minor changes

This commit is contained in:
Ruipeng Li 2022-06-09 15:16:03 -07:00
parent f7e652ca63
commit 78eb2ed9b3

View File

@ -47,6 +47,7 @@ hypre_WrongMemoryLocation()
void
hypre_CheckMemoryLocation(void *ptr, hypre_MemoryLocation location)
{
#if defined(HYPRE_DEBUG)
#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_HIP) || defined(HYPRE_USING_SYCL)
if (!ptr)
{
@ -59,6 +60,7 @@ hypre_CheckMemoryLocation(void *ptr, hypre_MemoryLocation location)
* will create an endless loop otherwise */
assert(location == location_ptr);
#endif
#endif
}
/*==========================================================================
@ -145,9 +147,7 @@ hypre_UnifiedMemPrefetch(void *ptr, size_t size, hypre_MemoryLocation location)
return;
}
#if defined(HYPRE_DEBUG)
hypre_CheckMemoryLocation(ptr, hypre_MEMORY_UNIFIED);
#endif
#if defined(HYPRE_USING_CUDA)
if (location == hypre_MEMORY_DEVICE)
@ -519,9 +519,7 @@ hypre_Free_core(void *ptr, hypre_MemoryLocation location)
return;
}
#if defined(HYPRE_DEBUG)
hypre_CheckMemoryLocation(ptr, location);
#endif
switch (location)
{
@ -576,13 +574,11 @@ hypre_Memcpy_core(void *dst, void *src, size_t size, hypre_MemoryLocation loc_ds
return;
}
#if defined(HYPRE_DEBUG)
if (size > 0)
{
hypre_CheckMemoryLocation(dst, loc_dst);
hypre_CheckMemoryLocation(src, loc_src);
}
#endif
/* Totally 4 x 4 = 16 cases */
@ -863,9 +859,7 @@ hypre_Memset(void *ptr, HYPRE_Int value, size_t num, HYPRE_MemoryLocation locati
return ptr;
}
#if defined(HYPRE_DEBUG)
hypre_CheckMemoryLocation(ptr, hypre_GetActualMemLocation(location));
#endif
switch (hypre_GetActualMemLocation(location))
{