1
1
so make check works without make install
Этот коммит содержится в:
Gilles Gouaillardet 2015-05-07 18:14:32 +09:00
родитель 8e3f0b1d33
Коммит 89882f11bd
2 изменённых файлов: 92 добавлений и 37 удалений

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

@ -4,7 +4,7 @@
# reserved.
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2014 Research Organization for Information Science
# Copyright (c) 2014-2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
@ -14,8 +14,8 @@
#
if PROJECT_OMPI
MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw unpack_ooo
MPI_CHECKS = to_self ddt_pack
MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw unpack_ooo ddt_pack
MPI_CHECKS = to_self
endif
TESTS = opal_datatype_test $(MPI_TESTS)

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

@ -32,12 +32,14 @@
#include <string.h>
#endif
static int get_extents(MPI_Datatype type, MPI_Aint *lb, MPI_Aint *extent, MPI_Aint *true_lb, MPI_Aint *true_extent) {
#include <poll.h>
static int get_extents(ompi_datatype_t * type, OPAL_PTRDIFF_TYPE *lb, OPAL_PTRDIFF_TYPE *extent, OPAL_PTRDIFF_TYPE *true_lb, OPAL_PTRDIFF_TYPE *true_extent) {
int ret;
ret = MPI_Type_get_extent(type, lb, extent);
ret = ompi_datatype_get_extent(type, lb, extent);
if (MPI_SUCCESS != ret) return ret;
ret = MPI_Type_get_true_extent(type, true_lb, true_extent);
ret = ompi_datatype_get_true_extent(type, true_lb, true_extent);
if (MPI_SUCCESS != ret) return ret;
return 0;
@ -52,12 +54,20 @@ main(int argc, char* argv[])
struct ompi_datatype_t *unpacked_dt;
int ret = 0;
int blen[4];
MPI_Aint disp[4];
MPI_Datatype newType, types[4], struct_type, vec_type;
MPI_Aint old_lb, old_extent, old_true_lb, old_true_extent;
MPI_Aint lb, extent, true_lb, true_extent;
OPAL_PTRDIFF_TYPE disp[4];
ompi_datatype_t *newType, *types[4], *struct_type, *vec_type;
OPAL_PTRDIFF_TYPE old_lb, old_extent, old_true_lb, old_true_extent;
OPAL_PTRDIFF_TYPE lb, extent, true_lb, true_extent;
MPI_Init(&argc, &argv);
/* make ompi_proc_local () work ... */
struct ompi_proc_t dummy_proc;
ompi_proc_local_proc = &dummy_proc;
int _dbg = 0;
while (_dbg) poll(NULL, 0, 1);
ompi_datatype_init();
/**
*
@ -68,16 +78,16 @@ main(int argc, char* argv[])
/* Basic test... */
printf("---> Basic test with MPI_INT\n");
packed_ddt_len = ompi_datatype_pack_description_length(MPI_INT);
packed_ddt_len = ompi_datatype_pack_description_length(&ompi_mpi_int.dt);
ptr = payload = malloc(packed_ddt_len);
ret = ompi_datatype_get_pack_description(MPI_INT, &packed_ddt);
ret = ompi_datatype_get_pack_description(&ompi_mpi_int.dt, &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 == MPI_INT32_T) {
if (unpacked_dt == &ompi_mpi_int32_t.dt) {
printf("\tPASSED\n");
} else {
printf("\tFAILED: datatypes don't match\n");
@ -94,11 +104,19 @@ main(int argc, char* argv[])
printf("---> Simple test using a struct and few predefined datatype (4 * MPI_INT).\n");
blen[0] = 1; blen[1] = 2; blen[2] = 3; blen[3] = 4;
disp[0] = 0; disp[1] = 4; disp[2] = 8; disp[3] = 12;
types[0] = MPI_INT; types[1] = MPI_INT; types[2] = MPI_INT; types[3] = MPI_INT;
ret = MPI_Type_create_struct( 4, blen, disp, types, &struct_type );
types[0] = &ompi_mpi_int.dt; types[1] = &ompi_mpi_int.dt; types[2] = &ompi_mpi_int.dt; types[3] = &ompi_mpi_int.dt;
ret = ompi_datatype_create_struct( 4, blen, disp, types, &struct_type );
if (ret != 0) goto cleanup;
ret = MPI_Type_commit(&struct_type);
{
int count = 4;
const int* a_i[2] = {&count, blen};
ret = ompi_datatype_set_args( struct_type, count + 1, a_i, count, disp,
count, types, MPI_COMBINER_STRUCT);
if (ret != 0) goto cleanup;
}
ret = ompi_datatype_commit(&struct_type);
if (ret != 0) goto cleanup;
ret = get_extents(struct_type, &old_lb, &old_extent, &old_true_lb, &old_true_extent);
@ -129,10 +147,10 @@ main(int argc, char* argv[])
}
printf("\tPASSED\n");
}
ret = MPI_Type_free(&struct_type);
ret = ompi_datatype_destroy(&struct_type);
if (ret != 0) goto cleanup;
ret = MPI_Type_free(&unpacked_dt);
ret = ompi_datatype_destroy(&unpacked_dt);
if (ret != 0) goto cleanup;
/**
@ -143,10 +161,20 @@ main(int argc, char* argv[])
printf("---> Less Basic test with MPI_Type_vector\n");
ret = MPI_Type_vector(2, 1, 1, MPI_INT, &vec_type);
ret = ompi_datatype_create_vector(2, 1, 1, &ompi_mpi_int.dt, &vec_type);
if (ret != 0) goto cleanup;
ret = MPI_Type_commit(&vec_type);
{
int count = 2;
int blocklength = 1;
int stride = 1;
const int* a_i[3] = {&count, &blocklength, &stride};
ompi_datatype_t * type = &ompi_mpi_int.dt;
ret = ompi_datatype_set_args(vec_type, 3, a_i, 0, NULL, 1, &type, MPI_COMBINER_VECTOR );
if (ret != 0) goto cleanup;
}
ret = ompi_datatype_commit(&vec_type);
if (ret != 0) goto cleanup;
ret = get_extents(vec_type, &old_lb, &old_extent, &old_true_lb, &old_true_extent);
@ -178,10 +206,10 @@ main(int argc, char* argv[])
}
printf("\tPASSED\n");
}
ret = MPI_Type_free(&vec_type);
ret = ompi_datatype_destroy(&vec_type);
if (ret != 0) goto cleanup;
ret = MPI_Type_free(&unpacked_dt);
ret = ompi_datatype_destroy(&unpacked_dt);
if (ret != 0) goto cleanup;
/**
@ -195,10 +223,20 @@ main(int argc, char* argv[])
blen[0] = 0;
blen[1] = 20*sizeof(double);
ret = MPI_Type_create_indexed_block(2, 10, blen, MPI_DOUBLE, &newType);
ret = ompi_datatype_create_indexed_block(2, 10, blen, &ompi_mpi_double.dt, &newType);
if (ret != 0) goto cleanup;
ret = MPI_Type_commit(&newType);
{
int count = 2;
int blocklength = 10;
const int* a_i[3] = {&count, &blocklength, blen};
ompi_datatype_t * oldtype = &ompi_mpi_double.dt;
ompi_datatype_set_args( newType, 2 + count, a_i, 0, NULL, 1, &oldtype,
MPI_COMBINER_INDEXED_BLOCK );
if (ret != 0) goto cleanup;
}
ret = ompi_datatype_commit(&newType);
if (ret != 0) goto cleanup;
ret = get_extents(newType, &old_lb, &old_extent, &old_true_lb, &old_true_extent);
@ -230,10 +268,10 @@ main(int argc, char* argv[])
}
printf("\tPASSED\n");
}
ret = MPI_Type_free(&newType);
ret = ompi_datatype_destroy(&newType);
if (ret != 0) goto cleanup;
ret = MPI_Type_free(&unpacked_dt);
ret = ompi_datatype_destroy(&unpacked_dt);
if (ret != 0) goto cleanup;
/**
@ -249,10 +287,19 @@ main(int argc, char* argv[])
disp[0] = 0;
disp[1] = 20*sizeof(double);
ret = MPI_Type_create_hindexed(2, blen, disp, MPI_DOUBLE, &newType);
ret = ompi_datatype_create_hindexed(2, blen, disp, &ompi_mpi_double.dt, &newType);
if (ret != 0) goto cleanup;
ret = MPI_Type_commit(&newType);
{
int count = 2;
const int* a_i[2] = {&count, blen};
ompi_datatype_t * oldtype = &ompi_mpi_double.dt;
ret = ompi_datatype_set_args( newType, count + 1, a_i, count, disp,
1, &oldtype, MPI_COMBINER_HINDEXED );
if (ret != 0) goto cleanup;
}
ret = ompi_datatype_commit(&newType);
if (ret != 0) goto cleanup;
ret = get_extents(newType, &old_lb, &old_extent, &old_true_lb, &old_true_extent);
@ -282,7 +329,7 @@ main(int argc, char* argv[])
}
printf("\tPASSED\n");
}
ret = MPI_Type_free(&newType);
ret = ompi_datatype_destroy(&newType);
if (ret != 0) goto cleanup;
newType = unpacked_dt; /* save it for later */
@ -298,15 +345,23 @@ main(int argc, char* argv[])
blen[1] = 2;
disp[0] = 0;
disp[1] = 64;
types[0] = MPI_INT;
types[0] = &ompi_mpi_int.dt;
types[1] = newType;
ret = MPI_Type_create_struct( 2, blen, disp, types, &struct_type );
ret = ompi_datatype_create_struct( 2, blen, disp, types, &struct_type );
if (ret != 0) goto cleanup;
ret = MPI_Type_commit(&struct_type);
{
int count = 2;
const int* a_i[2] = {&count, blen};
ret = ompi_datatype_set_args( struct_type, count + 1, a_i, count, disp,
count, types, MPI_COMBINER_STRUCT );
if (ret != 0) goto cleanup;
}
ret = ompi_datatype_commit(&struct_type);
if (ret != 0) goto cleanup;
ret = MPI_Type_free(&newType);
ret = ompi_datatype_destroy(&newType);
if (ret != 0) goto cleanup;
ret = get_extents(struct_type, &old_lb, &old_extent, &old_true_lb, &old_true_extent);
@ -337,15 +392,15 @@ main(int argc, char* argv[])
}
printf("\tPASSED\n");
}
ret = MPI_Type_free(&struct_type);
ret = ompi_datatype_destroy(&struct_type);
if (ret != 0) goto cleanup;
ret = MPI_Type_free(&unpacked_dt);
ret = ompi_datatype_destroy(&unpacked_dt);
if (ret != 0) goto cleanup;
cleanup:
MPI_Finalize();
ompi_datatype_finalize();
return ret;
}