1
1

Merge pull request #6330 from ggouaillardet/topic/v4.0.x/ompi_datatype_set_args

ompi/datatype: fix how we compute the space needed for the args
Этот коммит содержится в:
Howard Pritchard 2019-02-08 14:44:08 -07:00 коммит произвёл GitHub
родитель d84322076f fd157a960a
Коммит 8552d0e608
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 52 добавлений и 3 удалений

Просмотреть файл

@ -13,7 +13,7 @@
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2017 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015-2017 Research Organization for Information Science
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
@ -237,6 +237,8 @@ int32_t ompi_datatype_set_args( ompi_datatype_t* pData,
*/
OBJ_RETAIN( d[pos] );
pArgs->total_pack_size += ((ompi_datatype_args_t*)d[pos]->args)->total_pack_size;
} else {
pArgs->total_pack_size += sizeof(int); /* _NAMED */
}
pArgs->total_pack_size += sizeof(int); /* each data has an ID */
}

Просмотреть файл

@ -51,7 +51,7 @@ main(int argc, char* argv[])
int ret = 0;
int blen[4];
ptrdiff_t disp[4];
ompi_datatype_t *newType, *types[4], *struct_type, *vec_type;
ompi_datatype_t *newType, *types[4], *struct_type, *vec_type, *dup_type;
ptrdiff_t old_lb, old_extent, old_true_lb, old_true_extent;
ptrdiff_t lb, extent, true_lb, true_extent;
@ -394,6 +394,53 @@ main(int argc, char* argv[])
ret = ompi_datatype_destroy(&unpacked_dt);
if (ret != 0) goto cleanup;
/**
*
* TEST 7
*
*/
printf("---> Basic test with dup'ed MPI_INT\n");
ret = get_extents(&ompi_mpi_int.dt, &old_lb, &old_extent, &old_true_lb, &old_true_extent);
if (ret != 0) goto cleanup;
ret = ompi_datatype_duplicate(&ompi_mpi_int.dt, &dup_type);
if (ret != 0) goto cleanup;
ompi_datatype_t * type = &ompi_mpi_int.dt;
ret = ompi_datatype_set_args(dup_type, 0, NULL, 0, NULL, 1, &type, MPI_COMBINER_DUP);
if (ret != 0) goto cleanup;
packed_ddt_len = ompi_datatype_pack_description_length(dup_type);
ptr = payload = malloc(packed_ddt_len);
ret = ompi_datatype_get_pack_description(dup_type, &packed_ddt);
if (ret != 0) goto cleanup;
memcpy(payload, packed_ddt, packed_ddt_len);
unpacked_dt = ompi_datatype_create_from_packed_description(&payload,
ompi_proc_local());
free(ptr);
if (unpacked_dt == NULL) {
printf("\tFAILED: could not unpack datatype\n");
ret = 1;
goto cleanup;
} else {
ret = get_extents(unpacked_dt, &lb, &extent, &true_lb, &true_extent);
if (ret != 0) goto cleanup;
if (old_lb != lb || old_extent != extent ||
old_true_lb != true_lb || old_true_extent != extent) {
printf("\tFAILED: datatypes don't match\n");
ret = 1;
goto cleanup;
}
printf("\tPASSED\n");
}
if (unpacked_dt == &ompi_mpi_int32_t.dt) {
printf("\tPASSED\n");
} else {
printf("\tFAILED: datatypes don't match\n");
ret = 1;
goto cleanup;
}
ompi_datatype_destroy(&dup_type);
cleanup:
ompi_datatype_finalize();