Ignore:
Timestamp:
01/23/19 10:31:44 (5 years ago)
Author:
yushan
Message:

dev on ADA. add flag switch _usingEP/_usingMPI

Location:
XIOS/dev/branch_openmp/src/filter
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/filter/file_writer_filter.cpp

    r1482 r1642  
    1717  void CFileWriterFilter::onInputReady(std::vector<CDataPacketPtr> data) 
    1818  { 
    19     const bool detectMissingValue = (!field->detect_missing_value.isEmpty() 
    20                                       && !field->default_value.isEmpty() 
    21                                       && field->detect_missing_value == true); 
     19    const bool detectMissingValue = ( !field->default_value.isEmpty() && 
     20                               ( (!field->detect_missing_value.isEmpty() || field->detect_missing_value == true) 
     21                                 || field->hasGridMask()) ); 
    2222 
    2323    CArray<double, 1> dataArray = (detectMissingValue) ? data[0]->data.copy() : data[0]->data; 
  • XIOS/dev/branch_openmp/src/filter/source_filter.cpp

    r1460 r1642  
    77namespace xios 
    88{ 
    9   CSourceFilter::CSourceFilter(CGarbageCollector& gc, CGrid* grid, bool compression,  
     9  CSourceFilter::CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
     10                               bool compression /*= true*/, bool mask /*= false*/, 
    1011                               const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/, 
    1112                               bool hasMissingValue /*= false*/, 
     
    1415    , grid(grid) 
    1516    , compression(compression) 
     17    , mask(mask) 
    1618    , offset(offset) 
    1719    , hasMissingValue(hasMissingValue), defaultValue(defaultValue) 
     
    4042    } 
    4143    else 
    42       grid->inputField(data, packet->data); 
    43  
    44      
    45      
    46     // if (compression) grid->inputField(data, packet->data) ; 
    47     // else 
    48     // { 
    49     //   // just make a flat copy 
    50     //   CArray<double, N> data_tmp(data.copy()) ; // supress const attribute 
    51     //   CArray<double,1> dataTmp2(data_tmp.dataFirst(),shape(data.numElements()),neverDeleteData) ; 
    52     //   packet->data = dataTmp2 ; 
    53     // } 
     44    { 
     45      if (mask) 
     46        grid->maskField(data, packet->data); 
     47      else 
     48        grid->inputField(data, packet->data); 
     49    } 
    5450    // Convert missing values to NaN 
    5551    if (hasMissingValue) 
  • XIOS/dev/branch_openmp/src/filter/source_filter.hpp

    r1460 r1642  
    2121       * \param gc the garbage collector associated with this filter 
    2222       * \param grid the grid to which the data is attached 
     23       * \param compression 
     24       * \param mask 
    2325       * \param offset the offset applied to the timestamp of all packets 
    2426       * \param manualTrigger whether the output should be triggered manually 
     
    2729       */ 
    2830      CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
    29                     bool compression=true, 
     31                    bool compression = true, 
     32                    bool mask = false, 
    3033                    const CDuration offset = NoneDu, bool manualTrigger = false, 
    3134                    bool hasMissingValue = false, 
     
    6164 
    6265    private: 
    63       CGrid* grid; //!< The grid attached to the data the filter can accept 
    64       const CDuration offset; //!< The offset applied to the timestamp of all packets 
     66      CGrid* grid;             //!< The grid attached to the data the filter can accept 
     67      const CDuration offset;  //!< The offset applied to the timestamp of all packets 
    6568      const bool hasMissingValue; 
    6669      const double defaultValue; 
    67       const bool compression ; //!< indicate if the data need to be compressed : on client size : true, on server side : false 
     70      const bool compression ; //!< indicates if data need to be compressed : on client side : true, on server side : false 
     71      const bool mask ;        //!< indicates whether grid mask should be applied (true for clients, false for servers) 
    6872  }; // class CSourceFilter 
    6973} // namespace xios 
  • XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.cpp

    r1545 r1642  
    1 #include "mpi.hpp" 
    21#include "spatial_transform_filter.hpp" 
    32#include "grid_transformation.hpp" 
     
    54#include "context_client.hpp" 
    65#include "timer.hpp" 
    7 using namespace ep_lib; 
    86 
    97namespace xios 
     
    7068      onOutputReady(outputPacket); 
    7169  } 
    72  
    73  
    74  
    75  
    7670 
    7771  CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount) 
     
    142136  } 
    143137 
    144   std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> > *CSpatialTransformFilterEngine::engines_ptr = 0; 
     138  std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> > CSpatialTransformFilterEngine::engines; 
    145139 
    146140  CSpatialTransformFilterEngine* CSpatialTransformFilterEngine::get(CGridTransformation* gridTransformation) 
     
    149143      ERROR("CSpatialTransformFilterEngine& CSpatialTransformFilterEngine::get(CGridTransformation* gridTransformation)", 
    150144            "Impossible to get the requested engine, the grid transformation is invalid."); 
    151      
    152     if(engines_ptr == NULL) engines_ptr = new std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> >; 
    153  
    154  
    155     std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> >::iterator it = engines_ptr->find(gridTransformation); 
    156     if (it == engines_ptr->end()) 
     145 
     146    std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> >::iterator it = engines.find(gridTransformation); 
     147    if (it == engines.end()) 
    157148    { 
    158149      std::shared_ptr<CSpatialTransformFilterEngine> engine(new CSpatialTransformFilterEngine(gridTransformation)); 
    159       it = engines_ptr->insert(std::make_pair(gridTransformation, engine)).first; 
     150      it = engines.insert(std::make_pair(gridTransformation, engine)).first; 
    160151    } 
    161152 
     
    206197    const std::list<CGridTransformation::RecvIndexGridDestinationMap>& listLocalIndexToReceive = gridTransformation->getLocalIndexToReceiveOnGridDest(); 
    207198    const std::list<size_t>& listNbLocalIndexToReceive = gridTransformation->getNbLocalIndexToReceiveOnGridDest(); 
    208     const std::list<std::vector<bool> >& listLocalIndexMaskOnDest = gridTransformation->getLocalMaskIndexOnGridDest(); 
    209199    const std::vector<CGenericAlgorithmTransformation*>& listAlgos = gridTransformation->getAlgos(); 
    210200 
     
    215205    std::list<CGridTransformation::RecvIndexGridDestinationMap>::const_iterator itListRecv = listLocalIndexToReceive.begin(); 
    216206    std::list<size_t>::const_iterator itNbListRecv = listNbLocalIndexToReceive.begin(); 
    217     std::list<std::vector<bool> >::const_iterator itLocalMaskIndexOnDest = listLocalIndexMaskOnDest.begin(); 
    218207    std::vector<CGenericAlgorithmTransformation*>::const_iterator itAlgo = listAlgos.begin(); 
    219208 
    220     for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itLocalMaskIndexOnDest, ++itAlgo) 
     209    for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itAlgo) 
    221210    { 
    222211      CArray<double,1> dataCurrentSrc(dataCurrentDest); 
     
    235224 
    236225      idxSendBuff = 0; 
    237       std::vector<MPI_Request> sendRecvRequest(localIndexToSend.size() + itListRecv->size()); 
    238       int position = 0; 
     226      std::vector<ep_lib::MPI_Request> sendRecvRequest; 
    239227      for (itSend = itbSend; itSend != iteSend; ++itSend, ++idxSendBuff) 
    240228      { 
     
    246234          sendBuff[idxSendBuff][idx] = dataCurrentSrc(localIndex_p(idx)); 
    247235        } 
    248         MPI_Isend(sendBuff[idxSendBuff], countSize, MPI_DOUBLE, destRank, 12, client->intraComm, &sendRecvRequest[position++]); 
     236        sendRecvRequest.push_back(ep_lib::MPI_Request()); 
     237        ep_lib::MPI_Isend(sendBuff[idxSendBuff], countSize, EP_DOUBLE, destRank, 12, client->intraComm, &sendRecvRequest.back()); 
    249238      } 
    250239 
     
    263252        int srcRank = itRecv->first; 
    264253        int countSize = itRecv->second.size(); 
    265         MPI_Irecv(recvBuff + currentBuff, countSize, MPI_DOUBLE, srcRank, 12, client->intraComm, &sendRecvRequest[position++]); 
     254        sendRecvRequest.push_back(ep_lib::MPI_Request()); 
     255        ep_lib::MPI_Irecv(recvBuff + currentBuff, countSize, EP_DOUBLE, srcRank, 12, client->intraComm, &sendRecvRequest.back()); 
    266256        currentBuff += countSize; 
    267257      } 
    268       std::vector<MPI_Status> status(sendRecvRequest.size()); 
    269       MPI_Waitall(sendRecvRequest.size(), &sendRecvRequest[0], &status[0]); 
     258      std::vector<ep_lib::MPI_Status> status(sendRecvRequest.size()); 
     259      ep_lib::MPI_Waitall(sendRecvRequest.size(), &sendRecvRequest[0], &status[0]); 
    270260 
    271261      dataCurrentDest.resize(*itNbListRecv); 
    272       const std::vector<bool>& localMaskDest = *itLocalMaskIndexOnDest; 
    273       for (int i = 0; i < localMaskDest.size(); ++i) 
    274         if (localMaskDest[i]) dataCurrentDest(i) = 0.0; 
    275         else dataCurrentDest(i) = defaultValue; 
     262      dataCurrentDest = 0.0; 
    276263 
    277264      std::vector<bool> localInitFlag(dataCurrentDest.numElements(), true); 
  • XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.hpp

    r1545 r1642  
    141141 
    142142      //! The allocated engines 
    143  
    144       static std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> > *engines_ptr; 
    145       #pragma omp threadprivate(engines_ptr) 
     143      static std::map<CGridTransformation*, std::shared_ptr<CSpatialTransformFilterEngine> > engines; 
    146144  }; // class CSpatialTransformFilterEngine 
    147145} // namespace xios 
  • XIOS/dev/branch_openmp/src/filter/temporal_filter.cpp

    r1545 r1642  
    2222                        this->samplingOffset.second, this->samplingOffset.timestep) 
    2323    , initDate(initDate) 
     24//    , nextSamplingDate(initDate + (this->samplingOffset + initDate.getRelCalendar().getTimeStep())) 
    2425    , nextSamplingDate(initDate + offsetMonth + ( offsetAllButMonth + initDate.getRelCalendar().getTimeStep())) 
    2526    , nbOperationDates(1) 
Note: See TracChangeset for help on using the changeset viewer.