Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project structure #16

Merged
merged 4 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- run: |
bazel version
bazel mod graph
bazel test -c dbg -s --test_output=all //tests:test
bazel test -c dbg -s --test_output=all '//...'
shell: bash

test_mac:
Expand All @@ -26,7 +26,7 @@ jobs:
- run: |
bazel version
bazel mod graph
bazel test -c dbg -s --test_output=all //tests:test
bazel test -c dbg -s --test_output=all '//...'
shell: bash

clang_format:
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module(name = "compute-graph-autodiff", version = "0.1")
module(name = "cpp-graph-autodiff", version = "0.1")

bazel_dep(name = "abseil-cpp", version = "20230802.0")
bazel_dep(name = "eigen", version = "3.4.0")
Expand Down
13 changes: 12 additions & 1 deletion src/BUILD.bazel → graph_autodiff/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@rules_proto//proto:defs.bzl", "proto_library")

cc_library(
name = "compute_graph_ad",
name = "graph_autodiff",
srcs = ["graph.cpp"],
hdrs = ["graph.h"],
deps = [
Expand All @@ -25,3 +25,14 @@ proto_library(
name = "graph_proto",
srcs = ["graph.proto"],
)

cc_test(
name = "graph_autodiff_test",
size = "small",
srcs = ["graph_test.cpp"],
deps = [
"@abseil-cpp//absl/status:statusor",
"@googletest//:gtest_main",
"//graph_autodiff"
],
)
8 changes: 4 additions & 4 deletions src/graph.cpp → graph_autodiff/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ under certain conditions: see LICENSE.
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "fmt/core.h"
#include "src/graph.pb.h"
#include "graph_autodiff/graph.pb.h"

using namespace compute_graph_ad;
using namespace graph_autodiff;
namespace gpb = graph_proto;

namespace {
Expand Down Expand Up @@ -217,7 +217,7 @@ Graph Graph::from_proto(const gpb::Graph& gproto) noexcept {
return Graph(op_from_proto(gproto));
}

absl::Status compute_graph_ad::to_file(const Graph& graph, fs::path path) {
absl::Status graph_autodiff::to_file(const Graph& graph, fs::path path) {
absl::Status ret_status = absl::OkStatus();

GOOGLE_PROTOBUF_VERIFY_VERSION;
Expand All @@ -240,7 +240,7 @@ absl::Status compute_graph_ad::to_file(const Graph& graph, fs::path path) {
return ret_status;
}

absl::StatusOr<Graph> compute_graph_ad::from_file(fs::path path) {
absl::StatusOr<Graph> graph_autodiff::from_file(fs::path path) {
GOOGLE_PROTOBUF_VERIFY_VERSION;

gpb::Graph gproto;
Expand Down
6 changes: 3 additions & 3 deletions src/graph.h → graph_autodiff/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ under certain conditions: see LICENSE.
#include "absl/container/flat_hash_map.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "src/graph.pb.h"
#include "graph_autodiff/graph.pb.h"

/* A note on the use of shared_ptr<const T>

Expand All @@ -29,7 +29,7 @@ under certain conditions: see LICENSE.
operations, so shared ownership is actually a good fit
*/

namespace compute_graph_ad {
namespace graph_autodiff {

namespace gpb = graph_proto;

Expand Down Expand Up @@ -256,4 +256,4 @@ absl::Status to_file(const Graph& graph, fs::path path);
/// Deserialize a protobuf file into a Graph instance.
absl::StatusOr<Graph> from_file(fs::path path);

} // namespace compute_graph_ad
} // namespace graph_autodiff
File renamed without changes.
5 changes: 3 additions & 2 deletions tests/test.cpp → graph_autodiff/graph_test.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "graph_autodiff/graph.h"

#include <gtest/gtest.h>

#include "absl/status/statusor.h"
#include "src/graph.h"

using namespace compute_graph_ad;
using namespace graph_autodiff;

TEST(Graph, SumEval) {
const Const c(2.);
Expand Down
10 changes: 0 additions & 10 deletions tests/BUILD.bazel

This file was deleted.

Loading