00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "adio.h"
00010 #ifdef MPISGI
00011 #include "mpisgi2.h"
00012 #endif
00013
00014 #if (defined(MPICH) || defined(MPICH2))
00015
00016 void MPIR_Datatype_iscontig(MPI_Datatype datatype, int *flag){
00017 MPI_Datatype_iscontig(datatype, flag);
00018 }
00019
00020 void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag)
00021 {
00022 MPIR_Datatype_iscontig(datatype, flag);
00023 }
00024
00025 #elif (defined(MPIHP) && defined(HAVE_MPI_INFO))
00026
00027
00028 int hpmp_dtiscontig(MPI_Datatype datatype);
00029
00030 void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag)
00031 {
00032 *flag = hpmp_dtiscontig(datatype);
00033 }
00034
00035 #elif (defined(MPISGI) && !defined(NO_MPI_SGI_type_is_contig))
00036
00037 int MPI_SGI_type_is_contig(MPI_Datatype datatype);
00038
00039 void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag)
00040 {
00041 *flag = MPI_SGI_type_is_contig(datatype);
00042 }
00043
00044 #else
00045
00046 void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag)
00047 {
00048 int nints, nadds, ntypes, combiner;
00049 int *ints, ni, na, nt, cb;
00050 MPI_Aint *adds;
00051 MPI_Datatype *types;
00052
00053 MPI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner);
00054
00055 switch (combiner) {
00056 case MPI_COMBINER_NAMED:
00057 *flag = 1;
00058 break;
00059 case MPI_COMBINER_CONTIGUOUS:
00060 ints = (int *) ADIOI_Malloc((nints+1)*sizeof(int));
00061 adds = (MPI_Aint *) ADIOI_Malloc((nadds+1)*sizeof(MPI_Aint));
00062 types = (MPI_Datatype *) ADIOI_Malloc((ntypes+1)*sizeof(MPI_Datatype));
00063 MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints,
00064 adds, types);
00065 ADIOI_Datatype_iscontig(types[0], flag);
00066
00067 #ifndef MPISGI
00068
00069
00070 MPI_Type_get_envelope(types[0], &ni, &na, &nt, &cb);
00071 if (cb != MPI_COMBINER_NAMED) MPI_Type_free(types);
00072 #endif
00073
00074 ADIOI_Free(ints);
00075 ADIOI_Free(adds);
00076 ADIOI_Free(types);
00077 break;
00078 default:
00079 *flag = 0;
00080 break;
00081 }
00082
00083
00084
00085 }
00086 #endif