Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
lockshaw committed Feb 9, 2025
1 parent 85dace1 commit 9d741dc
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 52 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,49 +1,42 @@
#include "compiler/series_parallel/computation_graph/get_computation_graph_series_parallel_decomposition.h"
#include "models/bert/bert.h"
#include "models/candle_uno/candle_uno.h"
#include "models/inception_v3/inception_v3.h"
#include "models/split_test/split_test.h"
#include "models/transformer/transformer.h"
#include "models/inception_v3/inception_v3.h"
#include "models/candle_uno/candle_uno.h"
#include "models/bert/bert.h"
#include <benchmark/benchmark.h>

using namespace ::FlexFlow;

static void
benchmark_get_computation_graph_series_parallel_decomposition(benchmark::State &state, ComputationGraph const &cg) {
static void benchmark_get_computation_graph_series_parallel_decomposition(
benchmark::State &state, ComputationGraph const &cg) {
// ComputationGraph cg = state.range(0);
// get_split_test_computation_graph(/*batch_size=*/8);
// get_split_test_computation_graph(/*batch_size=*/8);

for (auto _ : state) {
get_computation_graph_series_parallel_decomposition(cg);
}
}

BENCHMARK_CAPTURE(
benchmark_get_computation_graph_series_parallel_decomposition,
split_test,
get_split_test_computation_graph(/*batch_size=*/8_n)
);
BENCHMARK_CAPTURE(benchmark_get_computation_graph_series_parallel_decomposition,
split_test,
get_split_test_computation_graph(/*batch_size=*/8_n));

BENCHMARK_CAPTURE(
benchmark_get_computation_graph_series_parallel_decomposition,
transformer,
get_transformer_computation_graph(get_default_transformer_config())
);
benchmark_get_computation_graph_series_parallel_decomposition,
transformer,
get_transformer_computation_graph(get_default_transformer_config()));

BENCHMARK_CAPTURE(
benchmark_get_computation_graph_series_parallel_decomposition,
bert,
get_bert_computation_graph(get_default_bert_config())
);

BENCHMARK_CAPTURE(
benchmark_get_computation_graph_series_parallel_decomposition,
candle_uno,
get_candle_uno_computation_graph(get_default_candle_uno_config())
);
BENCHMARK_CAPTURE(benchmark_get_computation_graph_series_parallel_decomposition,
bert,
get_bert_computation_graph(get_default_bert_config()));

BENCHMARK_CAPTURE(
benchmark_get_computation_graph_series_parallel_decomposition,
inception_v3,
get_inception_v3_computation_graph(get_default_inception_v3_training_config())
);
benchmark_get_computation_graph_series_parallel_decomposition,
candle_uno,
get_candle_uno_computation_graph(get_default_candle_uno_config()));

BENCHMARK_CAPTURE(benchmark_get_computation_graph_series_parallel_decomposition,
inception_v3,
get_inception_v3_computation_graph(
get_default_inception_v3_training_config()));
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
#include "./random_dag.h"
#include "utils/containers/vector_of.h"
#include "utils/graph/algorithms.h"
#include "utils/nonnegative_int/nonnegative_int.h"
#include "utils/graph/instances/adjacency_digraph.h"
#include "utils/nonnegative_int/nonnegative_int.h"
#include "utils/random_utils.h"

namespace FlexFlow {

DiGraphView random_dag(nonnegative_int num_nodes,
float edges_fraction) {
assert (edges_fraction <= 1.0);
assert (edges_fraction >= 0.0);
DiGraphView random_dag(nonnegative_int num_nodes, float edges_fraction) {
assert(edges_fraction <= 1.0);
assert(edges_fraction >= 0.0);

int max_num_edges = [&] {
int nn = num_nodes.unwrap_nonnegative();

return (nn * (nn - 1)) / 2;
}();
}();

nonnegative_int num_edges = nonnegative_int{
static_cast<int>(max_num_edges * edges_fraction),
static_cast<int>(max_num_edges * edges_fraction),
};

assert (num_edges <= max_num_edges);
assert(num_edges <= max_num_edges);

DiGraph g = DiGraph::create<AdjacencyDiGraph>();
std::vector<Node> n = add_nodes(g, num_nodes.unwrap_nonnegative());
Expand All @@ -32,7 +31,7 @@ DiGraphView random_dag(nonnegative_int num_nodes,
Node n1 = select_random(n);
Node n2 = select_random(n);

if (n1 == n2) {
if (n1 == n2) {
continue;
}

Expand All @@ -47,4 +46,4 @@ DiGraphView random_dag(nonnegative_int num_nodes,
return g;
}

}
} // namespace FlexFlow
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace FlexFlow {

DiGraphView random_dag(nonnegative_int num_nodes, float edges_fraction);


} // namespace FlexFlow

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ using namespace ::FlexFlow;
static void benchmark_transitive_closure(benchmark::State &state) {
int edge_percentage = 100 - state.range(0);
int num_nodes = state.range(1);
DiGraphView g = random_dag(nonnegative_int{num_nodes}, static_cast<float>(edge_percentage) / 100.0);
DiGraphView g = random_dag(nonnegative_int{num_nodes},
static_cast<float>(edge_percentage) / 100.0);

for (auto _ : state) {
transitive_closure(g);
Expand All @@ -16,6 +17,6 @@ static void benchmark_transitive_closure(benchmark::State &state) {

BENCHMARK(benchmark_transitive_closure)
->ArgsProduct({
benchmark::CreateDenseRange(25, 75, /*step=*/25),
benchmark::CreateRange(16, 256, /*multi=*/54),
benchmark::CreateDenseRange(25, 75, /*step=*/25),
benchmark::CreateRange(16, 256, /*multi=*/54),
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ using namespace ::FlexFlow;
static void benchmark_transitive_reduction(benchmark::State &state) {
int edge_percentage = state.range(0);
int num_nodes = state.range(1);
DiGraphView g = random_dag(nonnegative_int{num_nodes}, static_cast<float>(edge_percentage) / 100.0);
DiGraphView g = random_dag(nonnegative_int{num_nodes},
static_cast<float>(edge_percentage) / 100.0);

for (auto _ : state) {
transitive_reduction(g);
Expand All @@ -16,6 +17,6 @@ static void benchmark_transitive_reduction(benchmark::State &state) {

BENCHMARK(benchmark_transitive_reduction)
->ArgsProduct({
benchmark::CreateDenseRange(25, 75, /*step=*/25),
benchmark::CreateRange(16, 256, /*multi=*/54),
benchmark::CreateDenseRange(25, 75, /*step=*/25),
benchmark::CreateRange(16, 256, /*multi=*/54),
});
2 changes: 1 addition & 1 deletion lib/utils/include/utils/archetypes/ordered_value_type.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_ARCHETYPES_ORDERED_VALUE_TYPE_H
#define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_ARCHETYPES_ORDERED_VALUE_TYPE_H

#include <libassert/assert.hpp>
#include <functional>
#include <libassert/assert.hpp>

namespace FlexFlow {

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/include/utils/archetypes/value_type.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_ARCHETYPES_VALUE_TYPE_H
#define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_ARCHETYPES_VALUE_TYPE_H

#include <libassert/assert.hpp>
#include <fmt/format.h>
#include <functional>
#include <libassert/assert.hpp>
#include <ostream>
#include <sstream>

Expand Down

0 comments on commit 9d741dc

Please sign in to comment.