Changeset b8b985e for python


Ignore:
Timestamp:
05/24/19 11:36:52 (6 years ago)
Author:
Tom Uram <turam@…>
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)
Message:

Intermediate commit of work with Antonio

Location:
python/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gio.cxx

    r7ecb2a8 rb8b985e  
    6464    int num_ranks = reader.readNRanks(); 
    6565    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); 
    6871    reader.close(); 
    6972    return size; 
  • python/lib/gio.h

    r7ecb2a8 rb8b985e  
    4949void read_gio(const MPI_Comm C, char* file_name, std::string var_name, T*& data, int field_count){ 
    5050  gio::GenericIO reader(C, file_name); 
     51  int rank; 
     52  MPI_Comm_rank(C, &rank); 
     53  printf("rank = %d\n", rank); 
    5154#else 
    5255void read_gio(char* file_name, std::string var_name, T*& data, int field_count){ 
     
    5558  reader.openAndReadHeader(gio::GenericIO::MismatchAllowed); 
    5659  int num_ranks = reader.readNRanks(); 
     60  printf("num_ranks = %d\n", num_ranks); 
    5761  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); 
    6472  T* rank_data = new T[max_size*field_count+reader.requestedExtraSpace()/sizeof(T)]; 
    6573  int64_t offset =0; 
    6674  reader.addScalarizedVariable(var_name,rank_data,field_count, 
    6775                               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); 
    7383  delete [] rank_data; 
    7484  reader.close(); 
Note: See TracChangeset for help on using the changeset viewer.