diff options
Diffstat (limited to 'src/Panda/MPIFS.C')
-rw-r--r-- | src/Panda/MPIFS.C | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/src/Panda/MPIFS.C b/src/Panda/MPIFS.C index e8b56ae..560a0e2 100644 --- a/src/Panda/MPIFS.C +++ b/src/Panda/MPIFS.C @@ -8,7 +8,7 @@ #define Max_Open_Files 1000 -#include "external/IEEEIO/src/Arch.h" +#include "external/FlexIO/src/Arch.h" extern "C" { IOFile IEEEopen(char *,char *); @@ -544,9 +544,10 @@ Boolean MPIFS::received_quit_message(int msg_src, int msg_tag, IOFile MPIFS::open_file(char *name, int op_type) { + int i; IOFile fp; - for (int i=0; i<num_open_files_; i++) + for (i=0; i<num_open_files_; i++) if (!strcmp(name, open_file_names_[i])) { fp = open_file_ptrs_[i]; free(name); @@ -576,9 +577,16 @@ IOFile MPIFS::open_file(char *name, int op_type) Boolean MPIFS::is_new_file(char *name) { char name1[100]; - if (node_type() == PART_TIME_COMPUTE || node_type() == COMPUTE_NODE) return; - sprintf(name1, "%s.%d", name, my_rank(IO_NODE)); + if (node_type() == PART_TIME_COMPUTE || node_type() == COMPUTE_NODE) return NO; + if (app_size(IO_NODE) > 1) + { + sprintf(name1, "%s.file_%d.ieee", name, my_rank(IO_NODE)); + } + else + { + sprintf(name1, "%s.ieee", name); + } for (int i=0; i<num_open_files_; i++) if (!strcmp(name1, open_file_names_[i])) { if (is_new_file_[i] == YES) { @@ -611,10 +619,17 @@ void MPIFS::start_attribute_io(int msg_src, int msg_tag, MPI_Status *status) for (i=0; i<4; i++) tmp.c[i] = *ptr++; int len = tmp.i; char *fname = (char *)malloc(sizeof(char) * (len + 1)); - char *name1 = (char *)malloc(sizeof(char) * (len + 6)); + char *name1 = (char *)malloc(sizeof(char) * (len + 16)); for (i=0; i<len; i++) fname[i] = *ptr++; fname[i] = '\0'; - sprintf(name1, "%s.%d", fname, world_rank_); + if (app_size(IO_NODE) > 1) + { + sprintf(name1, "%s.file_%d.ieee", fname, world_rank_); + } + else + { + sprintf(name1, "%s.ieee", fname); + } fp = open_file(name1, op_type); Attribute *attr = new Attribute(ptr, op_type); if (op_type == TIMESTEP) attr->write_data(fp); @@ -638,12 +653,19 @@ void MPIFS::start_collective_io(int msg_src, int msg_tag, MPI_Status *status) msg_tag, MPI_COMM_WORLD,status); Broadcast(IO_NODE, (void *)schema_buf, msg_len, MPI_INT, msg_tag); - int len = schema_buf[2]; + int i, len = schema_buf[2]; char *name = (char *)malloc(sizeof(char) * (len + 1)); - char *name1 = (char *)malloc(sizeof(char) * (len + 6)); - for (int i=0; i<len; i++) name[i] = schema_buf[3+i]; + char *name1 = (char *)malloc(sizeof(char) * (len + 16)); + for (i=0; i<len; i++) name[i] = schema_buf[3+i]; name[i] = '\0'; - sprintf(name1, "%s.%d", name, world_rank_); + if (app_size(IO_NODE) > 1) + { + sprintf(name1, "%s.file_%d.ieee", name, world_rank_); + } + else + { + sprintf(name1, "%s.ieee", name); + } fp = open_file(name1, schema_buf[1]); free(name); @@ -677,12 +699,19 @@ void MPIFS::part_time_io_node_loop(int *schema_buf, int msg_len, Collective_IO *new_io; IOFile fp = 0; - int len = schema_buf[2]; + int i, len = schema_buf[2]; char *name = (char *)malloc(sizeof(char) * (len + 1)); - char *name1 = (char *)malloc(sizeof(char) * (len + 6)); - for (int i=0; i<len; i++) name[i] = schema_buf[3+i]; + char *name1 = (char *)malloc(sizeof(char) * (len + 16)); + for (i=0; i<len; i++) name[i] = schema_buf[3+i]; name[i] = '\0'; - sprintf(name1, "%s.%d", name, world_rank_); + if (app_size(IO_NODE) > 1) + { + sprintf(name1, "%s.file_%d.ieee", name, world_rank_); + } + else + { + sprintf(name1, "%s.ieee", name); + } fp = open_file(name1, schema_buf[1]); free(name); |