Skip to content

Commit

Permalink
Revert "GNN tests (#12)" (#19)
Browse files Browse the repository at this point in the history
This reverts commit 9b91847.
  • Loading branch information
meyerzinn authored Apr 2, 2024
1 parent 9b91847 commit 0302191
Show file tree
Hide file tree
Showing 104 changed files with 562 additions and 701 deletions.
31 changes: 0 additions & 31 deletions .gitattributes

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ jobs:
shell: bash -l {0}
strategy:
matrix:
build-type: ['Release']
sanitizer-type: ['nosan']
# exclude:
# - build-type: 'Debug'
# sanitizer-type: 'san'
build-type: ['Release', 'Debug']
sanitizer-type: ['nosan', 'san']
exclude:
- build-type: 'Debug'
sanitizer-type: 'san'
needs: docker-create-ubuntu-2204

steps:
Expand Down Expand Up @@ -105,9 +105,9 @@ jobs:
make docker
- name: Run Tests
timeout-minutes: 15
timeout-minutes: 5
run: |
CONTAINER_CMD="bash -lc 'source /opt/intel/oneapi/setvars.sh && make run-tests'" \
CONTAINER_CMD="make run-tests" \
IMAGE_NAME="${{ env.IMAGE_NAME }}" \
VERSION="${{ env.IMAGE_VERSION }}" \
make docker
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,11 @@ run-tests:
@ctest --test-dir build -R wmd --verbose
@ctest --test-dir build -R large-vec --verbose
@ctest --test-dir build -R compile-lscsr --verbose
@ctest --test-dir build/libgnn/test --verbose

# this command is slow since hooks are not stored in the container image
# this is mostly for CI use
docker-pre-commit:
@docker --context ${CONTAINER_CONTEXT} run --rm \
-v ${SRC_DIR}/:${CONTAINER_SRC_DIR} --privileged \
--workdir=${CONTAINER_WORKDIR} -t \
${IMAGE_NAME}:${VERSION} bash -lc "git config --global --add safe.directory /galois && make hooks && make pre-commit"
${IMAGE_NAME}:${VERSION} bash -lc "git config --global --add safe.directory /pando-galois && make hooks && make pre-commit"
3 changes: 0 additions & 3 deletions inputs/cora/cora-dims.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora-feat.bin

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora-feats.bin

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora-labels.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora-test_mask.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora-train_mask.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora-val_mask.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora.csgr

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora.el

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora.features

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora.ft

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora.gr

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora.sgr

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora_edgelist.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora_full.npz

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/cora/cora_labels.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-dims.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-feats.bin

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-labels.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-mlabels.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-test-feats.bin

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-test-labels-dims.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-test-labels.bin

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-test-mapping.bin

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-test_mask.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-train_mask.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester-val_mask.txt

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester.csgr

This file was deleted.

3 changes: 0 additions & 3 deletions inputs/tester/tester.el

This file was deleted.

11 changes: 7 additions & 4 deletions libcusp/test/shad-dist-graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ int main() {
sumGlobalNodes += graph->numMasters();
sumGlobalEdges += graph->sizeEdges();

assert(sumGlobalNodes.reduce() == numNodes);
assert(sumGlobalNodes.reduce() == graph->globalSize());
assert(sumGlobalEdges.reduce() == numEdges);
assert(sumGlobalEdges.reduce() == graph->globalSizeEdges());
uint64_t reducedSumGlobalNodes = sumGlobalNodes.reduce();
uint64_t reducedSumGlobalEdges = sumGlobalEdges.reduce();

assert(reducedSumGlobalNodes == numNodes);
assert(reducedSumGlobalNodes == graph->globalSize());
assert(reducedSumGlobalEdges == numEdges);
assert(reducedSumGlobalEdges == graph->globalSizeEdges());

std::cout << "Num. nodes/edges tests has been passed\n";

Expand Down
32 changes: 18 additions & 14 deletions libgnn/include/galois/graphs/GNNGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ namespace galois {
// TODO remove the need to hardcode this path
//! Path to location of all gnn files
static const std::string default_gnn_dataset_path =
//"/net/ohm/export/iss/inputs/Learning/";
" nope";
"/home/hochan/inputs/Learning/";

//! Helper struct to maintain start/end/size of any particular range. Mostly
//! used for mask ranges.
Expand Down Expand Up @@ -71,9 +70,6 @@ class GNNGraph {
std::string("[") +
std::to_string(galois::runtime::getSystemNetworkInterface().ID) +
std::string("] ");

std::cout << "input directory:" << input_directory_ << ", "
<< " data set name:" << dataset_name << "\n";
// load partition
partitioned_graph_ =
LoadPartition(input_directory_, dataset_name, partition_scheme);
Expand Down Expand Up @@ -1661,15 +1657,6 @@ class GNNGraph {
}
GALOIS_LOG_VERBOSE("Partition loading: File to read is {}", input_file);

std::cout << "input file:" << input_file << "\n";
if (FILE* fp = fopen(input_file.c_str(), "r")) {
std::cout << "succeeded to read the input file:" << input_file << "\n"
<< std::flush;
fclose(fp);
} else {
std::cout << "failed to read the input file:" << input_file << "\n"
<< std::flush;
}
// load partition
switch (partition_scheme) {
case galois::graphs::GNNPartitionScheme::kOEC:
Expand Down Expand Up @@ -2411,6 +2398,23 @@ class GNNGraph {
num_correct_.reset();
total_checked_.reset();

#if 0
std::cout << "single accuracy print:\n";
for (int i = *begin_owned(); i < *end_owned(); ++i) {
if (!IsValidForPhase(i, GNNPhase::kBatch)) {
continue;
}
//std::cout << subgraph_->SIDToLID(i) << ", " << galois::MaxIndex(num_label_classes_, &predictions[i * num_label_classes_]) <<
std::cout << "accuracy:" << subgraph_->SIDToLID(i) << ", " <<
predictions[i * num_label_classes_] << ", " <<
predictions[i * num_label_classes_ + 1] << ", " <<
predictions[i * num_label_classes_ + 2] << ", " <<
predictions[i * num_label_classes_ + 3] << ", " <<
predictions[i * num_label_classes_ + 4] << "-> " <<
galois::MaxIndex(num_label_classes_, &predictions[i * num_label_classes_]) <<
" vs " << GetSingleClassLabel(i) << "\n";
}
#endif
galois::do_all(
// will only loop over sampled nodes if sampling is on
galois::iterate(begin_owned(), end_owned()),
Expand Down
10 changes: 3 additions & 7 deletions libgnn/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
find_package(OpenMP)

set(TESTINPUT "${Galois_SOURCE_DIR}/inputs")
add_definitions("-DTESTER_DIR=\"${TESTINPUT}/tester/\"")
add_definitions("-DCORA_DIR=\"${TESTINPUT}/cora/\"")

set(hosts)
set(host 6)
set(host 12)
while (${host} GREATER 1)
list(APPEND hosts ${host})
math(EXPR host "${host} - 1")
Expand All @@ -21,7 +17,7 @@ if (NOT GALOIS_ENABLE_GPU)
${GALOIS_TESTS}
convlayer-test
sage-layer-test
# l2norm-layer-test TODO(hc): L2Norm is not maintained
l2norm-layer-test
softmaxlayer-test
sigmoidlayer-test
gnnconstruct-test
Expand All @@ -31,7 +27,7 @@ if (NOT GALOIS_ENABLE_GPU)
epoch-test
multilabel-epoch-test
multilabel-read
# f1-test TODO(hc): it is a multilable test and will be fixed later
f1-test
sample-bit-test
gcn-sample-edge-test
)
Expand Down
16 changes: 8 additions & 8 deletions libgnn/test/accuracy-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ int main() {

// load test graph
auto test_graph = std::make_unique<galois::graphs::GNNGraph<char, void>>(
TESTER_DIR, "tester", galois::graphs::GNNPartitionScheme::kOEC, true,
false);
"tester", galois::graphs::GNNPartitionScheme::kOEC, true, false);

std::vector<galois::GNNLayerType> layer_types = {
galois::GNNLayerType::kGraphConvolutional};
Expand All @@ -35,22 +34,23 @@ int main() {
//////////////////////////////////////////////////////////////////////////////

galois::PointerWithSize<galois::GNNFloat> distributions = gnn->DoInference();

// accuracy will be 0.2: everything chooses the first 1 as the entire row
// is the same
float pred_accuracy = gnn->GetGlobalAccuracy(distributions);
GALOIS_LOG_VERBOSE("{}", pred_accuracy);
GALOIS_LOG_ASSERT(static_cast<int>(pred_accuracy * 1000) == 333);
GALOIS_LOG_ASSERT(pred_accuracy == static_cast<float>(0.2));

// validation mode
gnn->SetLayerPhases(galois::GNNPhase::kValidate);
galois::PointerWithSize<galois::GNNFloat> dist2 = gnn->DoInference();
pred_accuracy = gnn->GetGlobalAccuracy(dist2);
GALOIS_LOG_ASSERT(pred_accuracy == static_cast<float>(0));
GALOIS_LOG_ASSERT(pred_accuracy == static_cast<float>(0.0));

// test mode
gnn->SetLayerPhases(galois::GNNPhase::kTest);
galois::PointerWithSize<galois::GNNFloat> dist3 = gnn->DoInference();
pred_accuracy = gnn->GetGlobalAccuracy(dist3);
GALOIS_LOG_ASSERT(pred_accuracy == static_cast<float>(0));
GALOIS_LOG_ASSERT(pred_accuracy == static_cast<float>(0.0));

// manufactured predictions to make sure it predicts things correctly based
// on mode
Expand All @@ -62,11 +62,11 @@ int main() {
gnn->SetLayerPhases(galois::GNNPhase::kTrain);
pred_accuracy = gnn->GetGlobalAccuracy(mpred);
GALOIS_LOG_VERBOSE("{}", pred_accuracy);
GALOIS_LOG_ASSERT(static_cast<int>(pred_accuracy * 1000) == 666);
GALOIS_LOG_ASSERT(pred_accuracy == static_cast<float>(0.8));

gnn->SetLayerPhases(galois::GNNPhase::kValidate);
pred_accuracy = gnn->GetGlobalAccuracy(mpred);
GALOIS_LOG_ASSERT(pred_accuracy == static_cast<float>(0.5));
GALOIS_LOG_ASSERT(pred_accuracy == static_cast<float>(0.0));

gnn->SetLayerPhases(galois::GNNPhase::kTest);
pred_accuracy = gnn->GetGlobalAccuracy(mpred);
Expand Down
6 changes: 2 additions & 4 deletions libgnn/test/aggregate-sync-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ int main() {
}

auto test_graph = std::make_unique<galois::graphs::GNNGraph<char, void>>(
TESTER_DIR, "tester", galois::graphs::GNNPartitionScheme::kOEC, true,
false);
"tester", galois::graphs::GNNPartitionScheme::kOEC, true, false);

// print edges for sanity
for (size_t node = 0; node < test_graph->size(); node++) {
Expand Down Expand Up @@ -208,8 +207,7 @@ int main() {
}
//////////////////////////////////////////////////////////////////////////////
auto test_graph_2 = std::make_unique<galois::graphs::GNNGraph<char, void>>(
TESTER_DIR, "tester", galois::graphs::GNNPartitionScheme::kCVC, true,
false);
"tester", galois::graphs::GNNPartitionScheme::kCVC, true, false);
// print edges for sanity
for (size_t node = 0; node < test_graph_2->size(); node++) {
for (auto e = test_graph_2->edge_begin(node);
Expand Down
3 changes: 1 addition & 2 deletions libgnn/test/back-conv-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ int main() {
num_threads);
// load test graph
galois::graphs::GNNGraph<char, void> test_graph(
TESTER_DIR, "tester", galois::graphs::GNNPartitionScheme::kCVC, true,
false);
"tester", galois::graphs::GNNPartitionScheme::kCVC, true, false);
galois::PointerWithSize<galois::GNNFloat> feats =
test_graph.GetLocalFeatures();
for (size_t row = 0; row < test_graph.size(); row++) {
Expand Down
3 changes: 1 addition & 2 deletions libgnn/test/convlayer-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ int main() {
num_threads);
// load test graph
galois::graphs::GNNGraph<char, void> test_graph(
TESTER_DIR, "tester", galois::graphs::GNNPartitionScheme::kOEC, true,
false);
"tester", galois::graphs::GNNPartitionScheme::kOEC, true, false);

galois::PointerWithSize<galois::GNNFloat> feats =
test_graph.GetLocalFeatures();
Expand Down
Loading

0 comments on commit 0302191

Please sign in to comment.