Commit 37d1c414 authored by Illia Kolesnik's avatar Illia Kolesnik
Browse files

Fixed seq benchmark

parent e5383f8d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@ Results
benchmarkRefinement( const vector< TNL::Containers::StaticArray< 3, Real > >& coords )
{
   ofstream output( "/dev/null" );
   cerr << "Refines " << coords.size() << " cells\n";

   Benchmark b( output, TEST_ITERATIONS, BENCHMARK_VERBOSE );
   auto linear = [ & ]()
@@ -162,6 +163,7 @@ Results
benchmarkSearching( const AbsOctree& linearOctree, const AbsOctree& classicOctree, const vector< Index >& indecies )
{
   ofstream output( "/dev/null" );
   cerr << "Searches " << indecies.size() << " cells\n";

   Benchmark b( output, TEST_ITERATIONS, BENCHMARK_VERBOSE );
   auto linear = [ & ]()
@@ -197,6 +199,7 @@ benchmarkSearchingNotRefined( const AbsOctree& linearOctree,
      indecies.push_back( *linearOctree.getCellByCoordinates( coord ) );

   ofstream output( "/dev/null" );
   cerr << "Searches Not Ref " << indecies.size() << " cells\n";

   Benchmark b( output, TEST_ITERATIONS, BENCHMARK_VERBOSE );
   auto linear = [ & ]()
@@ -226,6 +229,7 @@ Results
benchmarkSearchingAll( const AbsOctree& linearOctree, const AbsOctree& classicOctre, const vector< Index >& indecies )
{
   ofstream output( "/dev/null" );
   cerr << "Searches All " << indecies.size() << " cells\n";

   Benchmark b( output, TEST_ITERATIONS, BENCHMARK_VERBOSE );
   auto linear = [ & ]()
@@ -261,6 +265,7 @@ benchmarkSearchingAllNotRefined( const AbsOctree& linearOctree,
      indecies.push_back( *linearOctree.getCellByCoordinates( coord ) );

   ofstream output( "/dev/null" );
   cerr << "Searches All Not Ref " << indecies.size() << " cells\n";

   Benchmark b( output, TEST_ITERATIONS, BENCHMARK_VERBOSE );
   auto linear = [ & ]()
@@ -306,7 +311,7 @@ main( Index argc, char const* argv[] )
   vector< Index > indecies = readIndecies( benchDir );
   string distribution = readDistribution( benchDir );

   cerr << "Refines " << refineCoords.size() << " searches " << searchCoords.size() << " indecies " << indecies.size()
   cerr << "-- Refines " << refineCoords.size() << " searches " << searchCoords.size() << " indecies " << indecies.size()
        << " distribution " << distribution << endl;

   // Create benchmark objects
+40 −38
Original line number Diff line number Diff line
@@ -10,7 +10,8 @@ INDECIES_FILE = "indecies.txt"
DISTRIBUTION_FILE = "distribution.txt"

if len(sys.argv) < 4:
   print("Usage: python3 Generator.py <number_of_coords_to_refine> <number_of_coords_to_search> <distribution:unif|normal|exp|> [output_dir]")
    print(
        "Usage: python3 Generator.py <number_of_coords_to_refine> <number_of_coords_to_search> <distribution:unif|normal|exp|> [output_dir]")
    exit(1)

# Decode arguments
@@ -42,6 +43,7 @@ def get_random():
        if 0 <= result <= 1:
            return result


if not (distribution == "unif" or distribution == "normal" or distribution == "exp"):
    print("Unknown distribution <distribution:unif|normal|exp|>")
    exit(1)
@@ -71,7 +73,7 @@ with open(f"{bench_dir}/{SEARCH_FILE}", 'w') as f:
# Generate indecies for SEARCH
with open(f"{bench_dir}/{INDECIES_FILE}", 'w') as f:
    for i in range(number_search):
      f.write(f"{random.randint(0, (number_refine * 8) + 1)}\n")
        f.write(f"{random.randint(0, number_refine * 8)}\n")

# Write distribution
with open(f"{bench_dir}/{DISTRIBUTION_FILE}", 'w') as f: