- Timestamp:
- 05/24/19 11:36:52 (6 years ago)
- Branches:
- pympi
- Parents:
- 1ef52ae
- git-author:
- Tom Uram <turam@…> (05/24/19 11:36:52)
- git-committer:
- Tom Uram <turam@…> (05/24/19 11:36:52)
- Location:
- python/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gio.cxx
r7ecb2a8 rb8b985e 64 64 int num_ranks = reader.readNRanks(); 65 65 uint64_t size = 0; 66 for(int i =0;i<num_ranks;++i) 67 size +=reader.readNumElems(i); 66 //for(int i =0;i<num_ranks;++i) 67 // size +=reader.readNumElems(i); 68 int rank; 69 MPI_Comm_rank(C, &rank); 70 size = reader.readNumElems(rank); 68 71 reader.close(); 69 72 return size; -
python/lib/gio.h
r7ecb2a8 rb8b985e 49 49 void read_gio(const MPI_Comm C, char* file_name, std::string var_name, T*& data, int field_count){ 50 50 gio::GenericIO reader(C, file_name); 51 int rank; 52 MPI_Comm_rank(C, &rank); 53 printf("rank = %d\n", rank); 51 54 #else 52 55 void read_gio(char* file_name, std::string var_name, T*& data, int field_count){ … … 55 58 reader.openAndReadHeader(gio::GenericIO::MismatchAllowed); 56 59 int num_ranks = reader.readNRanks(); 60 printf("num_ranks = %d\n", num_ranks); 57 61 uint64_t max_size = 0; 58 uint64_t rank_size[num_ranks]; 59 for(int i =0;i<num_ranks;++i){ 60 rank_size[i] = reader.readNumElems(i); 61 if(max_size < rank_size[i]) 62 max_size = rank_size[i]; 63 } 62 // uint64_t rank_size[num_ranks]; 63 uint64_t rank_size; 64 // for(int i =0;i<num_ranks;++i){ 65 // rank_size[i] = reader.readNumElems(i); 66 // if(max_size < rank_size[i]) 67 // max_size = rank_size[i]; 68 // } 69 rank_size = reader.readNumElems(rank); 70 max_size = rank_size; 71 printf("rank_size: %ld\nmax_size: %ld\n", rank_size, max_size); 64 72 T* rank_data = new T[max_size*field_count+reader.requestedExtraSpace()/sizeof(T)]; 65 73 int64_t offset =0; 66 74 reader.addScalarizedVariable(var_name,rank_data,field_count, 67 75 gio::GenericIO::VarHasExtraSpace); 68 for(int i=0;i<num_ranks;++i){ 69 reader.readData(i,false); 70 std::copy(rank_data,rank_data+rank_size[i]*field_count,data+offset); 71 offset +=rank_size[i]*field_count; 72 } 76 // for(int i=0;i<num_ranks;++i){ 77 // reader.readData(i,false); 78 // std::copy(rank_data,rank_data+rank_size[i]*field_count,data+offset); 79 // offset +=rank_size[i]*field_count; 80 // } 81 reader.readData(rank,false); 82 std::copy(rank_data,rank_data+rank_size*field_count,data); 73 83 delete [] rank_data; 74 84 reader.close();
Note: See TracChangeset
for help on using the changeset viewer.