Removes unnecessary sequential map fill up routine for parallel map test cases
authorPeizhao Ou <peizhaoo@uci.edu>
Wed, 14 Feb 2018 22:42:13 +0000 (14:42 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Wed, 14 Feb 2018 22:42:13 +0000 (14:42 -0800)
14 files changed:
test/stress/map/insdelfind/map_insdelfind.cpp
test/stress/map/insdelfind/map_insdelfind.h
test/stress/map/insdelfind/map_insdelfind_bronsonavltree.cpp
test/stress/map/insdelfind/map_insdelfind_ellentree_hp.cpp
test/stress/map/insdelfind/map_insdelfind_ellentree_rcu.cpp
test/stress/map/insdelfind/map_insdelfind_feldman_hashset_hp.cpp
test/stress/map/insdelfind/map_insdelfind_feldman_hashset_rcu.cpp
test/stress/map/insdelfind/map_insdelfind_michael_hp.cpp
test/stress/map/insdelfind/map_insdelfind_michael_rcu.cpp
test/stress/map/insdelfind/map_insdelfind_skip_hp.cpp
test/stress/map/insdelfind/map_insdelfind_skip_rcu.cpp
test/stress/map/insdelfind/map_insdelfind_split_hp.cpp
test/stress/map/insdelfind/map_insdelfind_split_rcu.cpp
test/stress/queue/CMakeLists.txt

index 830356e..9594011 100644 (file)
@@ -35,6 +35,20 @@ namespace map {
     size_t Map_InsDelFind::s_nMapSize = 500000;
     size_t Map_InsDelFind::s_nThreadCount = 8;
     size_t Map_InsDelFind::s_nPassCount = 100000;
+    size_t Map_InsDelFind::s_nBronsonAVLTreeMapPassCount = 100;
+
+    size_t Map_InsDelFind::s_nHpFeldmanPassCount = 100;
+    size_t Map_InsDelFind::s_nHpEllenBinTreeMapPassCount = 100;
+    size_t Map_InsDelFind::s_nHpMichaelMapPassCount = 100;
+    size_t Map_InsDelFind::s_nHpSkipListMapPassCount = 100;
+    size_t Map_InsDelFind::s_nHpSplitListMapPassCount = 100;
+
+    size_t Map_InsDelFind::s_nRcuFeldmanPassCount = 100;
+    size_t Map_InsDelFind::s_nRcuEllenBinTreeMapPassCount = 100;
+    size_t Map_InsDelFind::s_nRcuMichaelMapPassCount = 100;
+    size_t Map_InsDelFind::s_nRcuSkipListMapPassCount = 100;
+    size_t Map_InsDelFind::s_nRcuSplitListMapPassCount = 100;
+
     size_t Map_InsDelFind::s_nMaxLoadFactor = 8;
     unsigned int Map_InsDelFind::s_nInsertPercentage = 5;
     unsigned int Map_InsDelFind::s_nDeletePercentage = 5;
@@ -65,7 +79,57 @@ namespace map {
 
         s_nPassCount = cfg.get_size_t( "PassCount", s_nPassCount );
         if ( s_nPassCount == 0 )
-            s_nThreadCount = 1000;
+            s_nPassCount = 1000;
+
+                               s_nHpFeldmanPassCount =
+            cfg.get_size_t("HpFeldmanPassCount", s_nHpFeldmanPassCount);
+        if (s_nHpFeldmanPassCount == 0)
+          s_nHpFeldmanPassCount = 500;
+
+        s_nRcuFeldmanPassCount =
+            cfg.get_size_t("RcuFeldmanPassCount", s_nRcuFeldmanPassCount);
+        if (s_nRcuFeldmanPassCount == 0)
+          s_nRcuFeldmanPassCount = 500;
+
+        s_nHpEllenBinTreeMapPassCount = cfg.get_size_t(
+            "HpEllenBinTreeMapPassCount", s_nHpEllenBinTreeMapPassCount);
+        if (s_nHpEllenBinTreeMapPassCount == 0)
+          s_nHpEllenBinTreeMapPassCount = 500;
+
+                               s_nRcuEllenBinTreeMapPassCount = cfg.get_size_t(
+            "RcuEllenBinTreeMapPassCount", s_nRcuEllenBinTreeMapPassCount);
+        if (s_nRcuEllenBinTreeMapPassCount == 0)
+          s_nRcuEllenBinTreeMapPassCount = 500;
+
+        s_nHpMichaelMapPassCount =
+            cfg.get_size_t("HpMichaelMapPassCount", s_nHpMichaelMapPassCount);
+        if (s_nHpMichaelMapPassCount == 0)
+          s_nHpMichaelMapPassCount = 500;
+
+        s_nRcuMichaelMapPassCount =
+            cfg.get_size_t("RcuMichaelMapPassCount", s_nRcuMichaelMapPassCount);
+        if (s_nRcuMichaelMapPassCount == 0)
+          s_nRcuMichaelMapPassCount = 500;
+
+        s_nHpSkipListMapPassCount =
+            cfg.get_size_t("HpSkipListMapPassCount", s_nHpSkipListMapPassCount);
+        if (s_nHpSkipListMapPassCount == 0)
+          s_nHpSkipListMapPassCount = 500;
+
+                               s_nRcuSkipListMapPassCount =
+            cfg.get_size_t("RcuSkipListMapPassCount", s_nRcuSkipListMapPassCount);
+        if (s_nRcuSkipListMapPassCount == 0)
+          s_nRcuSkipListMapPassCount = 500;
+
+        s_nHpSplitListMapPassCount =
+            cfg.get_size_t("HpSplitListMapPassCount", s_nHpSplitListMapPassCount);
+        if (s_nHpSplitListMapPassCount == 0)
+          s_nHpSplitListMapPassCount = 500;
+
+        s_nRcuSplitListMapPassCount =
+            cfg.get_size_t("RcuSplitListMapPassCount", s_nRcuSplitListMapPassCount);
+        if (s_nRcuSplitListMapPassCount == 0)
+          s_nRcuSplitListMapPassCount = 500;
 
         s_nMaxLoadFactor = cfg.get_size_t( "MaxLoadFactor", s_nMaxLoadFactor );
         if ( s_nMaxLoadFactor == 0 )
index d11b835..e290d39 100644 (file)
@@ -39,6 +39,21 @@ namespace map {
         static size_t s_nMapSize;           // initial map size
         static size_t s_nThreadCount;       // thread count
         static size_t s_nPassCount;         // pass count
+
+        static size_t s_nBronsonAVLTreeMapPassCount;
+
+        static size_t s_nHpEllenBinTreeMapPassCount;
+        static size_t s_nHpFeldmanPassCount;
+        static size_t s_nHpMichaelMapPassCount;
+        static size_t s_nHpSkipListMapPassCount;
+        static size_t s_nHpSplitListMapPassCount;
+
+        static size_t s_nRcuEllenBinTreeMapPassCount;
+        static size_t s_nRcuFeldmanPassCount;
+        static size_t s_nRcuMichaelMapPassCount;
+        static size_t s_nRcuSkipListMapPassCount;
+        static size_t s_nRcuSplitListMapPassCount;
+
         static size_t s_nMaxLoadFactor;     // maximum load factor
         static unsigned int s_nInsertPercentage;
         static unsigned int s_nDeletePercentage;
@@ -128,32 +143,34 @@ namespace map {
                 size_t const nNormalize = size_t(-1) / ( s_nMapSize * 2 );
 
                 size_t nRand = 0;
-                for (size_t pCount; pCount < s_nPassCount; pCount++) {
+                for (size_t pCount = 0; pCount < s_nPassCount; pCount++) {
+                    nRand = cds::bitop::RandXorShift( nRand );
+                    size_t key = nRand / nNormalize;
                     nRand = cds::bitop::RandXorShift( nRand );
-                    size_t n = nRand / nNormalize;
+                    size_t value = nRand / nNormalize;
                     switch ( s_arrShuffle[i] ) {
                     case do_find:
-                        if ( rMap.contains( n ))
+                        if ( rMap.contains( key ))
                             ++m_nFindSuccess;
                         else
                             ++m_nFindFailed;
                         break;
                     case do_insert:
-                        if ( n % 2 ) {
-                            if ( rMap.insert( n, n ))
+                        if ( key % 2 ) {
+                            if ( rMap.insert( key, value ))
                                 ++m_nInsertSuccess;
                             else
                                 ++m_nInsertFailed;
                         }
                         else {
-                            if ( rMap.update( n, update_functor(), true ).first )
+                            if ( rMap.update( key, update_functor(), true ).first )
                                 ++m_nInsertSuccess;
                             else
                                 ++m_nInsertFailed;
                         }
                         break;
                     case do_delete:
-                        if ( rMap.erase( n ))
+                        if ( rMap.erase( key ))
                             ++m_nDeleteSuccess;
                         else
                             ++m_nDeleteFailed;
@@ -171,30 +188,11 @@ namespace map {
         void do_test( Map& testMap )
         {
             typedef Worker<Map> worker;
-
-            // fill map - only odd number
-            {
-                std::vector<size_t> arr;
-                arr.reserve( s_nMapSize );
-                for ( size_t i = 0; i < s_nMapSize; ++i )
-                    arr.push_back( i * 2 + 1);
-                shuffle( arr.begin(), arr.end());
-                for ( size_t i = 0; i < s_nMapSize; ++i )
-                    testMap.insert( arr[i], arr[i] );
-            }
-
             cds_test::thread_pool& pool = get_pool();
             pool.add( new worker( pool, testMap ), s_nThreadCount );
 
-            propout() << std::make_pair( "thread_count", s_nThreadCount )
-                << std::make_pair( "insert_percentage", s_nInsertPercentage )
-                << std::make_pair( "delete_percentage", s_nDeletePercentage )
-                << std::make_pair( "map_size", s_nMapSize );
-
             std::chrono::milliseconds duration = pool.run();
 
-            propout() << std::make_pair( "duration", duration );
-
             size_t nInsertSuccess = 0;
             size_t nInsertFailed = 0;
             size_t nDeleteSuccess = 0;
@@ -222,7 +220,6 @@ namespace map {
                 << std::make_pair( "finish_map_size", testMap.size());
 
             {
-                ASSERT_TRUE( std::chrono::duration_cast<std::chrono::seconds>(duration).count() > 0 );
                 size_t nTotalOps = nInsertSuccess + nInsertFailed + nDeleteSuccess + nDeleteFailed + nFindSuccess + nFindFailed;
                 propout() << std::make_pair( "avg_speed", nTotalOps / std::chrono::duration_cast<std::chrono::seconds>( duration ).count());
             }
@@ -243,6 +240,55 @@ namespace map {
             Map testMap( *this );
             do_test( testMap );
         }
+
+        template <class Map>
+        void run_bronson_avl_tree() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nBronsonAVLTreeMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_ellen_bin_tree_hp() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nHpEllenBinTreeMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_skip_list_hp() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nHpSkipListMapPassCount;
+          run_test<Map>();
+        }
+
+                               template <class Map>
+        void run_feldman_hp() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nHpFeldmanPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_ellen_bin_tree_rcu() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nRcuEllenBinTreeMapPassCount;
+          run_test<Map>();
+        }
+
+        template <class Map>
+        void run_skip_list_rcu() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nRcuSkipListMapPassCount;
+          run_test<Map>();
+        }
+
+                               template <class Map>
+        void run_feldman_rcu() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nRcuFeldmanPassCount;
+          run_test<Map>();
+        }
     };
 
     class Map_InsDelFind_LF: public Map_InsDelFind
@@ -257,6 +303,34 @@ namespace map {
             Map_InsDelFind::run_test<Map>();
         }
 
+                               template <class Map>
+        void run_michael_hp() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nHpMichaelMapPassCount;
+          Map_InsDelFind_LF::run_test<Map>();
+        }
+
+        template <class Map>
+        void run_split_list_hp() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nHpSplitListMapPassCount;
+          Map_InsDelFind_LF::run_test<Map>();
+        }
+
+        template <class Map>
+        void run_michael_rcu() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nRcuMichaelMapPassCount;
+          Map_InsDelFind_LF::run_test<Map>();
+        }
+
+                               template <class Map>
+        void run_split_list_rcu() {
+          Map_InsDelFind::s_nPassCount =
+              Map_InsDelFind::s_nRcuSplitListMapPassCount;
+          Map_InsDelFind_LF::run_test<Map>();
+        }
+
         static std::vector<size_t> get_load_factors();
     };
 
index 410e944..6807154 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_BronsonAVLTreeMap( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_BronsonAVLTreeMap( Map_InsDelFind, run_bronson_avl_tree, size_t, size_t )
 
 } // namespace map
index d4c07ce..88ba4d6 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_EllenBinTreeMap_HP( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_EllenBinTreeMap_HP( Map_InsDelFind, run_ellen_bin_tree_hp, size_t, size_t )
 
 } // namespace map
index 844c28d..43306b5 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_EllenBinTreeMap_RCU( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_EllenBinTreeMap_RCU( Map_InsDelFind, run_ellen_bin_tree_rcu, size_t, size_t )
 
 } // namespace map
index b097858..0787b0c 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_FeldmanHashMap_fixed_HP( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_FeldmanHashMap_fixed_HP( Map_InsDelFind, run_feldman_hp, size_t, size_t )
 
 } // namespace map
index 67c8821..2e6ecfe 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_FeldmanHashMap_fixed_RCU( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_FeldmanHashMap_fixed_RCU( Map_InsDelFind, run_feldman_rcu, size_t, size_t )
 
 } // namespace map
index afa4106..61b8bd2 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_MichaelMap_HP( Map_InsDelFind_LF, run_test, size_t, size_t )
+    CDSSTRESS_MichaelMap_HP( Map_InsDelFind_LF, run_michael_hp, size_t, size_t )
 
 } // namespace map
index 3d44177..309c1e0 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_MichaelMap_RCU( Map_InsDelFind_LF, run_test, size_t, size_t )
+    CDSSTRESS_MichaelMap_RCU( Map_InsDelFind_LF, run_michael_rcu, size_t, size_t )
 
 } // namespace map
index cbc76e3..329a773 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_SkipListMap_HP( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_SkipListMap_HP( Map_InsDelFind, run_skip_list_hp, size_t, size_t )
 
 } // namespace map
index f70c5ee..19d1085 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_SkipListMap_RCU( Map_InsDelFind, run_test, size_t, size_t )
+    CDSSTRESS_SkipListMap_RCU( Map_InsDelFind, run_skip_list_rcu, size_t, size_t )
 
 } // namespace map
index ece864c..0c501bc 100644 (file)
@@ -33,7 +33,7 @@
 
 namespace map {
 
-    CDSSTRESS_SplitListMap_HP( Map_InsDelFind_LF, run_test, size_t, size_t )
-    CDSSTRESS_SplitListIterableMap( Map_InsDelFind_LF, run_test, size_t, size_t )
+    CDSSTRESS_SplitListMap_HP( Map_InsDelFind_LF, run_split_list_hp, size_t, size_t )
+    CDSSTRESS_SplitListIterableMap( Map_InsDelFind_LF, run_split_list_hp, size_t, size_t )
 
 } // namespace map
index a090fad..9da9c8a 100644 (file)
@@ -33,6 +33,6 @@
 
 namespace map {
 
-    CDSSTRESS_SplitListMap_RCU( Map_InsDelFind_LF, run_test, size_t, size_t )
+    CDSSTRESS_SplitListMap_RCU( Map_InsDelFind_LF, run_split_list_rcu, size_t, size_t )
 
 } // namespace map
index 7de1359..a11b55c 100644 (file)
@@ -29,9 +29,9 @@ set(CDSSTRESS_QUEUE_PUSHPOP_SOURCES
     push_pop.cpp
     #intrusive_push_pop.cpp    
 )
-#add_executable(${CDSSTRESS_QUEUE_PUSHPOP} ${CDSSTRESS_QUEUE_PUSHPOP_SOURCES})
-#target_link_libraries(${CDSSTRESS_QUEUE_PUSHPOP} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
-#add_test(NAME ${CDSSTRESS_QUEUE_PUSHPOP} COMMAND ${CDSSTRESS_QUEUE_PUSHPOP} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
+add_executable(${CDSSTRESS_QUEUE_PUSHPOP} ${CDSSTRESS_QUEUE_PUSHPOP_SOURCES})
+target_link_libraries(${CDSSTRESS_QUEUE_PUSHPOP} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
+add_test(NAME ${CDSSTRESS_QUEUE_PUSHPOP} COMMAND ${CDSSTRESS_QUEUE_PUSHPOP} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    
 
 # stress-queue-random
 set(CDSSTRESS_QUEUE_RANDOM stress-queue-random)