173 MPI_DATASET *MPI_dataset = SDDS_dataset->MPI_dataset;
174 char *symbol, *units, *description, *format_string, *fixed_value, *filename, *path, *contents;
176 ELEMENT_DEF *column = NULL, *parameter = NULL, *array = NULL;
179 MPI_Datatype elementType, otherType, oldtypes[4], associateType;
183 MPI_Aint offsets[4], int_ext, short_ext, uint_ext;
184 MPI_Aint int_lb, short_lb, uint_lb;
186 MPI_Type_get_extent(MPI_INT, &int_lb, &int_ext);
187 MPI_Type_get_extent(MPI_UNSIGNED, &uint_lb, &uint_ext);
188 MPI_Type_get_extent(MPI_SHORT, &short_lb, &short_ext);
190 layout = &(SDDS_dataset->layout);
193 oldtypes[0] = MPI_INT;
195 offsets[1] = 13 * int_ext;
196 oldtypes[1] = MPI_CHAR;
197 blockcounts[1] = 256 + 256 + 256 + 1024 + 256 + 1024 + 256;
199 MPI_Type_create_struct(2, blockcounts, offsets, oldtypes, &elementType);
200 MPI_Type_commit(&elementType);
204 oldtypes[0] = MPI_INT;
207 offsets[1] = 15 * int_ext;
208 oldtypes[1] = MPI_SHORT;
212 oldtypes[2] = MPI_UNSIGNED;
213 offsets[2] = offsets[1] + 4 * short_ext;
215 blockcounts[3] = 1024 + 1024 + 1024;
216 oldtypes[3] = MPI_CHAR;
217 offsets[3] = offsets[2] + 1 * uint_ext;
220 MPI_Type_create_struct(4, blockcounts, offsets, oldtypes, &otherType);
221 MPI_Type_commit(&otherType);
223 if (MPI_dataset->myid == 0) {
225 other.n_columns = layout->n_columns;
226 other.n_parameters = layout->n_parameters;
227 other.n_associates = layout->n_associates;
228 other.n_arrays = layout->n_arrays;
229 other.version = layout->version;
230 other.layout_offset = SDDS_dataset->pagecount_offset[0];
231 other.layout_written = layout->layout_written;
232 other.disconnected = layout->disconnected;
233 other.gzipFile = layout->gzipFile;
234 other.lzmaFile = layout->lzmaFile;
235 other.popenUsed = layout->popenUsed;
236 other.depth = layout->depth;
237 other.data_command_seen = layout->data_command_seen;
238 other.commentFlags = layout->commentFlags;
239 other.byteOrderDeclared = layout->byteOrderDeclared;
240 other.mode = layout->data_mode.mode;
241 other.lines_per_row = layout->data_mode.lines_per_row;
242 other.no_row_counts = layout->data_mode.no_row_counts;
243 other.fixed_row_count = layout->data_mode.fixed_row_count;
244 other.column_memory_mode = layout->data_mode.column_memory_mode;
245 other.fsync_data = layout->data_mode.fsync_data;
246 other.additional_header_lines = layout->data_mode.additional_header_lines;
247 other.description_len = other.contents_len = other.filename_len = 0;
248 other.description[0] = other.contents[0] = other.filename[0] =
'\0';
249 other.swapByteOrder = SDDS_dataset->swapByteOrder;
251 if (layout->description) {
252 other.description_len = strlen(layout->description);
253 sprintf(other.description,
"%s", layout->description);
255 if (layout->contents) {
256 other.contents_len = strlen(layout->contents);
257 sprintf(other.contents,
"%s", layout->contents);
259 if (layout->filename) {
260 other.filename_len = strlen(layout->filename);
261 sprintf(other.filename,
"%s", layout->filename);
271 MPI_Bcast(&other, 1, otherType, 0, MPI_dataset->comm);
272 MPI_Type_free(&otherType);
274 column = malloc(
sizeof(*column) * other.n_columns);
275 if (other.n_parameters)
276 parameter = malloc(
sizeof(*parameter) * other.n_parameters);
278 array = malloc(
sizeof(*array) * other.n_arrays);
279 if (other.n_associates)
280 associate = malloc(
sizeof(*associate) * other.n_associates);
281 if (MPI_dataset->myid == 0) {
283 for (i = 0; i < other.n_columns; i++) {
285 SDDS_SetError(
"Unable to zero memory for columns(SDDS_MPI_InitializeInput)");
288 column[i].type = layout->column_definition[i].type;
289 column[i].field_length = layout->column_definition[i].field_length;
290 column[i].definition_mode = layout->column_definition[i].definition_mode;
291 column[i].memory_number = layout->column_definition[i].memory_number;
292 column[i].pointer_number = layout->column_definition[i].pointer_number;
293 if (layout->column_definition[i].name) {
294 column[i].name_len = strlen(layout->column_definition[i].name);
295 sprintf(column[i].name,
"%s", layout->column_definition[i].name);
297 if (layout->column_definition[i].symbol) {
298 column[i].symbol_len = strlen(layout->column_definition[i].symbol);
299 sprintf(column[i].symbol,
"%s", layout->column_definition[i].symbol);
301 if (layout->column_definition[i].units) {
302 column[i].units_len = strlen(layout->column_definition[i].units);
303 sprintf(column[i].units,
"%s", layout->column_definition[i].units);
305 if (layout->column_definition[i].description) {
306 column[i].description_len = strlen(layout->column_definition[i].description);
307 sprintf(column[i].description,
"%s", layout->column_definition[i].description);
309 if (layout->column_definition[i].format_string) {
310 column[i].format_string_len = strlen(layout->column_definition[i].format_string);
311 sprintf(column[i].format_string,
"%s", layout->column_definition[i].format_string);
314 for (i = 0; i < other.n_parameters; i++) {
316 SDDS_SetError(
"Unable to zero memory for parameters(SDDS_MPI_InitializeInput)");
319 parameter[i].type = layout->parameter_definition[i].type;
320 parameter[i].definition_mode = layout->parameter_definition[i].definition_mode;
321 parameter[i].memory_number = layout->parameter_definition[i].memory_number;
322 if (layout->parameter_definition[i].name) {
323 parameter[i].name_len = strlen(layout->parameter_definition[i].name);
324 sprintf(parameter[i].name,
"%s", layout->parameter_definition[i].name);
326 if (layout->parameter_definition[i].symbol) {
327 parameter[i].symbol_len = strlen(layout->parameter_definition[i].symbol);
328 sprintf(parameter[i].symbol,
"%s", layout->parameter_definition[i].symbol);
330 if (layout->parameter_definition[i].units) {
331 parameter[i].units_len = strlen(layout->parameter_definition[i].units);
332 sprintf(parameter[i].units,
"%s", layout->parameter_definition[i].units);
334 if (layout->parameter_definition[i].description) {
335 parameter[i].description_len = strlen(layout->parameter_definition[i].description);
336 sprintf(parameter[i].description,
"%s", layout->parameter_definition[i].description);
338 if (layout->parameter_definition[i].format_string) {
339 parameter[i].format_string_len = strlen(layout->parameter_definition[i].format_string);
340 sprintf(parameter[i].format_string,
"%s", layout->parameter_definition[i].format_string);
342 if (layout->parameter_definition[i].fixed_value) {
343 parameter[i].fixed_value_len = strlen(layout->parameter_definition[i].fixed_value);
344 sprintf(parameter[i].fixed_value,
"%s", layout->parameter_definition[i].fixed_value);
346 parameter[i].fixed_value_len = -1;
348 for (i = 0; i < other.n_arrays; i++) {
350 SDDS_SetError(
"Unable to zero memory for arrays(SDDS_MPI_InitializeInput)");
353 array[i].type = layout->array_definition[i].type;
354 array[i].field_length = layout->array_definition[i].field_length;
355 array[i].dimensions = layout->array_definition[i].dimensions;
356 if (layout->array_definition[i].name) {
357 array[i].name_len = strlen(layout->array_definition[i].name);
358 sprintf(array[i].name,
"%s", layout->array_definition[i].name);
360 if (layout->array_definition[i].symbol) {
361 array[i].symbol_len = strlen(layout->array_definition[i].symbol);
362 sprintf(array[i].symbol,
"%s", layout->array_definition[i].symbol);
364 if (layout->array_definition[i].units) {
365 array[i].units_len = strlen(layout->array_definition[i].units);
366 sprintf(array[i].units,
"%s", layout->array_definition[i].units);
368 if (layout->array_definition[i].description) {
369 array[i].description_len = strlen(layout->array_definition[i].description);
370 sprintf(array[i].description,
"%s", layout->array_definition[i].description);
372 if (layout->array_definition[i].format_string) {
373 array[i].format_string_len = strlen(layout->array_definition[i].format_string);
374 sprintf(array[i].format_string,
"%s", layout->array_definition[i].format_string);
376 if (layout->array_definition[i].group_name) {
377 array[i].group_name_len = strlen(layout->array_definition[i].group_name);
378 sprintf(array[i].group_name,
"%s", layout->array_definition[i].group_name);
381 for (i = 0; i < other.n_associates; i++) {
383 SDDS_SetError(
"Unable to zero memory for associates(SDDS_MPI_InitializeInput)");
386 associate[i].sdds = layout->associate_definition[i].sdds;
388 if (layout->associate_definition[i].name) {
389 associate[i].name_len = strlen(layout->associate_definition[i].name);
390 sprintf(associate[i].name,
"%s", layout->associate_definition[i].name);
392 if (layout->associate_definition[i].filename) {
393 associate[i].filename_len = strlen(layout->associate_definition[i].filename);
394 sprintf(associate[i].filename,
"%s", layout->associate_definition[i].filename);
396 if (layout->associate_definition[i].path) {
397 associate[i].path_len = strlen(layout->associate_definition[i].path);
398 sprintf(associate[i].path,
"%s", layout->associate_definition[i].path);
400 if (layout->associate_definition[i].description) {
401 associate[i].description_len = strlen(layout->associate_definition[i].description);
402 sprintf(associate[i].description,
"%s", layout->associate_definition[i].description);
404 if (layout->associate_definition[i].contents) {
405 associate[i].contents_len = strlen(layout->associate_definition[i].contents);
406 sprintf(associate[i].contents,
"%s", layout->associate_definition[i].contents);
410 SDDS_dataset->page_number = SDDS_dataset->page_started = 0;
411 layout->popenUsed = other.popenUsed;
412 layout->gzipFile = other.gzipFile;
413 layout->lzmaFile = other.lzmaFile;
414 layout->depth = other.depth;
415 layout->data_command_seen = other.data_command_seen;
416 layout->commentFlags = other.commentFlags;
417 layout->disconnected = other.disconnected;
418 layout->layout_written = other.layout_written;
419 if (other.filename_len)
421 layout->version = other.version;
422 layout->byteOrderDeclared = other.byteOrderDeclared;
423 layout->data_mode.mode = other.mode;
424 layout->data_mode.lines_per_row = other.lines_per_row;
425 layout->data_mode.no_row_counts = other.no_row_counts;
426 layout->data_mode.fixed_row_count = other.fixed_row_count;
427 layout->data_mode.fsync_data = other.fsync_data;
428 layout->data_mode.column_memory_mode = other.column_memory_mode;
429 layout->data_mode.additional_header_lines = other.additional_header_lines;
430 if (other.description_len)
432 if (other.contents_len)
434 SDDS_dataset->swapByteOrder = other.swapByteOrder;
437 MPI_Bcast(column, other.n_columns, elementType, 0, MPI_dataset->comm);
438 if (other.n_parameters)
439 MPI_Bcast(parameter, other.n_parameters, elementType, 0, MPI_dataset->comm);
441 MPI_Bcast(array, other.n_arrays, elementType, 0, MPI_dataset->comm);
442 MPI_Type_free(&elementType);
443 if (other.n_associates) {
446 oldtypes[0] = MPI_INT;
449 offsets[1] = 6 * int_ext;
450 oldtypes[1] = MPI_CHAR;
451 blockcounts[1] = 256 + 256 + 1024 + 1024 + 1024;
453 MPI_Type_create_struct(2, blockcounts, offsets, oldtypes, &associateType);
454 MPI_Type_commit(&associateType);
455 MPI_Bcast(associate, other.n_associates, associateType, 0, MPI_dataset->comm);
456 MPI_Type_free(&associateType);
458 if (MPI_dataset->myid) {
459 for (i = 0; i < other.n_columns; i++) {
460 symbol = units = description = format_string = NULL;
461 if (column[i].units_len)
463 if (column[i].description_len)
465 if (column[i].format_string_len)
467 if (column[i].symbol_len)
469 if (
SDDS_DefineColumn(SDDS_dataset, column[i].name, symbol, units, description, format_string, column[i].type, column[i].field_length) < 0) {
470 SDDS_SetError(
"Unable to define column (SDDS_MPI_BroadcastLayout)");
482 for (i = 0; i < other.n_parameters; i++) {
483 symbol = units = description = format_string = fixed_value = NULL;
484 if (parameter[i].units_len)
486 if (parameter[i].description_len)
488 if (parameter[i].format_string_len)
490 if (parameter[i].symbol_len)
492 if (parameter[i].fixed_value_len >= 0)
494 if (
SDDS_DefineParameter(SDDS_dataset, parameter[i].name, symbol, units, description, format_string, parameter[i].type, fixed_value) < 0) {
495 SDDS_SetError(
"Unable to define parameter (SDDS_MPI_BroadcastLayout)");
509 for (i = 0; i < other.n_arrays; i++) {
510 if (
SDDS_DefineArray(SDDS_dataset, array[i].name, array[i].symbol, array[i].units, array[i].description, array[i].format_string, array[i].type, array[i].field_length, array[i].dimensions, array[i].group_name) < 0) {
511 SDDS_SetError(
"Unable to define array (SDDS_BroadcastLayout)");
515 for (i = 0; i < other.n_associates; i++) {
516 filename = path = description = contents = NULL;
517 if (associate[i].filename_len)
519 if (associate[i].path_len)
521 if (associate[i].description_len)
523 if (associate[i].contents_len)
525 if (
SDDS_DefineAssociate(SDDS_dataset, associate[i].name, filename, path, description, contents, associate[i].sdds) < 0) {
526 SDDS_SetError(
"Unable to define associate (SDDS_MPI_BroadcastLayout)");
539 SDDS_SetError(
"Unable to save layout (SDDS_BroadcastLayout)");
551 column = array = parameter = NULL;
553 MPI_dataset->file_offset = other.layout_offset;
603 MPI_DATASET *MPI_dataset = SDDS_dataset->MPI_dataset;
605#if defined(MASTER_READTITLE_ONLY)
606 if (MPI_dataset->myid == 0)
610 static char s[SDDS_MAXLINE];
614 if (
sizeof(gzFile) !=
sizeof(
void *)) {
615 SDDS_SetError(
"gzFile is not the same size as void *, possible corruption of the SDDS_LAYOUT structure");
620 SDDS_dataset->layout.gzipFile = SDDS_dataset->layout.lzmaFile = SDDS_dataset->layout.disconnected = SDDS_dataset->layout.popenUsed = 0;
621 SDDS_dataset->layout.depth = SDDS_dataset->layout.data_command_seen = SDDS_dataset->layout.commentFlags = 0;
623 SDDS_dataset->layout.filename = NULL;
625 sprintf(s,
"Memory allocation failure initializing file \"%s\" (SDDS_InitializeInput)", filename);
631 if (_setmode(_fileno(stdin), _O_BINARY) == -1) {
632 sprintf(s,
"unable to set stdin to binary mode");
637 SDDS_dataset->layout.fp = stdin;
640 if (!(extension = strrchr(filename,
'.')) || strcmp(extension,
".gz") != 0) {
642 if ((extension = strrchr(filename,
'.')) && ((strcmp(extension,
".lzma") == 0) || (strcmp(extension,
".xz") == 0))) {
643 SDDS_dataset->layout.lzmaFile = 1;
644 if (!(SDDS_dataset->layout.lzmafp = UnpackLZMAOpen(filename))) {
645 sprintf(s,
"Unable to open file \"%s\" for reading (SDDS_InitializeInput)", filename);
649 SDDS_dataset->layout.fp = SDDS_dataset->layout.lzmafp->fp;
651 if (!(SDDS_dataset->layout.fp =
UnpackFopen(filename, UNPACK_REQUIRE_SDDS | UNPACK_USE_PIPE, &SDDS_dataset->layout.popenUsed, NULL))) {
652 sprintf(s,
"Unable to open file \"%s\" for reading (SDDS_InitializeInput)", filename);
659 SDDS_dataset->layout.gzipFile = 1;
660 if (!(SDDS_dataset->layout.gzfp = UnpackGZipOpen(filename))) {
661 sprintf(s,
"Unable to open file \"%s\" for reading (SDDS_InitializeInput)", filename);
668 SDDS_dataset->page_number = SDDS_dataset->page_started = 0;
669 SDDS_dataset->file_had_data = 0;
672 if (SDDS_dataset->layout.gzipFile) {
673 if (!SDDS_GZipReadLayout(SDDS_dataset, SDDS_dataset->layout.gzfp))
677 if (SDDS_dataset->layout.lzmaFile) {
687 SDDS_dataset->layout.layout_written = 0;
691 if (SDDS_dataset->layout.n_columns &&
692 ((!(SDDS_dataset->column_flag = (int32_t *)
SDDS_Malloc(
sizeof(int32_t) * SDDS_dataset->layout.n_columns)) ||
693 !(SDDS_dataset->column_order = (int32_t *)
SDDS_Malloc(
sizeof(int32_t) * SDDS_dataset->layout.n_columns))) ||
694 (!
SDDS_SetMemory(SDDS_dataset->column_flag, SDDS_dataset->layout.n_columns,
SDDS_LONG, (int32_t)1, (int32_t)0) || !
SDDS_SetMemory(SDDS_dataset->column_order, SDDS_dataset->layout.n_columns,
SDDS_LONG, (int32_t)0, (int32_t)1)))) {
695 SDDS_SetError(
"Unable to initialize input--memory allocation failure (SDDS_InitializeInput)");
698 SDDS_dataset->mode = SDDS_READMODE;
699 SDDS_dataset->pagecount_offset = NULL;
700 if (!SDDS_dataset->layout.gzipFile && !SDDS_dataset->layout.lzmaFile && !SDDS_dataset->layout.popenUsed && SDDS_dataset->layout.filename) {
706 SDDS_dataset->pages_read = 0;
707 SDDS_dataset->pagecount_offset = malloc(
sizeof(*SDDS_dataset->pagecount_offset));
708 SDDS_dataset->pagecount_offset[0] = ftell(SDDS_dataset->layout.fp);
709 fseek(SDDS_dataset->layout.fp, 0, 2);
710 SDDS_dataset->endOfFile_offset = ftell(SDDS_dataset->layout.fp);
711 fseek(SDDS_dataset->layout.fp, SDDS_dataset->pagecount_offset[0], 0);
714 if (SDDS_dataset->layout.fp)
715 fclose(SDDS_dataset->layout.fp);
719#if defined(MASTER_READTITLE_ONLY)
723 MPI_dataset->file_offset = SDDS_dataset->pagecount_offset[0];
727 SDDS_SetError(
"(SDDS_MPI_File_Open)Unablle to open file for reading.");
731 MPI_File_get_size(MPI_dataset->MPI_file, &(MPI_dataset->file_size));
732 if (MPI_dataset->file_offset >= MPI_dataset->file_size) {
737 SDDS_dataset->parallel_io = 1;
929 MPI_DATASET *MPI_dataset = SDDS_dataset->MPI_dataset;
930 int32_t rows = 0, i, j, len, retrival = 0;
934 if (MPI_dataset->myid == 0) {
936 SDDS_SetError(
"SDDS_MPI_ReadParameterFile2: Error in reading input file");
941 MPI_Bcast(&rows, 1, MPI_INT, 0, MPI_dataset->comm);
942 MPI_Bcast(&retrival, 1, MPI_INT, 0, MPI_dataset->comm);
943 if (MPI_dataset->myid != 0) {
949 for (i = 0; i < SDDS_dataset->layout.n_parameters; i++) {
950 switch (SDDS_dataset->layout.parameter_definition[i].type) {
952 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_LONG_DOUBLE, 0, MPI_dataset->comm);
955 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_DOUBLE, 0, MPI_dataset->comm);
958 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_FLOAT, 0, MPI_dataset->comm);
961 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_INT64_T, 0, MPI_dataset->comm);
964 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_UINT64_T, 0, MPI_dataset->comm);
967 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_INT, 0, MPI_dataset->comm);
970 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_UNSIGNED, 0, MPI_dataset->comm);
973 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_SHORT, 0, MPI_dataset->comm);
976 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_UNSIGNED_SHORT, 0, MPI_dataset->comm);
979 if (MPI_dataset->myid == 0)
980 len = strlen(*(
char **)SDDS_dataset->parameter[i]);
981 MPI_Bcast(&len, 1, MPI_INT, 0, MPI_dataset->comm);
982 if (MPI_dataset->myid != 0)
983 SDDS_dataset->parameter[i] = (
char *)malloc(
sizeof(
char) * len);
984 MPI_Bcast(SDDS_dataset->parameter[i], len, MPI_BYTE, 0, MPI_dataset->comm);
987 MPI_Bcast(SDDS_dataset->parameter[i], 1, MPI_CHAR, 0, MPI_dataset->comm);
992 for (i = 0; i < SDDS_dataset->layout.n_arrays; i++) {
993 MPI_Bcast(&(SDDS_dataset->layout.array_definition[i].dimensions), 1, MPI_INT, 0, MPI_dataset->comm);
994 switch (SDDS_dataset->layout.array_definition[i].type) {
996 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_LONG_DOUBLE, 0, MPI_dataset->comm);
999 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_DOUBLE, 0, MPI_dataset->comm);
1002 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_FLOAT, 0, MPI_dataset->comm);
1005 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_INT64_T, 0, MPI_dataset->comm);
1008 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_UINT64_T, 0, MPI_dataset->comm);
1011 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_INT, 0, MPI_dataset->comm);
1014 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_UNSIGNED, 0, MPI_dataset->comm);
1017 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_SHORT, 0, MPI_dataset->comm);
1020 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_UNSIGNED_SHORT, 0, MPI_dataset->comm);
1023 str_val = malloc(
sizeof(*str_val) * SDDS_dataset->layout.array_definition[i].dimensions);
1024 if (MPI_dataset->myid == 0) {
1025 for (j = 0; j < SDDS_dataset->layout.array_definition[i].dimensions; j++)
1026 sprintf(str_val[j].str_value,
"%s", ((
char **)(SDDS_dataset->array[i].data))[j]);
1028 MPI_Bcast(str_val, SDDS_dataset->layout.array_definition[i].dimensions * 256, MPI_BYTE, 0, MPI_dataset->comm);
1029 if (MPI_dataset->myid) {
1030 for (j = 0; j < SDDS_dataset->layout.array_definition[i].dimensions; j++)
1031 SDDS_CopyString(&(((
char **)(SDDS_dataset->array[i].data))[j]), str_val[j].str_value);
1037 MPI_Bcast(SDDS_dataset->array[i].data, SDDS_dataset->layout.array_definition[i].dimensions, MPI_CHAR, 0, MPI_dataset->comm);
1043 SDDS_dataset->n_rows = SDDS_dataset->n_rows_allocated = rows;
1044 MPI_Bcast(SDDS_dataset->row_flag, rows, MPI_INT, 0, MPI_dataset->comm);
1045 for (i = 0; i < SDDS_dataset->layout.n_columns; i++) {
1046 switch (SDDS_dataset->layout.column_definition[i].type) {
1048 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_LONG_DOUBLE, 0, MPI_dataset->comm);
1051 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_DOUBLE, 0, MPI_dataset->comm);
1054 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_FLOAT, 0, MPI_dataset->comm);
1057 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_INT64_T, 0, MPI_dataset->comm);
1060 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_UINT64_T, 0, MPI_dataset->comm);
1063 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_INT, 0, MPI_dataset->comm);
1066 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_UNSIGNED, 0, MPI_dataset->comm);
1069 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_SHORT, 0, MPI_dataset->comm);
1072 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_UNSIGNED_SHORT, 0, MPI_dataset->comm);
1076 str_val = malloc(
sizeof(*str_val) * rows);
1077 if (MPI_dataset->myid == 0) {
1078 for (j = 0; j < rows; j++)
1079 sprintf(str_val[j].str_value,
"%s", ((
char **)SDDS_dataset->data[i])[j]);
1082 if (MPI_dataset->myid) {
1083 for (j = 0; j < rows; j++)
1084 SDDS_CopyString(&(((
char **)SDDS_dataset->data[i])[j]), str_val[j].str_value);
1088 MPI_Bcast(SDDS_dataset->data[i], rows, MPI_CHAR, 0, MPI_dataset->comm);