|
1 | 1 | /*
|
2 | 2 | * Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
|
3 |
| - * Copyright (c) 2021-2024 Triad National Security, LLC. All rights |
| 3 | + * Copyright (c) 2021-2022 Triad National Security, LLC. All rights |
4 | 4 | * reserved.
|
5 | 5 | *
|
6 | 6 | * $COPYRIGHT$
|
|
14 | 14 |
|
15 | 15 | OMPI_DECLSPEC extern mca_mtl_ofi_component_t mca_mtl_ofi_component;
|
16 | 16 |
|
| 17 | +OBJ_CLASS_INSTANCE(mca_mtl_comm_t, opal_object_t, NULL, NULL); |
| 18 | + |
17 | 19 | mca_mtl_ofi_module_t ompi_mtl_ofi = {
|
18 | 20 | {
|
19 | 21 | (int)((1ULL << MTL_OFI_CID_BIT_COUNT_1) - 1), /* max cid */
|
@@ -344,10 +346,43 @@ int ompi_mtl_ofi_add_comm(struct mca_mtl_base_module_t *mtl,
|
344 | 346 | struct ompi_communicator_t *comm)
|
345 | 347 | {
|
346 | 348 | int ret = OMPI_SUCCESS;
|
| 349 | + uint32_t comm_size; |
| 350 | + mca_mtl_comm_t* mtl_comm; |
347 | 351 |
|
348 | 352 | mca_mtl_ofi_ep_type ep_type = (0 == ompi_mtl_ofi.enable_sep) ?
|
349 | 353 | OFI_REGULAR_EP : OFI_SCALABLE_EP;
|
350 | 354 |
|
| 355 | + if (!OMPI_COMM_IS_GLOBAL_INDEX(comm)) { |
| 356 | + mtl_comm = OBJ_NEW(mca_mtl_comm_t); |
| 357 | + |
| 358 | + if (OMPI_COMM_IS_INTER(comm)) { |
| 359 | + comm_size = ompi_comm_remote_size(comm); |
| 360 | + } else { |
| 361 | + comm_size = ompi_comm_size(comm); |
| 362 | + } |
| 363 | + mtl_comm->c_index_vec = (c_index_vec_t *)malloc(sizeof(c_index_vec_t) * comm_size); |
| 364 | + if (NULL == mtl_comm->c_index_vec) { |
| 365 | + ret = OMPI_ERR_OUT_OF_RESOURCE; |
| 366 | + OBJ_RELEASE(mtl_comm); |
| 367 | + goto error; |
| 368 | + } else { |
| 369 | + for (uint32_t i=0; i < comm_size; i++) { |
| 370 | + mtl_comm->c_index_vec[i].c_index_state = MCA_MTL_OFI_CID_NOT_EXCHANGED; |
| 371 | + } |
| 372 | + } |
| 373 | + if (OMPI_COMM_IS_INTRA(comm)) { |
| 374 | + mtl_comm->c_index_vec[comm->c_my_rank].c_index = comm->c_index; |
| 375 | + mtl_comm->c_index_vec[comm->c_my_rank].c_index_state = MCA_MTL_OFI_CID_EXCHANGED; |
| 376 | + } |
| 377 | + |
| 378 | + comm->c_mtl_comm = mtl_comm; |
| 379 | + |
| 380 | + } else { |
| 381 | + |
| 382 | + comm->c_mtl_comm = NULL; |
| 383 | + |
| 384 | + } |
| 385 | + |
351 | 386 | /*
|
352 | 387 | * If thread grouping enabled, add new OFI context for each communicator
|
353 | 388 | * other than MPI_COMM_SELF.
|
@@ -377,6 +412,12 @@ int ompi_mtl_ofi_del_comm(struct mca_mtl_base_module_t *mtl,
|
377 | 412 | mca_mtl_ofi_ep_type ep_type = (0 == ompi_mtl_ofi.enable_sep) ?
|
378 | 413 | OFI_REGULAR_EP : OFI_SCALABLE_EP;
|
379 | 414 |
|
| 415 | + if(NULL != comm->c_mtl_comm) { |
| 416 | + free(comm->c_mtl_comm->c_index_vec); |
| 417 | + OBJ_RELEASE(comm->c_mtl_comm); |
| 418 | + comm->c_mtl_comm = NULL; |
| 419 | + } |
| 420 | + |
380 | 421 | /*
|
381 | 422 | * Clean up OFI contexts information.
|
382 | 423 | */
|
|
0 commit comments