Changeset 14e73bb
- Timestamp:
- 04/12/16 19:22:09 (9 years ago)
- Branches:
- master, pympi
- Children:
- 754e14c
- Parents:
- 8f0a211
- git-author:
- Hal Finkel <hfinkel@…> (04/12/16 19:22:09)
- git-committer:
- Hal Finkel <hfinkel@…> (04/12/16 19:22:09)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GenericIO.cxx
r8f0a211 r14e73bb 51 51 #include <fstream> 52 52 #include <stdexcept> 53 #include <iterator> 53 54 #include <algorithm> 54 55 #include <cassert> … … 66 67 67 68 #ifdef __bgq__ 68 #include <spi/include/kernel/location.h> 69 #include <spi/include/kernel/process.h> 70 #include <firmware/include/personality.h> 69 #include <mpix.h> 71 70 #endif 72 71 … … 206 205 continue; 207 206 208 throw runtime_error("Unable to read " + D + " from file: " + FileName); 207 throw runtime_error("Unable to read " + D + " from file: " + FileName + 208 ": " + strerror(errno)); 209 209 } 210 210 … … 224 224 continue; 225 225 226 throw runtime_error("Unable to write " + D + " to file: " + FileName); 226 throw runtime_error("Unable to write " + D + " to file: " + FileName + 227 ": " + strerror(errno)); 227 228 } 228 229 … … 1151 1152 1152 1153 return (int) RH->GlobalRank; 1154 } 1155 1156 void GenericIO::getSourceRanks(vector<int> &SR) { 1157 SR.clear(); 1158 1159 if (Redistributing) { 1160 std::copy(SourceRanks.begin(), SourceRanks.end(), std::back_inserter(SR)); 1161 return; 1162 } 1163 1164 int Rank; 1165 #ifndef GENERICIO_NO_MPI 1166 MPI_Comm_rank(Comm, &Rank); 1167 #else 1168 Rank = 0; 1169 #endif 1170 1171 SR.push_back(Rank); 1153 1172 } 1154 1173 … … 1505 1524 dofs.write((const char *) Data, ReadSize); 1506 1525 dofs.close(); 1526 1527 uint64_t RawCRC = crc64_omp(Data, ReadSize - CRCSize); 1528 unsigned char *UData = (unsigned char *) Data; 1529 crc64_invert(RawCRC, &UData[ReadSize - CRCSize]); 1530 uint64_t NewCRC = crc64_omp(Data, ReadSize); 1531 std::cerr << "Recalulated CRC: " << NewCRC << ((NewCRC == -1) ? "ok" : "bad") << "\n"; 1507 1532 break; 1508 1533 } … … 1615 1640 void GenericIO::setNaturalDefaultPartition() { 1616 1641 #ifdef __bgq__ 1617 Personality_t pers; 1618 Kernel_GetPersonality(&pers, sizeof(pers)); 1619 1620 // Nodes in an ION Partition 1621 int SPLIT_A = 2; 1622 int SPLIT_B = 2; 1623 int SPLIT_C = 4; 1624 int SPLIT_D = 4; 1625 int SPLIT_E = 2; 1626 1627 int Anodes, Bnodes, Cnodes, Dnodes, Enodes; 1628 int Acoord, Bcoord, Ccoord, Dcoord, Ecoord; 1629 int A_color, B_color, C_color, D_color, E_color; 1630 int A_blocks, B_blocks, C_blocks, D_blocks, E_blocks; 1631 uint32_t id_on_node; 1632 int ranks_per_node, color; 1633 1634 Anodes = pers.Network_Config.Anodes; 1635 Acoord = pers.Network_Config.Acoord; 1636 1637 Bnodes = pers.Network_Config.Bnodes; 1638 Bcoord = pers.Network_Config.Bcoord; 1639 1640 Cnodes = pers.Network_Config.Cnodes; 1641 Ccoord = pers.Network_Config.Ccoord; 1642 1643 Dnodes = pers.Network_Config.Dnodes; 1644 Dcoord = pers.Network_Config.Dcoord; 1645 1646 Enodes = pers.Network_Config.Enodes; 1647 Ecoord = pers.Network_Config.Ecoord; 1648 1649 A_color = Acoord / SPLIT_A; 1650 B_color = Bcoord / SPLIT_B; 1651 C_color = Ccoord / SPLIT_C; 1652 D_color = Dcoord / SPLIT_D; 1653 E_color = Ecoord / SPLIT_E; 1654 1655 // Number of blocks 1656 A_blocks = Anodes / SPLIT_A; 1657 B_blocks = Bnodes / SPLIT_B; 1658 C_blocks = Cnodes / SPLIT_C; 1659 D_blocks = Dnodes / SPLIT_D; 1660 E_blocks = Enodes / SPLIT_E; 1661 1662 color = (A_color * (B_blocks * C_blocks * D_blocks * E_blocks)) 1663 + (B_color * (C_blocks * D_blocks * E_blocks)) 1664 + (C_color * ( D_blocks * E_blocks)) 1665 + (D_color * ( E_blocks)) 1666 + E_color; 1667 1668 DefaultPartition = color; 1642 DefaultPartition = MPIX_IO_link_id(); 1669 1643 #else 1670 1644 #ifndef GENERICIO_NO_MPI -
GenericIO.h
r8f0a211 r14e73bb 297 297 void readData(int EffRank = -1, bool PrintStats = true, bool CollStats = true); 298 298 299 void getSourceRanks(std::vector<int> &SR); 300 299 301 void close() { 300 302 FH.close();
Note: See TracChangeset
for help on using the changeset viewer.