|
| 1 | +diff --git a/LIP/cpp_source/Implementation/LIP_MemoryManager.cpp b/LIP/cpp_source/Implementation/LIP_MemoryManager.cpp |
| 2 | +index 6fef6c3..7a237a3 100644 |
| 3 | +--- a/LIP/cpp_source/Implementation/LIP_MemoryManager.cpp |
| 4 | ++++ b/LIP/cpp_source/Implementation/LIP_MemoryManager.cpp |
| 5 | +@@ -36,6 +36,8 @@ |
| 6 | + |
| 7 | + #endif // UMPIRE_ENABLE_IPC_SHARED_MEMORY |
| 8 | + |
| 9 | ++using LIP_Umpire_Exception = umpire::out_of_memory_error::exception; |
| 10 | ++ |
| 11 | + #endif // LIP_USE_UMPIRE |
| 12 | + |
| 13 | + #include "LIP_MemoryManager.hxx" |
| 14 | +@@ -164,7 +166,7 @@ void* MemoryManager::allocate(std::size_t nbytes, MemoryType_t mem_type, |
| 15 | + #else |
| 16 | + ptr = alloc.allocate(nbytes); |
| 17 | + #endif |
| 18 | +- } catch (umpire::util::Exception &e) { |
| 19 | ++ } catch (LIP_Umpire_Exception &e) { |
| 20 | + // Just return the nullptr. |
| 21 | + // TODO: Throw exception instead? |
| 22 | + std::cout << "Umpire exception at allocation: " << e.what() << std::endl; |
| 23 | +@@ -219,7 +221,7 @@ void MemoryManager::deallocate(void *ptr, MemoryType_t mem_type) |
| 24 | + auto alloc = getUmpireAllocator(mem_type); |
| 25 | + alloc.deallocate(ptr); |
| 26 | + |
| 27 | +- } catch (umpire::util::Exception &e) { |
| 28 | ++ } catch (LIP_Umpire_Exception &e) { |
| 29 | + // Just catch the exception. No way to handle this. |
| 30 | + // TODO: Throw exception instead? |
| 31 | + // throw e; |
| 32 | +@@ -272,9 +274,9 @@ void MemoryManager::real_copy(void *dest, void *src, |
| 33 | + try { |
| 34 | + auto &rm = umpire::ResourceManager::getInstance(); |
| 35 | + rm.copy(dest, src, nbytes); |
| 36 | +- } catch (umpire::util::Exception e) { |
| 37 | ++ } catch (LIP_Umpire_Exception& e) { |
| 38 | + |
| 39 | +- std::string message(ERR_COPY_FAILED_S + " " + e.message() ); |
| 40 | ++ std::string message(ERR_COPY_FAILED_S + " " + e.what() ); |
| 41 | + status.setStatus(Status::SL_ERROR, __func__, ERR_COPY_FAILED, message); |
| 42 | + |
| 43 | + } |
| 44 | +@@ -326,7 +328,7 @@ bool MemoryManager::isMemoryOnCPU( MemoryType_t const mem_type ) |
| 45 | + */ |
| 46 | + return( platform == umpire::Platform::host); |
| 47 | + |
| 48 | +- } catch (umpire::util::Exception &e) { |
| 49 | ++ } catch (LIP_Umpire_Exception &e) { |
| 50 | + |
| 51 | + // TODO: Is there a better way to handle this? May cause crash soon after call. |
| 52 | + // TODO: Throw exception instead? |
| 53 | +@@ -367,7 +369,7 @@ bool MemoryManager::isMemoryOnGPU( MemoryType_t const mem_type ) |
| 54 | + return( platform == umpire::Platform::cuda); |
| 55 | + #endif |
| 56 | + |
| 57 | +- } catch (umpire::util::Exception &e) { |
| 58 | ++ } catch (LIP_Umpire_Exception &e) { |
| 59 | + |
| 60 | + // TODO: Is there a better way to handle this? May cause crash soon after call. |
| 61 | + // TODO: Throw exception instead? |
| 62 | +@@ -455,7 +457,7 @@ bool MemoryManager::isSharedMemory(MemoryType_t const mem_type) |
| 63 | + |
| 64 | + is_shared = isSharedAllocator(alloc); |
| 65 | + |
| 66 | +- } catch (umpire::util::Exception &e) { |
| 67 | ++ } catch (LIP_Umpire_Exception &e) { |
| 68 | + |
| 69 | + // TODO: Is there a better way to handle this? May cause crash soon after call. |
| 70 | + // TODO: Throw exception instead? |
| 71 | +@@ -506,7 +508,7 @@ bool MemoryManager::isMemoryOwner(MemoryType_t const mem_type ) |
| 72 | + |
| 73 | + isOwner = isMemoryOwner(alloc); |
| 74 | + |
| 75 | +- } catch (umpire::util::Exception &e) { |
| 76 | ++ } catch (LIP_Umpire_Exception &e) { |
| 77 | + // Just catch the exception. No way to handle this. |
| 78 | + // leave isOwner = true |
| 79 | + // TODO: Throw exception instead? |
| 80 | +@@ -578,7 +580,7 @@ void MemoryManager::syncSharedMemoryProcs(MemoryType_t const mem_type) |
| 81 | + umpire::get_communicator_for_allocator( alloc, base_comm_); |
| 82 | + |
| 83 | + |
| 84 | +- } catch (umpire::util::Exception &e) { |
| 85 | ++ } catch (LIP_Umpire_Exception &e) { |
| 86 | + // Just catch the exception. No way to handle this. |
| 87 | + // TODO: Throw exception instead? |
| 88 | + // throw e; |
| 89 | +@@ -740,7 +742,7 @@ bool MemoryManager::initializeUmpireIDMemory(MemoryType_t mem_type) |
| 90 | + |
| 91 | + status = initializeUmpireIDMemory(alloc); |
| 92 | + |
| 93 | +- } catch (umpire::util::Exception &e) { |
| 94 | ++ } catch (LIP_Umpire_Exception &e) { |
| 95 | + |
| 96 | + status = false; |
| 97 | + // TODO: Throw exception instead? |
| 98 | +@@ -785,7 +787,7 @@ bool MemoryManager::initializeUmpireIDMemory(umpire::Allocator &alloc) |
| 99 | + } |
| 100 | + } |
| 101 | + |
| 102 | +- } catch (umpire::util::Exception &e) { |
| 103 | ++ } catch (LIP_Umpire_Exception &e) { |
| 104 | + |
| 105 | + status = false; |
| 106 | + // TODO: Throw exception instead? |
0 commit comments