Last change
on this file since 830 was
829,
checked in by mhnguyen, 8 years ago
|
Refactoring transformation code
+) On exchanging information during transformation, not only global index are sent but also local index
+) Correct a bug in distributed hash table (dht)
+) Add new type for dht
+) Clean up some redundant codes
Test
+) On Curie
+) Every test passes
+) Code runs faster in some cases (up to 30%)
|
File size:
1.6 KB
|
Line | |
---|
1 | /*! |
---|
2 | \file client_server_mapping.hpp |
---|
3 | \author Ha NGUYEN |
---|
4 | \since 27 Feb 2015 |
---|
5 | \date 16 Mars 2016 |
---|
6 | |
---|
7 | \brief Mapping between index client and server. |
---|
8 | Clients pre-calculate all information of server distribution. |
---|
9 | */ |
---|
10 | #include "client_server_mapping_distributed.hpp" |
---|
11 | #include <limits> |
---|
12 | #include <boost/functional/hash.hpp> |
---|
13 | #include "utils.hpp" |
---|
14 | #include "mpi_tag.hpp" |
---|
15 | |
---|
16 | namespace xios |
---|
17 | { |
---|
18 | |
---|
19 | CClientServerMappingDistributed::CClientServerMappingDistributed(const boost::unordered_map<size_t,int>& globalIndexOfServer, |
---|
20 | const MPI_Comm& clientIntraComm, bool isDataDistributed) |
---|
21 | : CClientServerMapping(), ccDHT_(0) |
---|
22 | { |
---|
23 | ccDHT_ = new CClientClientDHTInt(globalIndexOfServer, |
---|
24 | clientIntraComm, |
---|
25 | isDataDistributed); |
---|
26 | } |
---|
27 | |
---|
28 | CClientServerMappingDistributed::~CClientServerMappingDistributed() |
---|
29 | { |
---|
30 | if (0 != ccDHT_) delete ccDHT_; |
---|
31 | } |
---|
32 | |
---|
33 | /*! |
---|
34 | Compute mapping global index of server which client sends to. |
---|
35 | \param [in] globalIndexOnClient global index client has |
---|
36 | */ |
---|
37 | void CClientServerMappingDistributed::computeServerIndexMapping(const CArray<size_t,1>& globalIndexOnClient) |
---|
38 | { |
---|
39 | ccDHT_->computeIndexInfoMapping(globalIndexOnClient); |
---|
40 | const boost::unordered_map<size_t,int>& infoIndexMap = (ccDHT_->getInfoIndexMap()); |
---|
41 | // indexGlobalOnServer_ = (ccDHT_->getInfoIndexMap()); |
---|
42 | boost::unordered_map<size_t,int>::const_iterator it = infoIndexMap.begin(), ite = infoIndexMap.end(); |
---|
43 | for (; it != ite; ++it) |
---|
44 | { |
---|
45 | indexGlobalOnServer_[it->second].push_back(it->first); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.