| 1 | #include <stdio.h> |
|---|
| 2 | #include <mpi.h> |
|---|
| 3 | #include "mpitest.h" |
|---|
| 4 | |
|---|
| 5 | void foo(void *sendbuf, MPI_Datatype sendtype, void *recvbuf, MPI_Datatype recvtype) |
|---|
| 6 | { |
|---|
| 7 | int blocks[2]; |
|---|
| 8 | MPI_Aint struct_displs[2]; |
|---|
| 9 | MPI_Datatype types[2], tmp_type; |
|---|
| 10 | |
|---|
| 11 | blocks[0] = 256; |
|---|
| 12 | struct_displs[0] = (MPI_Aint) sendbuf; |
|---|
| 13 | types[0] = sendtype; |
|---|
| 14 | blocks[1] = 256; |
|---|
| 15 | struct_displs[1] = (MPI_Aint) recvbuf; |
|---|
| 16 | types[1] = MPI_BYTE; |
|---|
| 17 | |
|---|
| 18 | MPI_Type_create_struct(2, blocks, struct_displs, types, &tmp_type); |
|---|
| 19 | MPI_Type_commit(&tmp_type); |
|---|
| 20 | MPI_Type_free(&tmp_type); |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | int main(int argc, char **argv) |
|---|
| 24 | { |
|---|
| 25 | int errs = 0; |
|---|
| 26 | |
|---|
| 27 | MTest_Init(&argc, &argv); |
|---|
| 28 | |
|---|
| 29 | foo((void*) 0x1, MPI_FLOAT_INT, (void*) 0x2, MPI_BYTE); |
|---|
| 30 | foo((void*) 0x1, MPI_DOUBLE_INT, (void*) 0x2, MPI_BYTE); |
|---|
| 31 | foo((void*) 0x1, MPI_LONG_INT, (void*) 0x2, MPI_BYTE); |
|---|
| 32 | foo((void*) 0x1, MPI_SHORT_INT, (void*) 0x2, MPI_BYTE); |
|---|
| 33 | foo((void*) 0x1, MPI_2INT, (void*) 0x2, MPI_BYTE); |
|---|
| 34 | foo((void*) 0x1, MPI_LONG_DOUBLE_INT, (void*) 0x2, MPI_BYTE); |
|---|
| 35 | |
|---|
| 36 | MTest_Finalize(errs); |
|---|
| 37 | MPI_Finalize(); |
|---|
| 38 | |
|---|
| 39 | return 0; |
|---|
| 40 | } |
|---|