Changeset 2972
- Timestamp:
- 06/26/09 17:22:55 (9 months ago)
- Location:
- MOAB/branches/parallel_ghosting/parallel
- Files:
-
- 5 modified
-
MBParallelComm.cpp (modified) (8 diffs)
-
MBParallelComm.hpp (modified) (3 diffs)
-
ReadParallel.hpp (modified) (3 diffs)
-
parallel_unit_tests.cpp (modified) (1 diff)
-
pcomm_unit.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
MOAB/branches/parallel_ghosting/parallel/MBParallelComm.cpp
r2962 r2972 105 105 _new_size = _old_size + (addl_space); \ 106 106 if (_new_size > buff_vec.size()) { \ 107 buff_vec.resize(1.5*_new_size); \107 buff_vec.resize(1.5*_new_size); \ 108 108 buff_ptr = &buff_vec[_new_size-(addl_space)];} } 109 109 … … 331 331 ind = buffProcs.size(); 332 332 buffProcs.push_back((unsigned int)to_proc); 333 ownerSBuffs.push_back(std::vector<unsigned char>( INITIAL_BUFF_SIZE));334 ghostRBuffs.push_back(std::vector<unsigned char>( INITIAL_BUFF_SIZE));333 ownerSBuffs.push_back(std::vector<unsigned char>()); 334 ghostRBuffs.push_back(std::vector<unsigned char>()); 335 335 // allocate these other buffs in case we're storing remote handles 336 ownerRBuffs.push_back(std::vector<unsigned char>( INITIAL_BUFF_SIZE));337 ghostSBuffs.push_back(std::vector<unsigned char>( INITIAL_BUFF_SIZE));336 ownerRBuffs.push_back(std::vector<unsigned char>()); 337 ghostSBuffs.push_back(std::vector<unsigned char>()); 338 338 if (is_new) *is_new = true; 339 339 } … … 1428 1428 { 1429 1429 if (NULL == ents && 0 == num_ents) { 1430 return list_entities(NULL, 0); 1430 sharedEnts.print("Shared entities:\n"); 1431 return MB_SUCCESS; 1431 1432 } 1432 1433 … … 2612 2613 // establish comm procs and buffers for them 2613 2614 std::set<unsigned int> procs; 2614 result = get_interface_procs(procs );2615 result = get_interface_procs(procs, true); 2615 2616 RRA("Trouble getting iface procs."); 2616 for (std::set<unsigned int>::iterator sit = procs.begin(); sit != procs.end(); sit++)2617 get_buffers(*sit);2618 2617 2619 2618 // resolve shared entity remote handles; implemented in ghost cell exchange … … 2719 2718 // establish comm procs and buffers for them 2720 2719 psets.clear(); 2721 rval = pc[p]->get_interface_procs(psets );2720 rval = pc[p]->get_interface_procs(psets, true); 2722 2721 if (MB_SUCCESS != rval) return rval; 2723 for (std::set<unsigned int>::iterator sit = psets.begin(); sit != psets.end(); sit++)2724 pc[p]->get_buffers(*sit);2725 2726 2722 } 2727 2723 … … 3168 3164 3169 3165 //! get processors with which this processor communicates; sets are sorted by processor 3170 MBErrorCode MBParallelComm::get_interface_procs(std::set<unsigned int> &procs_set) 3166 MBErrorCode MBParallelComm::get_interface_procs(std::set<unsigned int> &procs_set, 3167 bool get_buffs) 3171 3168 { 3172 3169 // make sure the sharing procs vector is empty … … 3201 3198 } 3202 3199 } 3200 3201 if (get_buffs) { 3202 for (std::set<unsigned int>::iterator sit = procs_set.begin(); sit != procs_set.end(); sit++) 3203 get_buffers(*sit); 3204 } 3203 3205 3204 3206 return MB_SUCCESS; … … 3740 3742 // incoming ghost entities; unpack; returns entities received 3741 3743 // both from sending proc and from owning proc (which may be different) 3744 3745 // buffer could be empty, which means there isn't any message to 3746 // unpack (due to this comm proc getting added as a result of indirect 3747 // communication); just skip this unpack 3748 if (pc->ownerSBuffs[ind].empty()) continue; 3749 3742 3750 unsigned int to_p = pc->buffProcs[ind]; 3743 3751 unsigned char *buff_ptr = &pc->ownerSBuffs[ind][0]; -
MOAB/branches/parallel_ghosting/parallel/MBParallelComm.hpp
r2962 r2972 327 327 */ 328 328 //! get processors with which this processor shares an interface 329 MBErrorCode get_interface_procs(std::set<unsigned int> &iface_procs); 329 MBErrorCode get_interface_procs(std::set<unsigned int> &iface_procs, 330 const bool get_buffs = false); 330 331 331 332 //! get processors with which this processor communicates … … 495 496 //! set rank for this pcomm; USED FOR TESTING ONLY! 496 497 void set_rank(unsigned int r); 498 499 //! set rank for this pcomm; USED FOR TESTING ONLY! 500 void set_size(unsigned int r); 497 501 498 502 //! get (and possibly allocate) buffers for messages to/from to_proc; returns … … 1034 1038 } 1035 1039 1040 inline void MBParallelComm::set_size(unsigned int s) 1041 { 1042 procConfig.proc_size(s); 1043 } 1044 1036 1045 inline MBErrorCode MBParallelComm::get_sharing_data(MBEntityHandle entity, 1037 1046 int *ps, -
MOAB/branches/parallel_ghosting/parallel/ReadParallel.hpp
r2229 r2972 32 32 const int num_material_sets ); 33 33 34 //! Constructor35 ReadParallel(MBInterface* impl = NULL, MBParallelComm *pc = NULL);36 37 //! Destructor38 virtual ~ReadParallel() {}39 40 static const char *parallelOptsNames[];41 42 enum ParallelOpts {POPT_NONE=0, POPT_BCAST, POPT_BCAST_DELETE,43 POPT_READ_DELETE, POPT_READ_PARALLEL,44 POPT_FORMAT, POPT_DEFAULT};45 46 protected:47 48 private:49 34 MBErrorCode load_file(const char **file_names, 50 35 const int num_files, … … 65 50 const int bridge_dim, 66 51 const int num_layers); 52 //! Constructor 53 ReadParallel(MBInterface* impl = NULL, MBParallelComm *pc = NULL); 67 54 55 //! Destructor 56 virtual ~ReadParallel() {} 57 58 static const char *parallelOptsNames[]; 59 60 enum ParallelOpts {POPT_NONE=0, POPT_BCAST, POPT_BCAST_DELETE, 61 POPT_READ_DELETE, POPT_READ_PARALLEL, 62 POPT_FORMAT, POPT_DEFAULT}; 63 64 //! PUBLIC TO ALLOW TESTING 68 65 MBErrorCode delete_nonlocal_entities(std::string &ptag_name, 69 66 std::vector<int> &ptag_vals, … … 72 69 73 70 MBErrorCode delete_nonlocal_entities(MBEntityHandle file_set); 71 72 protected: 73 74 private: 74 75 75 76 MBInterface *mbImpl; -
MOAB/branches/parallel_ghosting/parallel/parallel_unit_tests.cpp
r2962 r2972 188 188 if (!filename) { 189 189 #ifdef SRCDIR 190 filename = STRINGIFY(SRCDIR) "/ ptest.cub";190 filename = STRINGIFY(SRCDIR) "/../test/64bricks_512hex.h5m"; 191 191 #else 192 filename = " ptest.cub";192 filename = "../test/64bricks_512hex.h5m"; 193 193 #endif 194 194 } -
MOAB/branches/parallel_ghosting/parallel/pcomm_unit.cpp
r2961 r2972 4 4 #include "MBCore.hpp" 5 5 #include "MeshTopoUtil.hpp" 6 #include "ReadParallel.hpp" 7 #include "FileOptions.hpp" 6 8 #include "TestUtil.hpp" 7 9 #include <algorithm> … … 44 46 /** Test pack/unpack of shared entities in 3d*/ 45 47 void test_pack_shared_entities_3d(); 48 /** Test pack/unpack of arbitrary mesh file */ 49 void test_pack_shared_arbitrary(); 46 50 /** Test filter_pstatus function*/ 47 51 void test_filter_pstatus(); … … 70 74 num_err += RUN_TEST( test_pack_shared_entities_2d ); 71 75 num_err += RUN_TEST( test_pack_shared_entities_3d ); 76 num_err += RUN_TEST( test_pack_shared_arbitrary ); 72 77 num_err += RUN_TEST( test_filter_pstatus ); 73 78 … … 1849 1854 // now 1 layer of hex ghosts 1850 1855 rval = MBParallelComm::exchange_ghost_cells(pc, 4, 3, 0, 1, true); 1856 CHECK_ERR(rval); 1857 } 1858 1859 void test_pack_shared_arbitrary() 1860 { 1861 #define NP 4 1862 MBCore moab[NP]; 1863 MBParallelComm *pc[NP]; 1864 for (unsigned int i = 0; i < NP; i++) { 1865 pc[i] = new MBParallelComm(&moab[i]); 1866 pc[i]->set_rank(i); 1867 pc[i]->set_size(NP); 1868 } 1869 1870 std::string ptag_name("MATERIAL_SET"); 1871 std::vector<int> pa_vec; 1872 pa_vec.push_back(0); 1873 pa_vec.push_back(4); 1874 pa_vec.push_back(2); 1875 MBErrorCode rval; 1876 1877 const char *fnames[] = {"/home/tautges/MOABpar2/test/64bricks_512hex.h5m"}; 1878 1879 std::string partition_name("MATERIAL_SET"); 1880 FileOptions fopts(NULL); 1881 1882 for (unsigned int i = 0; i < NP; i++) { 1883 ReadParallel rp(moab+i, pc[i]); 1884 MBEntityHandle tmp_set = 0; 1885 std::vector<int> partition_tag_vals; 1886 rval = rp.load_file(fnames, 1, tmp_set, ReadParallel::POPT_READ_DELETE, 1887 partition_name, 1888 partition_tag_vals, true, pa_vec, NULL, 0, 1889 fopts, i, false, -1, -1, -1, -1, 0); 1890 CHECK_ERR(rval); 1891 } 1892 1893 rval = MBParallelComm::resolve_shared_ents(pc, NP, 3); 1894 CHECK_ERR(rval); 1895 1896 // exchange interface cells 1897 rval = MBParallelComm::exchange_ghost_cells(pc, NP, -1, -1, 0, true); 1898 CHECK_ERR(rval); 1899 1900 // now 1 layer of hex ghosts 1901 rval = MBParallelComm::exchange_ghost_cells(pc, NP, 3, 0, 1, true); 1851 1902 CHECK_ERR(rval); 1852 1903 }
![(please configure the [header_logo] section in trac.ini)](/projects/ITAPS/chrome/common/trac_banner.png)