Changeset 422:91f0799329d5

Show
Ignore:
Timestamp:
11/12/2012 09:20:30 PM (7 months ago)
Author:
Andreas Schaefer <gentryx@…>
Branch:
default
Message:

adding dirty interim wrapper for MPI_Gatherv()

Location:
src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • src/io/bovwriter.h

    r342 r422  
    1919template<typename CELL_TYPE, typename SELECTOR_TYPE> 
    2020class BOVWriter : public ParallelWriter<CELL_TYPE> 
    21 {     
     21{ 
    2222public: 
    2323    friend class BOVWriterTest; 
  • src/io/parallelwriter.h

    r245 r422  
    3535        const std::string& _prefix,  
    3636        DistributedSimulator<CELL_TYPE> *_distSim,  
    37         const unsigned& _period = 1):  
     37        const unsigned& _period = 1) :  
    3838        prefix(_prefix), distSim(_distSim), period(_period) 
    3939    { 
  • src/mpilayer/mpilayer.h

    r366 r422  
    324324        SuperVector<int> displacements(size()); 
    325325        displacements[0] = 0; 
    326         for (int i = 0; i < size() - 1; ++i) 
     326        for (int i = 0; i < size() - 1; ++i) { 
    327327            displacements[i + 1] = displacements[i] + lengths[i]; 
     328        } 
    328329        comm->Allgatherv(source, lengths[rank()], datatype, &(target->front()), &(lengths.front()), &(displacements.front()), datatype); 
    329330    } 
     
    342343            return SuperVector<T>(); 
    343344        } 
     345    } 
     346 
     347    // fixme: needs test 
     348    template<typename T> 
     349    inline void gatherV( 
     350        const T *source,  
     351        const int num, 
     352        const SuperVector<int>& lengths, 
     353        const unsigned& root,  
     354        SuperVector<T> *target,  
     355        const MPI::Datatype& datatype = Typemaps::lookup<T>()) const 
     356    { 
     357        SuperVector<int> displacements(size()); 
     358        if (rank() == root) { 
     359            displacements[0] = 0; 
     360            for (int i = 0; i < size() - 1; ++i) { 
     361                displacements[i + 1] = displacements[i] + lengths[i]; 
     362            } 
     363        } 
     364 
     365        // std::cout << "num[" << rank() << "]: " << num << "\n"; 
     366        // std::cout << "lengths[" << rank() << "]: " << lengths << "\n"; 
     367        // std::cout << "displacements[" << rank() << "]: " << displacements << "\n"; 
     368        // std::cout << "targetsize[" << rank() << "]: " << target->size() << "\n"; 
     369 
     370        comm->Gatherv(source, num, datatype,  
     371                      &(*target)[0], &lengths[0], &displacements[0], datatype,  
     372                      root); 
    344373    } 
    345374