Replace raw pointers for host_interface with shared_ptr to enable automatic memory handling
This commit is contained in:
@@ -77,8 +77,9 @@ IPCBackend::IPCBackend(MPI_Comm comm)
|
||||
bp->heap_ptr = &heap;
|
||||
|
||||
/* Initialize the host interface */
|
||||
host_interface =
|
||||
new HostInterface(hdp_proxy_.get(), thread_comm, &heap);
|
||||
host_interface = std::make_shared<HostInterface>(hdp_proxy_.get(),
|
||||
thread_comm,
|
||||
&heap);
|
||||
|
||||
default_host_ctx = std::make_unique<IPCHostContext>(this, 0);
|
||||
|
||||
@@ -117,11 +118,6 @@ IPCBackend::~IPCBackend() {
|
||||
*/
|
||||
CHECK_HIP(hipFree(bp->atomic_ret->atomic_base_ptr));
|
||||
|
||||
// TODO(Avinash) Free g_ret
|
||||
|
||||
// delete host_interface;
|
||||
// host_interface = nullptr;
|
||||
|
||||
/**
|
||||
* Destroy teams infrastructure
|
||||
* and team world
|
||||
|
||||
@@ -124,9 +124,9 @@ class IPCBackend : public Backend {
|
||||
|
||||
/**
|
||||
* @brief The host-facing interface that will be used
|
||||
* by all contexts of the ROBackend
|
||||
* by all contexts of the IPCBackend
|
||||
*/
|
||||
HostInterface *host_interface{nullptr};
|
||||
std::shared_ptr<HostInterface> host_interface{nullptr};
|
||||
|
||||
/**
|
||||
* @brief Scratchpad for the internal barrier algorithms.
|
||||
|
||||
@@ -136,8 +136,8 @@ class IPCHostContext : public Context {
|
||||
__host__ int test(T *ivars, int cmp, T val);
|
||||
|
||||
public:
|
||||
/* Pointer to the backend's host interface */
|
||||
HostInterface *host_interface{nullptr};
|
||||
/* Shared pointer to the backend's host interface */
|
||||
std::shared_ptr<HostInterface> host_interface{nullptr};
|
||||
|
||||
/* An MPI Window implements a context */
|
||||
WindowInfo *context_window_info{nullptr};
|
||||
|
||||
مرجع در شماره جدید
Block a user