00001
00002
00003
00004
00005
00006
00007
00008 #include <assert.h>
00009 #include "adio.h"
00010 #include "adio_extern.h"
00011 #include "ad_pvfs2.h"
00012 #include "ad_pvfs2_io.h"
00013 #include "ad_pvfs2_common.h"
00014
00015 int ADIOI_PVFS2_StridedDtypeIO(ADIO_File fd, void *buf, int count,
00016 MPI_Datatype datatype, int file_ptr_type,
00017 ADIO_Offset offset, ADIO_Status *status, int
00018 *error_code,
00019 int rw_type)
00020 {
00021 int filetype_size = -1, ret = -1, filetype_is_contig = -1;
00022 int num_filetypes = 0, cur_flat_file_reg_off = 0;
00023 PVFS_Request tmp_mem_req, mem_req, tmp_file_req, file_req;
00024 PVFS_sysresp_io resp_io;
00025 ADIO_Offset off = -1, bytes_into_filetype = 0;
00026 MPI_Aint filetype_extent = -1;
00027 int etype_size = -1, i = -1;
00028 PVFS_size pvfs_disp = -1;
00029 ADIOI_Flatlist_node *flat_file_p = ADIOI_Flatlist;
00030
00031
00032 int pvfs_blk = 1;
00033 ADIOI_PVFS2_fs *pvfs_fs;
00034 static char myname[] = "ADIOI_PVFS2_STRIDED_DTYPE";
00035
00036 memset(&tmp_mem_req, 0, sizeof(PVFS_Request));
00037 memset(&mem_req, 0, sizeof(PVFS_Request));
00038 memset(&tmp_file_req, 0, sizeof(PVFS_Request));
00039 memset(&file_req, 0, sizeof(PVFS_Request));
00040
00041 pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr;
00042
00043 ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
00044
00045
00046 *error_code = MPI_SUCCESS;
00047
00048
00049
00050 MPI_Type_size(fd->filetype, &filetype_size);
00051 if (filetype_size == 0) {
00052 *error_code = MPI_SUCCESS;
00053 return -1;
00054 }
00055 MPI_Type_extent(fd->filetype, &filetype_extent);
00056 MPI_Type_size(fd->etype, &etype_size);
00057 if (filetype_size == 0) {
00058 *error_code = MPI_SUCCESS;
00059 return -1;
00060 }
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 pvfs_disp = fd->disp;
00071 if (file_ptr_type == ADIO_INDIVIDUAL)
00072 {
00073 if (filetype_is_contig)
00074 {
00075 off = fd->fp_ind - fd->disp;
00076 }
00077 else
00078 {
00079 int flag = 0;
00080
00081 while (flat_file_p->type != fd->filetype)
00082 {
00083 flat_file_p = flat_file_p->next;
00084 }
00085 num_filetypes = -1;
00086 while (!flag)
00087 {
00088 num_filetypes++;
00089 for (i = 0; i < flat_file_p->count; i++)
00090 {
00091
00092 if (flat_file_p->blocklens[i])
00093 {
00094 if (fd->disp + flat_file_p->indices[i] +
00095 (num_filetypes * filetype_extent) +
00096 flat_file_p->blocklens[i] > fd->fp_ind &&
00097 fd->disp + flat_file_p->indices[i] <=
00098 fd->fp_ind)
00099 {
00100 cur_flat_file_reg_off = fd->fp_ind -
00101 (fd->disp + flat_file_p->indices[i] +
00102 (num_filetypes * filetype_extent));
00103 flag = 1;
00104 break;
00105 }
00106 else
00107 bytes_into_filetype += flat_file_p->blocklens[i];
00108 }
00109 }
00110 }
00111
00112 assert(i != flat_file_p->count);
00113 off = bytes_into_filetype + cur_flat_file_reg_off;
00114 }
00115 }
00116 else
00117 {
00118 off = etype_size * offset;
00119 }
00120
00121 #ifdef DEBUG_DTYPE
00122 fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: (fd->fp_ind=%Ld,fd->disp=%Ld,"
00123 " offset=%Ld),(pvfs_disp=%Ld,off=%Ld)\n",
00124 fd->fp_ind, fd->disp, offset, pvfs_disp, off);
00125 #endif
00126
00127
00128
00129
00130 ret = convert_mpi_pvfs2_dtype(&datatype, &tmp_mem_req);
00131 if (ret < 0)
00132 {
00133 goto error_state;
00134 }
00135 ret = convert_mpi_pvfs2_dtype(&(fd->filetype), &tmp_file_req);
00136 if (ret < 0)
00137 {
00138 goto error_state;
00139 }
00140
00141 ret = PVFS_Request_contiguous(count, tmp_mem_req, &mem_req);
00142 if (ret != 0)
00143 fprintf(stderr, "ADIOI_PVFS2_stridedDtypeIO: error in final"
00144 " CONTIG memory type\n");
00145 PVFS_Request_free(&tmp_mem_req);
00146
00147
00148 ret = PVFS_Request_hindexed(1, &pvfs_blk, &pvfs_disp,
00149 tmp_file_req, &file_req);
00150 if (ret != 0)
00151 fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: error in final"
00152 " HINDEXED file type\n");
00153 PVFS_Request_free(&tmp_file_req);
00154
00155 if (rw_type == READ)
00156 ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, off, buf,
00157 mem_req, &(pvfs_fs->credentials), &resp_io);
00158 else
00159 ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, off, buf,
00160 mem_req, &(pvfs_fs->credentials), &resp_io);
00161
00162 if (ret != 0) {
00163 fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: Warning - PVFS_sys_"
00164 "read/write returned %d and completed %Ld bytes.\n",
00165 ret, resp_io.total_completed);
00166 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00167 MPIR_ERR_RECOVERABLE,
00168 myname, __LINE__,
00169 ADIOI_PVFS2_error_convert(ret),
00170 "Error in PVFS_sys_io \n", 0);
00171 goto error_state;
00172 }
00173
00174 if (file_ptr_type == ADIO_INDIVIDUAL)
00175 {
00176 fd->fp_ind = off += resp_io.total_completed;
00177 }
00178
00179 error_state:
00180 fd->fp_sys_posn = -1;
00181
00182 PVFS_Request_free(&mem_req);
00183 PVFS_Request_free(&file_req);
00184
00185 #ifdef DEBUG_DTYPE
00186 fprintf(stderr, "ADIOI_PVFS2_StridedDtypeIO: "
00187 "resp_io.total_completed=%Ld,ret=%d\n",
00188 resp_io.total_completed, ret);
00189 #endif
00190
00191 #ifdef HAVE_STATUS_SET_BYTES
00192 MPIR_Status_set_bytes(status, datatype, (int)resp_io.total_completed);
00193
00194
00195
00196 #endif
00197 return ret;
00198 }
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 int convert_mpi_pvfs2_dtype(MPI_Datatype *mpi_dtype,
00209 PVFS_Request *pvfs_dtype)
00210 {
00211 int num_int = -1, num_addr = -1, num_dtype = -1,
00212 combiner = -1, i = -1, ret = -1, leaf = -1;
00213 int *arr_int = NULL, *arr_addr = NULL;
00214 MPI_Datatype *arr_dtype = NULL;
00215 PVFS_Request *old_pvfs_dtype = NULL;
00216 PVFS_Request *old_pvfs_dtype_arr = NULL;
00217 int arr_count = -1;
00218 PVFS_size *pvfs_arr_disp = NULL;
00219 int *pvfs_arr_len = NULL;
00220
00221 MPI_Type_get_envelope(*mpi_dtype,
00222 &num_int,
00223 &num_addr,
00224 &num_dtype,
00225 &combiner);
00226
00227
00228
00229
00230 if (combiner == MPI_COMBINER_NAMED)
00231 {
00232 convert_named(mpi_dtype, pvfs_dtype, combiner);
00233 return 1;
00234 }
00235
00236
00237
00238
00239 if ((arr_int = ADIOI_Malloc(sizeof(int)*num_int)) == NULL)
00240 {
00241 fprintf(stderr, "Failed to allocate array_int\n");
00242 return -1;
00243 }
00244 if ((arr_addr = ADIOI_Malloc(sizeof(int)*num_addr)) == NULL)
00245 {
00246 ADIOI_Free(arr_int);
00247 fprintf(stderr, "Failed to allocate array_addr\n");
00248 return -1;
00249 }
00250 if ((arr_dtype = ADIOI_Malloc(sizeof(MPI_Datatype)*num_dtype)) == NULL)
00251 {
00252 ADIOI_Free(arr_int);
00253 ADIOI_Free(arr_addr);
00254 fprintf(stderr, "Failed to allocate array_dtypes\n");
00255 return -1;
00256 }
00257
00258 MPI_Type_get_contents(*mpi_dtype,
00259 num_int,
00260 num_addr,
00261 num_dtype,
00262 arr_int,
00263 arr_addr,
00264 arr_dtype);
00265
00266
00267
00268
00269 if (combiner != MPI_COMBINER_STRUCT)
00270 {
00271 if ((old_pvfs_dtype = ADIOI_Malloc(sizeof(PVFS_Request))) == NULL)
00272 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00273 "Failed to allocate PVFS_Request\n");
00274 switch (combiner)
00275 {
00276 case MPI_COMBINER_CONTIGUOUS:
00277 leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
00278 ret = PVFS_Request_contiguous(arr_int[0],
00279 *old_pvfs_dtype, pvfs_dtype);
00280 break;
00281 case MPI_COMBINER_VECTOR:
00282 leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
00283 ret = PVFS_Request_vector(arr_int[0], arr_int[1],
00284 arr_int[2], *old_pvfs_dtype,
00285 pvfs_dtype);
00286 break;
00287 case MPI_COMBINER_HVECTOR:
00288 leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
00289 ret = PVFS_Request_hvector(arr_int[0], arr_int[1],
00290 arr_addr[0], *old_pvfs_dtype,
00291 pvfs_dtype);
00292 break;
00293
00294
00295
00296
00297 case MPI_COMBINER_INDEXED:
00298 leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
00299 if ((pvfs_arr_disp =
00300 ADIOI_Malloc(arr_int[0]*sizeof(PVFS_size))) == 0)
00301 {
00302 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00303 "Failed to allocate pvfs_arr_disp\n");
00304 }
00305 for (i = 0; i < arr_int[0]; i++)
00306 {
00307 pvfs_arr_disp[i] =
00308 (PVFS_size) arr_int[arr_int[0]+1+i];
00309 }
00310 ret = PVFS_Request_indexed(arr_int[0], &arr_int[1],
00311 pvfs_arr_disp,
00312 *old_pvfs_dtype, pvfs_dtype);
00313 ADIOI_Free(pvfs_arr_disp);
00314 break;
00315 case MPI_COMBINER_HINDEXED:
00316 leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
00317 if ((pvfs_arr_disp =
00318 ADIOI_Malloc(arr_int[0]*sizeof(PVFS_size))) == 0)
00319 {
00320 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00321 "Failed to allocate pvfs_arr_disp\n");
00322 }
00323 for (i = 0; i < arr_int[0]; i++)
00324 {
00325 pvfs_arr_disp[i] =
00326 (PVFS_size) arr_addr[i];
00327 }
00328 ret = PVFS_Request_hindexed(arr_int[0], &arr_int[1],
00329 (int64_t *)&arr_addr[0],
00330 *old_pvfs_dtype, pvfs_dtype);
00331 ADIOI_Free(pvfs_arr_disp);
00332 break;
00333 case MPI_COMBINER_DUP:
00334 leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
00335 ret = PVFS_Request_contiguous(1,
00336 *old_pvfs_dtype, pvfs_dtype);
00337
00338 break;
00339 case MPI_COMBINER_INDEXED_BLOCK:
00340
00341 ADIOI_Free(old_pvfs_dtype);
00342 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00343 "INDEXED_BLOCK is unsupported\n");
00344 break;
00345 case MPI_COMBINER_HINDEXED_INTEGER:
00346 ADIOI_Free(old_pvfs_dtype);
00347 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00348 "HINDEXED_INTEGER is unsupported\n");
00349 break;
00350 case MPI_COMBINER_STRUCT_INTEGER:
00351 ADIOI_Free(old_pvfs_dtype);
00352 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00353 "STRUCT_INTEGER is unsupported\n");
00354 break;
00355 case MPI_COMBINER_SUBARRAY:
00356 ADIOI_Free(old_pvfs_dtype);
00357 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00358 "SUBARRAY is unsupported\n");
00359 break;
00360 case MPI_COMBINER_DARRAY:
00361 ADIOI_Free(old_pvfs_dtype);
00362 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00363 "DARRAY is unsupported\n");
00364 break;
00365 case MPI_COMBINER_F90_REAL:
00366 ADIOI_Free(old_pvfs_dtype);
00367 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00368 "F90_REAL is unsupported\n");
00369 break;
00370 case MPI_COMBINER_F90_COMPLEX:
00371 ADIOI_Free(old_pvfs_dtype);
00372 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00373 "F90_COMPLEX is unsupported\n");
00374 break;
00375 case MPI_COMBINER_F90_INTEGER:
00376 ADIOI_Free(old_pvfs_dtype);
00377 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00378 "F90_INTEGER is unsupported\n");
00379 break;
00380 case MPI_COMBINER_RESIZED:
00381 ADIOI_Free(old_pvfs_dtype);
00382 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00383 "RESIZED is unsupported\n");
00384 break;
00385 default:
00386 break;
00387 }
00388
00389 if (ret != 0)
00390 fprintf(stderr, "Error in PVFS_Request_* "
00391 "for a derived datatype\n");
00392
00393 #ifdef DEBUG_DTYPE
00394 print_dtype_info(combiner,
00395 num_int,
00396 num_addr,
00397 num_dtype,
00398 arr_int,
00399 arr_addr,
00400 arr_dtype);
00401 #endif
00402
00403 if (leaf != 1 && combiner != MPI_COMBINER_DUP)
00404 MPI_Type_free(&arr_dtype[0]);
00405
00406 ADIOI_Free(arr_int);
00407 ADIOI_Free(arr_addr);
00408 ADIOI_Free(arr_dtype);
00409
00410 PVFS_Request_free(old_pvfs_dtype);
00411 ADIOI_Free(old_pvfs_dtype);
00412
00413 return ret;
00414 }
00415 else
00416 {
00417 MPI_Aint mpi_lb = -1, mpi_extent = -1;
00418 PVFS_offset pvfs_lb = -1;
00419 PVFS_size pvfs_extent = -1;
00420 int has_lb_ub = 0;
00421
00422
00423
00424
00425
00426
00427
00428
00429 arr_count = 0;
00430 for (i = 0; i < arr_int[0]; i++)
00431 {
00432 if (arr_dtype[i] != MPI_LB &&
00433 arr_dtype[i] != MPI_UB)
00434 {
00435 arr_count++;
00436 }
00437 }
00438
00439 if (arr_int[0] != arr_count)
00440 {
00441 MPI_Type_get_extent(*mpi_dtype, &mpi_lb, &mpi_extent);
00442 pvfs_lb = mpi_lb;
00443 pvfs_extent = mpi_extent;
00444 if ((pvfs_arr_len = ADIOI_Malloc(arr_count*sizeof(int)))
00445 == NULL)
00446 {
00447 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00448 "Failed to allocate pvfs_arr_len\n");
00449 }
00450 has_lb_ub = 1;
00451 }
00452
00453 if ((old_pvfs_dtype_arr
00454 = ADIOI_Malloc(arr_count*sizeof(PVFS_Request))) == NULL)
00455 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00456 "Failed to allocate PVFS_Requests\n");
00457
00458 if ((pvfs_arr_disp = ADIOI_Malloc(arr_count*sizeof(PVFS_size)))
00459 == NULL)
00460 {
00461 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00462 "Failed to allocate pvfs_arr_disp\n");
00463 }
00464
00465 arr_count = 0;
00466 for (i = 0; i < arr_int[0]; i++)
00467 {
00468 if (arr_dtype[i] != MPI_LB &&
00469 arr_dtype[i] != MPI_UB)
00470 {
00471 leaf = convert_mpi_pvfs2_dtype(
00472 &arr_dtype[i], &old_pvfs_dtype_arr[arr_count]);
00473 if (leaf != 1)
00474 MPI_Type_free(&arr_dtype[i]);
00475 pvfs_arr_disp[arr_count] =
00476 (PVFS_size) arr_addr[i];
00477 if (has_lb_ub)
00478 {
00479 pvfs_arr_len[arr_count] =
00480 arr_int[i+1];
00481 }
00482 arr_count++;
00483 }
00484 }
00485
00486
00487
00488 if (has_lb_ub)
00489 {
00490 PVFS_Request *tmp_pvfs_dtype = NULL;
00491 if ((tmp_pvfs_dtype = ADIOI_Malloc(sizeof(PVFS_Request))) == NULL)
00492 fprintf(stderr, "convert_mpi_pvfs2_dtype: "
00493 "Failed to allocate PVFS_Request\n");
00494
00495 ret = PVFS_Request_struct(arr_count, pvfs_arr_len,
00496 pvfs_arr_disp,
00497 old_pvfs_dtype_arr, tmp_pvfs_dtype);
00498 if (ret != 0)
00499 fprintf(stderr, "Error in PVFS_Request_struct\n");
00500
00501 arr_count = 0;
00502 for (i = 0; i < arr_int[0]; i++)
00503 {
00504 if (arr_dtype[i] != MPI_LB &&
00505 arr_dtype[i] != MPI_UB)
00506 {
00507 PVFS_Request_free(&old_pvfs_dtype_arr[arr_count]);
00508 arr_count++;
00509 }
00510 }
00511
00512 #ifdef DEBUG_DTYPE
00513 fprintf(stderr, "STRUCT(WITHOUT %d LB or UB)(%d,[",
00514 arr_int[0] - arr_count, arr_count);
00515 for (i = 0; i < arr_count; i++)
00516 fprintf(stderr, "(%d,%Ld) ",
00517 pvfs_arr_len[i],
00518 pvfs_arr_disp[i]);
00519 fprintf(stderr, "]\n");
00520 fprintf(stderr, "RESIZED(LB = %Ld, EXTENT = %Ld)\n",
00521 pvfs_lb, pvfs_extent);
00522 #endif
00523 ret = PVFS_Request_resized(*tmp_pvfs_dtype,
00524 pvfs_lb, pvfs_extent, pvfs_dtype);
00525 if (ret != 0)
00526 fprintf(stderr, "Error in PVFS_Request_resize\n");
00527
00528 PVFS_Request_free(tmp_pvfs_dtype);
00529 ADIOI_Free(tmp_pvfs_dtype);
00530 }
00531 else
00532 {
00533 ret = PVFS_Request_struct(arr_int[0], &arr_int[1],
00534 pvfs_arr_disp,
00535 old_pvfs_dtype_arr, pvfs_dtype);
00536 if (ret != 0)
00537 fprintf(stderr, "Error in PVFS_Request_struct\n");
00538
00539 for (i = 0; i < arr_int[0]; i++)
00540 {
00541 if (arr_dtype[i] != MPI_LB &&
00542 arr_dtype[i] != MPI_UB)
00543 PVFS_Request_free(&old_pvfs_dtype_arr[i]);
00544 }
00545
00546 #ifdef DEBUG_DTYPE
00547 print_dtype_info(combiner,
00548 num_int,
00549 num_addr,
00550 num_dtype,
00551 arr_int,
00552 arr_addr,
00553 arr_dtype);
00554 #endif
00555 }
00556
00557 ADIOI_Free(arr_int);
00558 ADIOI_Free(arr_addr);
00559 ADIOI_Free(arr_dtype);
00560
00561 ADIOI_Free(old_pvfs_dtype_arr);
00562 ADIOI_Free(pvfs_arr_disp);
00563 ADIOI_Free(pvfs_arr_len);
00564
00565 return ret;
00566 }
00567
00568
00569 fprintf(stderr, "convert_mpi_pvfs2_dtype: SERIOUS ERROR\n");
00570 return -1;
00571 }
00572
00573 int convert_named(MPI_Datatype *mpi_dtype,
00574 PVFS_Request *pvfs_dtype, int combiner)
00575 {
00576 int ret = -1;
00577 #ifdef DEBUG_DTYPE
00578 fprintf(stderr, "NAMED");
00579 #endif
00580
00581 switch (*mpi_dtype)
00582 {
00583 case MPI_CHAR:
00584 ret = PVFS_Request_contiguous(1, PVFS_CHAR, pvfs_dtype);
00585 #ifdef DEBUG_DTYPE
00586 fprintf(stderr, "-MPI_CHAR\n");
00587 #endif
00588 break;
00589 case MPI_BYTE:
00590 ret = PVFS_Request_contiguous(1, PVFS_BYTE, pvfs_dtype);
00591 #ifdef DEBUG_DTYPE
00592 fprintf(stderr, "-MPI_BYTE\n");
00593 #endif
00594 break;
00595 case MPI_SHORT:
00596 ret = PVFS_Request_contiguous(1, PVFS_SHORT, pvfs_dtype);
00597 #ifdef DEBUG_DTYPE
00598 fprintf(stderr, "-MPI_SHORT\n");
00599 #endif
00600 break;
00601 case MPI_INT:
00602 ret = PVFS_Request_contiguous(1, PVFS_INT, pvfs_dtype);
00603 #ifdef DEBUG_DTYPE
00604 fprintf(stderr, "-MPI_INT\n");
00605 #endif
00606 break;
00607 case MPI_LONG:
00608 ret = PVFS_Request_contiguous(1, PVFS_LONG, pvfs_dtype);
00609 #ifdef DEBUG_DTYPE
00610 fprintf(stderr, "-MPI_LONG\n");
00611 #endif
00612 break;
00613 case MPI_FLOAT:
00614 ret = PVFS_Request_contiguous(1, PVFS_FLOAT, pvfs_dtype);
00615 #ifdef DEBUG_DTYPE
00616 fprintf(stderr, "-MPI_FLOAT\n");
00617 #endif
00618 break;
00619 case MPI_DOUBLE:
00620 ret = PVFS_Request_contiguous(1, PVFS_DOUBLE, pvfs_dtype);
00621 #ifdef DEBUG_DTYPE
00622 fprintf(stderr, "-MPI_DOUBLE\n");
00623 #endif
00624 break;
00625 case MPI_UNSIGNED_CHAR:
00626 ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED_CHAR, pvfs_dtype);
00627 #ifdef DEBUG_DTYPE
00628 fprintf(stderr, "-MPI_UNSIGNED_CHAR\n");
00629 #endif
00630 break;
00631 case MPI_UNSIGNED_SHORT:
00632 ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED, pvfs_dtype);
00633 #ifdef DEBUG_DTYPE
00634 fprintf(stderr, "-MPI_UNSIGNED_SHORT\n");
00635 #endif
00636 break;
00637 case MPI_UNSIGNED:
00638 ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED, pvfs_dtype);
00639 #ifdef DEBUG_DTYPE
00640 fprintf(stderr, "-MPI_SHORT\n");
00641 #endif
00642 break;
00643 case MPI_UNSIGNED_LONG:
00644 ret = PVFS_Request_contiguous(1, PVFS_UNSIGNED_LONG, pvfs_dtype);
00645 #ifdef DEBUG_DTYPE
00646 fprintf(stderr, "-MPI_UNSIGNED_LONG\n");
00647 #endif
00648 break;
00649 case MPI_LONG_DOUBLE:
00650 ret = PVFS_Request_contiguous(1, PVFS_LONG_DOUBLE, pvfs_dtype);
00651 #ifdef DEBUG_DTYPE
00652 fprintf(stderr, "-MPI_LONG_DOUBLE\n");
00653 #endif
00654 break;
00655 default:
00656 fprintf(stderr, "convert_named: predefined type not found");
00657 return -1;
00658 break;
00659 }
00660 if (ret != 0)
00661 fprintf(stderr, "convert_named: Datatype creation failed\n");
00662 return ret;
00663 }
00664
00665 void print_dtype_info(int combiner,
00666 int num_int,
00667 int num_addr,
00668 int num_dtype,
00669 int *arr_int,
00670 MPI_Aint *arr_addr,
00671 MPI_Datatype *arr_dtype)
00672 {
00673 int i = -1;
00674 switch (combiner)
00675 {
00676 case MPI_COMBINER_CONTIGUOUS:
00677 fprintf(stderr, "CONTIG(%d)\n", arr_int[0]);
00678 break;
00679 case MPI_COMBINER_VECTOR:
00680 fprintf(stderr, "VECTOR(%d,%d,%d)\n",
00681 arr_int[0], arr_int[1], arr_int[2]);
00682 break;
00683 case MPI_COMBINER_HVECTOR:
00684 fprintf(stderr, "HVECTOR(%d,%d,%d)\n",
00685 arr_int[0], arr_int[1],arr_addr[0]);
00686 break;
00687 case MPI_COMBINER_INDEXED:
00688 fprintf(stderr, "INDEXED(%d,[",
00689 arr_int[0]);
00690 for (i = 0; i < arr_int[0]; i++)
00691 fprintf(stderr, "(%d,%Ld) ",
00692 arr_int[1+i],
00693 (int64_t) arr_int[arr_int[0]+1+i]);
00694 fprintf(stderr, "]\n");
00695 break;
00696 case MPI_COMBINER_HINDEXED:
00697 fprintf(stderr, "HINDEXED(%d,[",
00698 arr_int[0]);
00699 for (i = 0; i < arr_int[0]; i++)
00700 fprintf(stderr, "(%d,%Ld) ",
00701 arr_int[1+i],
00702 (int64_t) arr_addr[i]);
00703 fprintf(stderr, "]\n");
00704 break;
00705 case MPI_COMBINER_STRUCT:
00706 fprintf(stderr, "STRUCT(%d,[",
00707 arr_int[0]);
00708 for (i = 0; i < arr_int[0]; i++)
00709 fprintf(stderr, "(%d,%Ld) ",
00710 arr_int[1+i],
00711 (int64_t) arr_addr[i]);
00712 fprintf(stderr, "]\n");
00713 break;
00714 case MPI_COMBINER_DUP:
00715 fprintf(stderr, "DUP\n");
00716 break;
00717 default:
00718 fprintf(stderr, "no available information on this datatype");
00719 }
00720 }