@@ -207,12 +207,17 @@ TEST_P(umfIpcTest, BasicFlow) {
207207 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
208208 ASSERT_EQ (handleFullSize, handleHalfSize);
209209
210+ umf_ipc_handler_handle_t ipcHandler = nullptr ;
211+ ret = umfPoolGetIPCHandler (pool.get (), &ipcHandler);
212+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
213+ ASSERT_NE (ipcHandler, nullptr );
214+
210215 void *fullArray = nullptr ;
211- ret = umfOpenIPCHandle (pool. get () , ipcHandleFull, &fullArray);
216+ ret = umfOpenIPCHandle (ipcHandler , ipcHandleFull, &fullArray);
212217 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
213218
214219 void *halfArray = nullptr ;
215- ret = umfOpenIPCHandle (pool. get () , ipcHandleHalf, &halfArray);
220+ ret = umfOpenIPCHandle (ipcHandler , ipcHandleHalf, &halfArray);
216221 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
217222
218223 std::vector<int > actual_data (SIZE);
@@ -276,8 +281,13 @@ TEST_P(umfIpcTest, GetPoolByOpenedHandle) {
276281
277282 for (size_t pool_id = 0 ; pool_id < NUM_POOLS; pool_id++) {
278283 void *ptr = nullptr ;
284+ umf_ipc_handler_handle_t ipcHandler = nullptr ;
279285 ret =
280- umfOpenIPCHandle (pools_to_open[pool_id].get (), ipcHandle, &ptr);
286+ umfPoolGetIPCHandler (pools_to_open[pool_id].get (), &ipcHandler);
287+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
288+ ASSERT_NE (ipcHandler, nullptr );
289+
290+ ret = umfOpenIPCHandle (ipcHandler, ipcHandle, &ptr);
281291 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
282292 openedPtrs[pool_id][i] = ptr;
283293 }
@@ -311,16 +321,22 @@ TEST_P(umfIpcTest, GetPoolByOpenedHandle) {
311321TEST_P (umfIpcTest, AllocFreeAllocTest) {
312322 constexpr size_t SIZE = 64 * 1024 ;
313323 umf::pool_unique_handle_t pool = makePool ();
324+ umf_ipc_handler_handle_t ipcHandler = nullptr ;
325+
326+ umf_result_t ret = umfPoolGetIPCHandler (pool.get (), &ipcHandler);
327+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
328+ ASSERT_NE (ipcHandler, nullptr );
329+
314330 void *ptr = umfPoolMalloc (pool.get (), SIZE);
315331 EXPECT_NE (ptr, nullptr );
316332
317333 umf_ipc_handle_t ipcHandle = nullptr ;
318334 size_t handleSize = 0 ;
319- umf_result_t ret = umfGetIPCHandle (ptr, &ipcHandle, &handleSize);
335+ ret = umfGetIPCHandle (ptr, &ipcHandle, &handleSize);
320336 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
321337
322338 void *opened_ptr = nullptr ;
323- ret = umfOpenIPCHandle (pool. get () , ipcHandle, &opened_ptr);
339+ ret = umfOpenIPCHandle (ipcHandler , ipcHandle, &opened_ptr);
324340 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
325341
326342 ret = umfCloseIPCHandle (opened_ptr);
@@ -343,7 +359,7 @@ TEST_P(umfIpcTest, AllocFreeAllocTest) {
343359 ret = umfGetIPCHandle (ptr, &ipcHandle, &handleSize);
344360 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
345361
346- ret = umfOpenIPCHandle (pool. get () , ipcHandle, &opened_ptr);
362+ ret = umfOpenIPCHandle (ipcHandler , ipcHandle, &opened_ptr);
347363 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
348364
349365 ret = umfCloseIPCHandle (opened_ptr);
@@ -362,11 +378,22 @@ TEST_P(umfIpcTest, AllocFreeAllocTest) {
362378 EXPECT_EQ (stat.openCount , stat.closeCount );
363379}
364380
365- TEST_P (umfIpcTest, openInTwoPools ) {
381+ TEST_P (umfIpcTest, openInTwoIpcHandlers ) {
366382 constexpr size_t SIZE = 100 ;
367383 std::vector<int > expected_data (SIZE);
368384 umf::pool_unique_handle_t pool1 = makePool ();
369385 umf::pool_unique_handle_t pool2 = makePool ();
386+ umf_ipc_handler_handle_t ipcHandler1 = nullptr ;
387+ umf_ipc_handler_handle_t ipcHandler2 = nullptr ;
388+
389+ umf_result_t ret = umfPoolGetIPCHandler (pool1.get (), &ipcHandler1);
390+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
391+ ASSERT_NE (ipcHandler1, nullptr );
392+
393+ ret = umfPoolGetIPCHandler (pool2.get (), &ipcHandler2);
394+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
395+ ASSERT_NE (ipcHandler2, nullptr );
396+
370397 void *ptr = umfPoolMalloc (pool1.get (), sizeof (expected_data[0 ]) * SIZE);
371398 EXPECT_NE (ptr, nullptr );
372399
@@ -375,15 +402,15 @@ TEST_P(umfIpcTest, openInTwoPools) {
375402
376403 umf_ipc_handle_t ipcHandle = nullptr ;
377404 size_t handleSize = 0 ;
378- umf_result_t ret = umfGetIPCHandle (ptr, &ipcHandle, &handleSize);
405+ ret = umfGetIPCHandle (ptr, &ipcHandle, &handleSize);
379406 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
380407
381408 void *openedPtr1 = nullptr ;
382- ret = umfOpenIPCHandle (pool1. get () , ipcHandle, &openedPtr1);
409+ ret = umfOpenIPCHandle (ipcHandler1 , ipcHandle, &openedPtr1);
383410 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
384411
385412 void *openedPtr2 = nullptr ;
386- ret = umfOpenIPCHandle (pool2. get () , ipcHandle, &openedPtr2);
413+ ret = umfOpenIPCHandle (ipcHandler2 , ipcHandle, &openedPtr2);
387414 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
388415
389416 ret = umfPutIPCHandle (ipcHandle);
@@ -466,6 +493,7 @@ TEST_P(umfIpcTest, ConcurrentGetPutHandles) {
466493}
467494
468495TEST_P (umfIpcTest, ConcurrentOpenCloseHandles) {
496+ umf_result_t ret;
469497 std::vector<void *> ptrs;
470498 constexpr size_t ALLOC_SIZE = 100 ;
471499 constexpr size_t NUM_POINTERS = 100 ;
@@ -481,21 +509,25 @@ TEST_P(umfIpcTest, ConcurrentOpenCloseHandles) {
481509 for (size_t i = 0 ; i < NUM_POINTERS; ++i) {
482510 umf_ipc_handle_t ipcHandle;
483511 size_t handleSize;
484- umf_result_t ret = umfGetIPCHandle (ptrs[i], &ipcHandle, &handleSize);
512+ ret = umfGetIPCHandle (ptrs[i], &ipcHandle, &handleSize);
485513 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
486514 ipcHandles[i] = ipcHandle;
487515 }
488516
489517 std::array<std::vector<void *>, NTHREADS> openedIpcHandles;
518+ umf_ipc_handler_handle_t ipcHandler = nullptr ;
519+ ret = umfPoolGetIPCHandler (pool.get (), &ipcHandler);
520+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
521+ ASSERT_NE (ipcHandler, nullptr );
490522
491523 umf_test::syncthreads_barrier syncthreads (NTHREADS);
492524
493525 auto openHandlesFn = [&ipcHandles, &openedIpcHandles, &syncthreads,
494- &pool ](size_t tid) {
526+ ipcHandler ](size_t tid) {
495527 syncthreads ();
496528 for (auto ipcHandle : ipcHandles) {
497529 void *ptr;
498- umf_result_t ret = umfOpenIPCHandle (pool. get () , ipcHandle, &ptr);
530+ umf_result_t ret = umfOpenIPCHandle (ipcHandler , ipcHandle, &ptr);
499531 ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
500532 openedIpcHandles[tid].push_back (ptr);
501533 }
@@ -514,12 +546,12 @@ TEST_P(umfIpcTest, ConcurrentOpenCloseHandles) {
514546 umf_test::parallel_exec (NTHREADS, closeHandlesFn);
515547
516548 for (auto ipcHandle : ipcHandles) {
517- umf_result_t ret = umfPutIPCHandle (ipcHandle);
549+ ret = umfPutIPCHandle (ipcHandle);
518550 EXPECT_EQ (ret, UMF_RESULT_SUCCESS);
519551 }
520552
521553 for (void *ptr : ptrs) {
522- umf_result_t ret = umfPoolFree (pool.get (), ptr);
554+ ret = umfPoolFree (pool.get (), ptr);
523555 EXPECT_EQ (ret,
524556 get_umf_result_of_free (freeNotSupported, UMF_RESULT_SUCCESS));
525557 }
0 commit comments