Changeset d409b8c


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

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GNUmakefile

    r1d6ab66 rd409b8c  
    7979 
    8080MPIDIR = mpi 
    81 MPI_CFLAGS := -g -O3 $(OPENMPFLAG) $(G99FLAG) 
     81MPI_CFLAGS := -g -O3 $(OPENMPFLAG) $(G99FLAG) -fPIC 
    8282MPI_CPPFLAGS := $(BASE_CPPFLAGS) 
    8383 
     
    233233MPI_BLOSC_O := $(addprefix $(MPIDIR)/,$(BLOSC_O)) 
    234234 
     235$(MPIDIR)/libpygio.so: $(MPIDIR)/GenericIO.o $(MPIDIR)/python/lib/gio.o $(MPI_BLOSC_O) 
     236        $(MPICXX) $(MPI_CFLAGS) $(MPI_SHARED) -fPIC -shared -o $@ $^ 
     237 
    235238$(MPIDIR)/GenericIOPrint: $(MPIDIR)/GenericIOPrint.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O) 
    236239        $(MPICXX) $(MPI_CFLAGS) -o $@ $^  
     
    251254fe-progs: frontend-progs 
    252255 
    253 mpi-progs: $(MPIDIR)/GenericIOPrint $(MPIDIR)/GenericIOVerify $(MPIDIR)/GenericIOBenchmarkRead $(MPIDIR)/GenericIOBenchmarkWrite $(MPIDIR)/GenericIORewrite 
     256mpi-progs: $(MPIDIR)/GenericIOPrint $(MPIDIR)/GenericIOVerify $(MPIDIR)/GenericIOBenchmarkRead $(MPIDIR)/GenericIOBenchmarkWrite $(MPIDIR)/GenericIORewrite $(MPIDIR)/libpygio.so 
    254257 
    255258frontend-sqlite: $(FEDIR)/GenericIOSQLite.so $(FEDIR)/sqlite3 
  • 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.