Changeset d409b8c for python/lib


Ignore:
Timestamp:
05/02/19 12:12:31 (6 years ago)
Author:
Thomas Uram <turam@…>
Branches:
pympi
Children:
45bb293
Parents:
1d6ab66
git-author:
Thomas Uram <turam@…> (05/02/19 12:12:31)
git-committer:
Thomas Uram <turam@…> (05/02/19 12:12:31)
Message:

added branch for mpi-based python api

Location:
python/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gio.cxx

    rdd56945 rd409b8c  
    4343#include <iostream> 
    4444 
    45   void read_gio_float(char* file_name, char* var_name, float* data, int field_count){ 
    46     read_gio<float>(file_name,var_name,data,field_count); 
     45  void read_gio_float(const MPI_Comm &C, char* file_name, char* var_name, float* data, int field_count){ 
     46    read_gio<float>(C, file_name,var_name,data,field_count); 
    4747  } 
    48   void read_gio_double(char* file_name, char* var_name, double* data, int field_count){ 
    49     read_gio<double>(file_name,var_name,data,field_count); 
     48  void read_gio_double(const MPI_Comm &C, char* file_name, char* var_name, double* data, int field_count){ 
     49    read_gio<double>(C, file_name,var_name,data,field_count); 
    5050  } 
    51   void read_gio_uint16(char* file_name, char* var_name, uint16_t* data, int field_count){ 
    52     read_gio<uint16_t>(file_name,var_name,data,field_count); 
     51  void read_gio_uint16(const MPI_Comm &C, char* file_name, char* var_name, uint16_t* data, int field_count){ 
     52    read_gio<uint16_t>(C, file_name,var_name,data,field_count); 
    5353  } 
    54   void read_gio_int32(char* file_name, char* var_name, int* data, int field_count){ 
    55     read_gio<int>(file_name,var_name,data,field_count); 
     54  void read_gio_int32(const MPI_Comm &C, char* file_name, char* var_name, int* data, int field_count){ 
     55    read_gio<int>(C, file_name,var_name,data,field_count); 
    5656  } 
    57   void read_gio_int64(char* file_name, char* var_name, int64_t* data, int field_count){ 
    58     read_gio<int64_t>(file_name,var_name,data,field_count); 
     57  void read_gio_int64(const MPI_Comm &C, char* file_name, char* var_name, int64_t* data, int field_count){ 
     58    read_gio<int64_t>(C, file_name,var_name,data,field_count); 
    5959  } 
    6060   
    61   int64_t get_elem_num(char* file_name){ 
    62     gio::GenericIO reader(file_name); 
     61  int64_t get_elem_num(const MPI_Comm &C, char* file_name){ 
     62    gio::GenericIO reader(C, file_name); 
    6363    reader.openAndReadHeader(gio::GenericIO::MismatchAllowed); 
    6464    int num_ranks = reader.readNRanks(); 
     
    7070  } 
    7171 
    72   var_type get_variable_type(char* file_name,char* var_name){ 
    73    gio::GenericIO reader(file_name); 
     72  var_type get_variable_type(const MPI_Comm &C, char* file_name,char* var_name){ 
     73   gio::GenericIO reader(C, file_name); 
    7474   std::vector<gio::GenericIO::VariableInfo> VI; 
    7575   reader.openAndReadHeader(gio::GenericIO::MismatchAllowed); 
     
    9898  } 
    9999 
    100   int get_variable_field_count(char* file_name,char* var_name){ 
    101    gio::GenericIO reader(file_name); 
     100  int get_variable_field_count(const MPI_Comm &C, char* file_name,char* var_name){ 
     101   gio::GenericIO reader(C, file_name); 
    102102   std::vector<gio::GenericIO::VariableInfo> VI; 
    103103   reader.openAndReadHeader(gio::GenericIO::MismatchAllowed); 
     
    114114  } 
    115115 
    116 extern "C" void inspect_gio(char* file_name){ 
    117   int64_t size = get_elem_num(file_name); 
    118   gio::GenericIO reader(file_name); 
     116#ifndef GENERICIO_NO_MPI 
     117extern "C" void inspect_gio(const MPI_Comm &C, char* file_name){ 
     118  gio::GenericIO reader(C, file_name); 
     119#else 
     120extern "C" void inspect_gio(const MPI_Comm &C, char* file_name){ 
     121  gio::GenericIO reader(C, file_name); 
     122#endif 
     123  int64_t size = get_elem_num(C,file_name); 
    119124  std::vector<gio::GenericIO::VariableInfo> VI; 
    120125  reader.openAndReadHeader(gio::GenericIO::MismatchAllowed); 
  • python/lib/gio.h

    rdd56945 rd409b8c  
    4646 
    4747template <class T> 
     48#ifndef GENERICIO_NO_MPI 
     49void read_gio(const MPI_Comm &C, char* file_name, std::string var_name, T*& data, int field_count){ 
     50  gio::GenericIO reader(C, file_name); 
     51#else 
    4852void read_gio(char* file_name, std::string var_name, T*& data, int field_count){ 
    4953  gio::GenericIO reader(file_name); 
     54#endif 
    5055  reader.openAndReadHeader(gio::GenericIO::MismatchAllowed); 
    5156  int num_ranks = reader.readNRanks(); 
     
    7176extern "C" int64_t get_elem_num(char* file_name); 
    7277 
    73 extern "C" void read_gio_float (char* file_name, char* var_name, float* data, int field_count); 
    74 extern "C" void read_gio_double(char* file_name, char* var_name, double* data, int field_count); 
    75 extern "C" void read_gio_uint16 (char* file_name, char* var_name, uint16_t* data, int field_count);  
    76 extern "C" void read_gio_int32 (char* file_name, char* var_name, int* data, int field_count);  
    77 extern "C" void read_gio_int64 (char* file_name, char* var_name, int64_t* data, int field_count); 
     78extern "C" void read_gio_float (const MPI_Comm &C, char* file_name, char* var_name, float* data, int field_count); 
     79extern "C" void read_gio_double(const MPI_Comm &C, char* file_name, char* var_name, double* data, int field_count); 
     80extern "C" void read_gio_uint16 (const MPI_Comm &C, char* file_name, char* var_name, uint16_t* data, int field_count);  
     81extern "C" void read_gio_int32 (const MPI_Comm &C, char* file_name, char* var_name, int* data, int field_count);  
     82extern "C" void read_gio_int64 (const MPI_Comm &C, char* file_name, char* var_name, int64_t* data, int field_count); 
    7883enum var_type{ 
    7984  float_type=0, 
     
    8792extern "C" var_type get_variable_type(char* file_name,char* var_name); 
    8893extern "C" int get_variable_field_count(char* file_name,char* var_name); 
    89 extern "C" void inspect_gio(char* file_name); 
     94extern "C" void inspect_gio(const MPI_Comm &C, char* file_name); 
Note: See TracChangeset for help on using the changeset viewer.