Changeset 2ded87 in git
- Timestamp:
- Nov 13, 2014, 11:38:57 PM (9 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 85bd2a6af0f0dbc2125e835be461c105507f8e55
- Parents:
- 13079719da06e518c20fdb2a9e05c26bff4e8cf4
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-11-13 23:38:57+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-11-17 20:53:53+01:00
- Location:
- Singular/dyn_modules/syzextra
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/syzextra/syzextra.cc
r130797 r2ded87 14 14 /*****************************************************************************/ 15 15 16 #include <string.h> 17 16 18 // include header file 17 19 #include <kernel/mod2.h> … … 55 57 #include <stdio.h> 56 58 #include <stdlib.h> 57 #include <string.h> 58 59 #define NOPRODUCT 1 59 60 #ifndef RTIMER_BENCHMARKING 61 # define RTIMER_BENCHMARKING 0 62 #endif 60 63 61 64 // USING_NAMESPACE_SINGULARXX; … … 612 615 assume( 0 <= k && k <= 3 ); 613 616 614 if( __PROT__ ) 615 pp[k]++; 617 pp[k]++; // collect stats 616 618 617 619 if( k ) … … 642 644 643 645 if( __PROT__ ) 646 { 644 647 Print("(PP/ST: {c: %lu, C: %lu, P: %lu} + %lu)", pp[1], pp[2], pp[3], pp[0]); 645 646 647 } 648 m_stat[0] += pp [0]; m_stat[1] += pp [1]; m_stat[2] += pp [2]; m_stat[3] += pp [3]; 649 } 650 } 651 648 652 /* 649 653 m_idTailTerms.resize( IDELEMS(idTails) ); … … 671 675 */ 672 676 677 void SchreyerSyzygyComputation::PrintStats() const 678 { 679 Print("SchreyerSyzygyComputation Stats: (PP/ST: {c: %lu, C: %lu, P: %lu} + %lu, LOT: %lu, LCM: %lu, ST:%lu, LK: %lu {*: %lu})\n", 680 m_stat[1], m_stat[2], m_stat[3], m_stat[0], 681 m_stat[4], m_stat[5], 682 m_stat[8], 683 m_stat[6] + m_stat[7], m_stat[7] 684 ); 685 } 673 686 674 687 … … 1078 1091 1079 1092 assume( IDELEMS(L) == IDELEMS(T) ); 1080 #ifndef SING_NDEBUG 1081 int t, r; 1093 1094 #ifdef SING_NDEBUG 1095 int t, r; // for rtimer benchmarking in prot realease mode 1082 1096 #endif 1083 1097 … … 1085 1099 Print("\n{ \"syzygylayer\": \"%d\", \"hybridnf\": \"%d\", \"diagrams\": \n[", __SYZNUMBER__, __HYBRIDNF__ ); 1086 1100 1087 if( __PROT__ ) 1088 Print("SYZ{%d}:", __SYZNUMBER__ ); 1101 if( __PROT__ ) Print("\n[%d]", __SYZNUMBER__ ); 1089 1102 1090 1103 if( m_syzLeads == NULL ) 1091 1104 { 1092 #ifndef SING_NDEBUG 1093 if( __PROT__ )1094 { 1105 if( __PROT__ & RTIMER_BENCHMARKING ) 1106 { 1107 #ifdef SING_NDEBUG 1095 1108 t = getTimer(); r = getRTimer(); 1096 1109 Print("\n%% %5d **!TIME4!** SchreyerSyzygyComputation::ComputeSyzygy::ComputeLeadingSyzygyTerms: t: %d, r: %d\n", r, t, r); 1097 } 1098 #endif 1110 #endif 1111 } 1099 1112 ComputeLeadingSyzygyTerms( __LEAD2SYZ__ && !__IGNORETAILS__ ); // 2 terms OR 1 term! 1100 #ifndef SING_NDEBUG 1101 if( __PROT__ )1102 { 1113 if( __PROT__ & RTIMER_BENCHMARKING ) 1114 { 1115 #ifdef SING_NDEBUG 1103 1116 t = getTimer() - t; r = getRTimer() - r; 1104 1117 Print("\n%% %5d **!TIME4!** SchreyerSyzygyComputation::ComputeSyzygy::ComputeLeadingSyzygyTerms: dt: %d, dr: %d\n", getRTimer(), t, r); 1105 } 1106 #endif 1118 #endif 1119 } 1107 1120 1108 1121 } … … 1125 1138 const bool method = (__HYBRIDNF__ == 1); // || (__HYBRIDNF__ == 2 && __SYZNUMBER__ < 3); 1126 1139 1127 if( __PROT__ ) 1128 { 1129 if (method) 1130 Print("(NF:PR, %s)", (NOPRODUCT == 1)? "*_*": "-*-" ); 1131 else 1132 Print("(NF:TT, %s)", (NOPRODUCT == 1)? "*_*": "-*-" ); 1133 } 1140 if( __PROT__ ) Print("[%s NF|%s]",(method) ? "PR" : "TT", (NOPRODUCT == 1)? "_,_": "^*^" ); 1134 1141 1135 1136 1142 1137 1143 if( !__IGNORETAILS__) … … 1139 1145 if( T != NULL ) 1140 1146 { 1141 #ifndef SING_NDEBUG 1142 if( __PROT__ ) 1147 if( __PROT__ & RTIMER_BENCHMARKING ) 1143 1148 { 1149 #ifdef SING_NDEBUG 1144 1150 t = getTimer(); r = getRTimer(); 1145 1151 Print("\n%% %5d **!TIME4!** SchreyerSyzygyComputation::ComputeSyzygy::SetUpTailTerms(): t: %d, r: %d\n", r, t, r); 1152 #endif 1146 1153 } 1147 #endif1148 1154 1149 1155 SetUpTailTerms(); 1150 1156 1151 #if ndef SING_NDEBUG1152 if( __PROT__ )1157 #ifdef SING_NDEBUG 1158 if( __PROT__ & RTIMER_BENCHMARKING ) 1153 1159 { 1154 1160 t = getTimer() - t; r = getRTimer() - r; … … 1159 1165 } 1160 1166 1161 #if ndef SING_NDEBUG1162 if( __PROT__ )1167 #ifdef SING_NDEBUG 1168 if( __PROT__ & RTIMER_BENCHMARKING ) 1163 1169 { 1164 1170 t = getTimer(); r = getRTimer(); … … 1275 1281 assume( vp == NULL ); 1276 1282 1277 if( __PROT__ && (vp != NULL) ) 1278 Print("!%d!", k); // check k'th syzygy failed 1283 if( __PROT__ && (vp != NULL) ) Warn("ERROR: SyzCheck failed, wrong tail: [%d]\n\n", k); // check k'th syzygy failed 1279 1284 1280 1285 p_Delete(&vp, R); … … 1290 1295 } 1291 1296 1292 #ifndef SING_NDEBUG 1293 if( __PROT__ )1294 { 1295 1296 1297 } 1298 #endif 1297 if( __PROT__ & RTIMER_BENCHMARKING ) 1298 { 1299 #ifdef SING_NDEBUG 1300 t = getTimer() - t; r = getRTimer() - r; 1301 Print("\n%% %5d **!TIME4!** SchreyerSyzygyComputation::ComputeSyzygy::SyzygyLift: dt: %d, dr: %d\n", getRTimer(), t, r); 1302 #endif 1303 } 1299 1304 1300 1305 TT->rank = id_RankFreeModule(TT, R); … … 1303 1308 PrintS("\n]},"); 1304 1309 1305 if( __PROT__ ) 1306 PrintLn(); 1310 if( __PROT__ ) PrintLn(); 1307 1311 } 1308 1312 … … 1351 1355 } 1352 1356 1353 if( __PROT__ ) 1354 Print("[L%dS:%d]", bComputeSecondTerms ? 2 : 1, IDELEMS(m_syzLeads)); 1357 if( __PROT__ ) Print("(L%dS:%d)", bComputeSecondTerms ? 2 : 1, IDELEMS(m_syzLeads)); 1355 1358 1356 1359 } … … 1487 1490 } // otherwise discard that leading term altogether! 1488 1491 else 1489 if( __PROT__ ) 1490 PrintS("$"); // LOT 1492 if( __PROT__ ) ++ m_stat[4]; // PrintS("$"); // LOT 1491 1493 1492 1494 kbTest(bucket); … … 1608 1610 } 1609 1611 1610 if( __PROT__ ) 1611 PrintS("l*"); // lookup & rescale 1612 1612 if( __PROT__ ) ++ m_stat[7]; // PrintS("l*"); // lookup & rescale 1613 1613 1614 1614 p = p_Mult_nn(p, n, r); // ! 1615 1615 n_Delete(&n, r); 1616 1616 } else 1617 if( __PROT__ ) 1618 PrintS("l"); // lookup no rescale 1619 1617 if( __PROT__ ) ++ m_stat[6]; // PrintS("l"); // lookup no rescale 1620 1618 1621 1619 if( __TREEOUTPUT__ ) … … 1644 1642 } 1645 1643 1646 if( __PROT__ ) 1647 PrintS("S"); // store 1644 if( __PROT__ ) ++ m_stat[8]; // PrintS("S"); // store 1648 1645 1649 1646 T.insert( TP2PCache::value_type(p_Copy(multiplier, r), p) ); // T[ multiplier ] = p; … … 1677 1674 } 1678 1675 1679 if( __PROT__ ) 1680 PrintS("S"); // %d", tail + 1); 1676 if( __PROT__ ) ++ m_stat[8]; // PrintS("S"); // store // %d", tail + 1); 1681 1677 1682 1678 T.insert( TP2PCache::value_type(p_Copy(multiplier, r), p) ); … … 1756 1752 if(!( (!__TAILREDSYZ__) || m_lcm.Check(multiplier) )) 1757 1753 { 1758 if( __TAILREDSYZ__ && __PROT__ ) 1759 PrintS("%"); // check LCM ! 1754 if( __TAILREDSYZ__ && __PROT__ ) ++ m_stat[5]; // PrintS("%"); // check LCM ! 1760 1755 1761 1756 return NULL; … … 1872 1867 if( s == NULL ) // No Reducer? 1873 1868 { 1874 if( __PROT__ ) 1875 PrintS("$" ); // LOT?! 1869 if( __PROT__ ) ++ m_stat[4]; // PrintS("$"); // LOT 1876 1870 1877 1871 return s; … … 1892 1886 if( s == NULL ) // No Reducer? 1893 1887 { 1894 if( __PROT__ ) 1895 PrintS("$" ); // LOT?! 1888 if( __PROT__ ) ++ m_stat[4]; // PrintS("$"); // LOT 1896 1889 1897 1890 return s; … … 1917 1910 if( s == NULL ) // No Reducer? 1918 1911 { 1919 if( __TAILREDSYZ__&& __PROT__ ) 1920 PrintS("%" ); // LCM check 1912 if( __TAILREDSYZ__ && __PROT__ ) ++ m_stat[5]; // PrintS("%"); // check LCM ! 1921 1913 1922 1914 return s; -
Singular/dyn_modules/syzextra/syzextra.h
r130797 r2ded87 19 19 #include <vector> 20 20 #include <map> 21 #include <string.h> 21 22 22 23 // include basic definitions … … 264 265 m_sum_bucket(NULL), m_spoly_bucket(NULL) 265 266 { 267 if( __PROT__ ) memset( &m_stat, 0, sizeof(m_stat) ); 266 268 } 267 269 … … 275 277 m_sum_bucket(NULL), m_spoly_bucket(NULL) 276 278 { 279 if( __PROT__ ) memset( &m_stat, 0, sizeof(m_stat) ); 280 277 281 if( __TAILREDSYZ__ && !__IGNORETAILS__) 278 282 { … … 291 295 void SetUpTailTerms(); 292 296 297 /// print statistics about the used heuristics 298 void PrintStats() const; 299 293 300 /// Read off the results while detaching them from this object 294 301 /// NOTE: no copy! … … 298 305 299 306 m_syzLeads = m_syzTails = NULL; // m_LS ? 307 308 if ( __PROT__ ) 309 PrintStats(); 300 310 } 311 301 312 302 313 /// The main driver function: computes … … 401 412 }; 402 413 414 415 /// Statistics: 416 /// 0..3: as in SetUpTailTerms()::PreProcessTerm() // TODO!!?? 417 /// 4: number of terms discarded due to LOT heuristics 418 /// 5: number of terms discarded due to LCM heuristics 419 /// 6, 7: lookups without & with rescale, 8: stores 420 mutable unsigned long m_stat[9]; 421 }; 403 422 404 423 // The following wrappers are just for testing separate functions on highest level (within schreyer.lib)
Note: See TracChangeset
for help on using the changeset viewer.