From b439876b834a66b61cb2d55c1a9741707372d763 Mon Sep 17 00:00:00 2001 From: Benjamin Brock Date: Thu, 26 Sep 2024 16:48:53 -0700 Subject: [PATCH] Update to add SPDX identifiers (#13) * Add SPDX statement to files. --- .clang-format | 4 + .github/workflows/ci.yml | 4 + .gitignore | 8 + .pre-commit-config.yaml | 9 + CMakeLists.txt | 4 + LICENSE => LICENSES/BSD-3-Clause.txt | 0 README.md | 6 + examples/CMakeLists.txt | 5 + examples/benchmark_read.c | 6 + examples/benchmark_read_parallel.c | 16 +- examples/benchmark_write.c | 6 + examples/bsp-ls.c | 6 + examples/bsp2mtx.c | 6 + examples/check_equivalence.c | 6 + examples/check_equivalence_parallel.c | 217 ++++++++++++++++++ examples/cpp/CMakeLists.txt | 4 + examples/cpp/benchmark_read.cpp | 4 + examples/cpp/benchmark_write.cpp | 4 + examples/cpp/bsp-ls.cpp | 4 + examples/cpp/bsp2mtx.cpp | 4 + examples/cpp/check_equivalence.cpp | 4 + examples/cpp/mtx2bsp.cpp | 4 + examples/cpp/simple_matrix_read.cpp | 4 + examples/cpp/simple_matrix_write.cpp | 4 + examples/cpp/simple_read.cpp | 4 + examples/cpp/simple_write.cpp | 4 + examples/mtx2bsp.c | 6 + examples/simple_matrix_read.c | 6 + examples/simple_matrix_write.c | 6 + examples/simple_read.c | 6 + examples/simple_write.c | 6 + include/CMakeLists.txt | 4 + include/binsparse/array.h | 6 + include/binsparse/binsparse.h | 6 + include/binsparse/convert_matrix.h | 6 + include/binsparse/detail/cpp/array.hpp | 4 + include/binsparse/detail/declamp_values.h | 6 + include/binsparse/detail/detail.h | 6 + include/binsparse/detail/parse_dataset.h | 6 + include/binsparse/detail/shm_tools.h | 6 + include/binsparse/generate.h | 6 + include/binsparse/hdf5_wrapper.h | 6 + include/binsparse/matrix.h | 6 + include/binsparse/matrix_formats.h | 6 + .../binsparse/matrix_market/coo_sort_tools.h | 6 + .../matrix_market/matrix_market_inspector.h | 6 + .../matrix_market/matrix_market_read.h | 6 + .../matrix_market/matrix_market_type_t.h | 6 + .../matrix_market/matrix_market_write.h | 6 + include/binsparse/minimize_values.h | 6 + include/binsparse/read_matrix.h | 6 + include/binsparse/structure.h | 6 + include/binsparse/types.h | 6 + include/binsparse/write_matrix.h | 6 + requirements.txt | 4 + scripts/read_cold_benchmarks.sh | 14 +- scripts/read_warm_benchmarks.sh | 14 +- scripts/test.sh | 3 + scripts/test_fastmm.sh | 7 +- scripts/test_fastmm_warm.sh | 7 +- scripts/test_warm.sh | 3 + scripts/test_write.sh | 3 + scripts/write_cold_benchmarks.sh | 4 + scripts/write_fastmm.sh | 3 + test/CMakeLists.txt | 4 + test/bash/CMakeLists.txt | 4 + test/bash/test-cpp.sh | 5 + test/bash/test.sh | 5 + 68 files changed, 573 insertions(+), 18 deletions(-) create mode 100644 .gitignore rename LICENSE => LICENSES/BSD-3-Clause.txt (100%) create mode 100644 examples/check_equivalence_parallel.c diff --git a/.clang-format b/.clang-format index 48e6347..4a5cff1 100644 --- a/.clang-format +++ b/.clang-format @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + --- BasedOnStyle: LLVM PointerAlignment: Left diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b72344..f648ed4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + name: "CI" on: diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a1e6811 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + +scripts +venv +build +._* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2bd722f..b750526 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + repos: - repo: https://github.com/pre-commit/mirrors-clang-format @@ -12,3 +16,8 @@ repos: - id: end-of-file-fixer - id: mixed-line-ending - id: check-added-large-files + +- repo: https://github.com/fsfe/reuse-tool + rev: v2.1.0 + hooks: + - id: reuse diff --git a/CMakeLists.txt b/CMakeLists.txt index 3814370..5ad2478 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + cmake_minimum_required(VERSION 3.5) project(binsparse-rc) diff --git a/LICENSE b/LICENSES/BSD-3-Clause.txt similarity index 100% rename from LICENSE rename to LICENSES/BSD-3-Clause.txt diff --git a/README.md b/README.md index c008067..a806025 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ + + # Binsparse C Reference Implementation This library is a reference implementation of the [binsparse Binary Sparse Format Specification](https://github.com/GraphBLAS/binsparse-specification) written using C. diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 98aea87..7e5bbd1 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + function(add_example example_name) add_executable(${example_name} ${example_name}.c) target_link_libraries(${example_name} binsparse-rc) @@ -10,6 +14,7 @@ add_example(simple_write) add_example(mtx2bsp) add_example(bsp2mtx) add_example(check_equivalence) +add_example(check_equivalence_parallel) add_example(bsp-ls) add_example(benchmark_read) add_example(benchmark_read_parallel) diff --git a/examples/benchmark_read.c b/examples/benchmark_read.c index 238e8de..c1ef342 100644 --- a/examples/benchmark_read.c +++ b/examples/benchmark_read.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include #include #include diff --git a/examples/benchmark_read_parallel.c b/examples/benchmark_read_parallel.c index 2ecd495..b485938 100644 --- a/examples/benchmark_read_parallel.c +++ b/examples/benchmark_read_parallel.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include #include #include @@ -61,8 +67,9 @@ int main(int argc, char** argv) { char* file_name = argv[1]; printf("Opening %s\n", file_name); + fflush(stdout); - const int num_trials = 2; + const int num_trials = 10; int num_threads = 6; @@ -71,11 +78,10 @@ int main(int argc, char** argv) { size_t nbytes = 0; // To flush the filesystem cache before each trial, change to `true`. - bool cold_cache = true; + bool cold_cache = false; // If running warm cache experiments, read once to warm cache. - if (!cold_cache && false) { - printf("Warm cache read...\n"); + if (!cold_cache) { bsp_matrix_t mat = bsp_read_matrix_parallel(file_name, NULL, num_threads); bsp_destroy_matrix_t(mat); } @@ -84,6 +90,7 @@ int main(int argc, char** argv) { if (cold_cache) { flush_cache(); } + fflush(stdout); double begin = gettime(); bsp_matrix_t mat = bsp_read_matrix_parallel(file_name, NULL, num_threads); double end = gettime(); @@ -95,6 +102,7 @@ int main(int argc, char** argv) { double gbytes = ((double) nbytes) / 1024 / 1024 / 1024; double gbytes_s = gbytes / durations[i]; printf("FORPARSER: %s,%lf,%lf\n", file_name, durations[i], gbytes_s); + fflush(stdout); } printf("["); diff --git a/examples/benchmark_write.c b/examples/benchmark_write.c index 4c92f04..8af5881 100644 --- a/examples/benchmark_write.c +++ b/examples/benchmark_write.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include #include #include diff --git a/examples/bsp-ls.c b/examples/bsp-ls.c index 9862222..8ecdd94 100644 --- a/examples/bsp-ls.c +++ b/examples/bsp-ls.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include herr_t visit_group(hid_t loc_id, const char* name, const H5L_info_t* linfo, diff --git a/examples/bsp2mtx.c b/examples/bsp2mtx.c index e253c90..44116b2 100644 --- a/examples/bsp2mtx.c +++ b/examples/bsp2mtx.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include #include diff --git a/examples/check_equivalence.c b/examples/check_equivalence.c index 0706d45..0acea42 100644 --- a/examples/check_equivalence.c +++ b/examples/check_equivalence.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include int check_array_equivalence(bsp_array_t array1, bsp_array_t array2) { diff --git a/examples/check_equivalence_parallel.c b/examples/check_equivalence_parallel.c new file mode 100644 index 0000000..b773cf8 --- /dev/null +++ b/examples/check_equivalence_parallel.c @@ -0,0 +1,217 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +int check_array_equivalence(bsp_array_t array1, bsp_array_t array2) { + if (array1.size != array2.size) { + fprintf(stderr, "Array sizes do not match. %zu != %zu\n", array1.size, + array2.size); + return 1; + } + + if (array1.size == 0) { + return 0; + } + + bsp_matrix_market_type_t mm_type1 = BSP_MM_REAL; + + if ((array1.type >= BSP_UINT8 && array1.type <= BSP_INT64) || + array1.type == BSP_BINT8) { + mm_type1 = BSP_MM_INTEGER; + } else if (array1.type >= BSP_FLOAT32 && array1.type <= BSP_FLOAT64) { + mm_type1 = BSP_MM_REAL; + } else if (array1.type == BSP_COMPLEX_FLOAT32 || + array1.type == BSP_COMPLEX_FLOAT64) { + mm_type1 = BSP_MM_COMPLEX; + } else { + fprintf(stderr, "Unhandled array type.\n"); + return 2; + } + + bsp_matrix_market_type_t mm_type2 = BSP_MM_REAL; + + if ((array2.type >= BSP_UINT8 && array2.type <= BSP_INT64) || + array2.type == BSP_BINT8) { + mm_type2 = BSP_MM_INTEGER; + } else if (array2.type >= BSP_FLOAT32 && array2.type <= BSP_FLOAT64) { + mm_type2 = BSP_MM_REAL; + } else if (array2.type == BSP_COMPLEX_FLOAT32 || + array2.type == BSP_COMPLEX_FLOAT64) { + mm_type2 = BSP_MM_COMPLEX; + } else { + fprintf(stderr, "Unhandled array type.\n"); + return 2; + } + + if (mm_type1 != mm_type2) { + fprintf(stderr, "Array types do not match.\n"); + return 3; + } + + for (size_t i = 0; i < array1.size; i++) { + if (mm_type1 == BSP_MM_INTEGER) { + size_t value1, value2; + bsp_array_read(array1, i, value1); + bsp_array_read(array2, i, value2); + + if (value1 != value2) { + fprintf(stderr, "Array values are not equal. (%zu != %zu)\n", value1, + value2); + return 4; + } + } else if (mm_type1 == BSP_MM_REAL) { + double value1, value2; + bsp_array_read(array1, i, value1); + bsp_array_read(array2, i, value2); + + if (value1 != value2) { + fprintf(stderr, "Array values are not equal. (%.17lg != %.17lg)\n", + value1, value2); + return 4; + } + } else if (mm_type1 == BSP_MM_COMPLEX) { + double _Complex value1, value2; + bsp_array_read(array1, i, value1); + bsp_array_read(array2, i, value2); + + if (value1 != value2) { + fprintf(stderr, + "Array values are not equal. (%.17lg + i%.17lg != %.17lg + " + "i%.17lg)\n", + __real__ value1, __imag__ value1, __real__ value2, + __imag__ value2); + return 4; + } + } + } + + return 0; +} + +int main(int argc, char** argv) { + if (argc < 3) { + printf( + "usage: ./check_equivalence [file1.{mtx/hdf5}] [file2.{mtx/hdf5}]\n"); + + printf(" Note: the second argument will be read in parallel if it is a " + "Binsparse file.\n"); + return 1; + } + + char* file1 = argv[1]; + char* file2 = argv[2]; + + int num_threads = 6; + + bsp_fdataset_info_t info1 = bsp_parse_fdataset_string(argv[1]); + bsp_fdataset_info_t info2 = bsp_parse_fdataset_string(argv[2]); + + printf("Matrix 1: %s and %s\n", info1.fname, + (info1.dataset == NULL) ? "root" : info1.dataset); + printf("Matrix 2: %s and %s\n", info2.fname, + (info2.dataset == NULL) ? "root" : info2.dataset); + + fflush(stdout); + + bsp_matrix_t matrix1 = bsp_read_matrix(info1.fname, info1.dataset); + bsp_matrix_t matrix2 = + bsp_read_matrix_parallel(info2.fname, info2.dataset, num_threads); + + bool perform_suitesparse_declamping = true; + if (perform_suitesparse_declamping && + strcmp(bsp_get_file_extension(file1), ".mtx") == 0) { + bsp_matrix_declamp_values(matrix1); + } + + if (perform_suitesparse_declamping && + strcmp(bsp_get_file_extension(file2), ".mtx") == 0) { + bsp_matrix_declamp_values(matrix2); + } + + // If matrices are not the same format, try to convert. + if (matrix1.format != matrix2.format) { + if (matrix1.format != BSP_COOR) { + bsp_matrix_t intermediate = bsp_convert_matrix(matrix1, BSP_COOR); + bsp_destroy_matrix_t(matrix1); + matrix1 = intermediate; + } + + if (matrix2.format != BSP_COOR) { + bsp_matrix_t intermediate = bsp_convert_matrix(matrix2, BSP_COOR); + bsp_destroy_matrix_t(matrix2); + matrix2 = intermediate; + } + } + + if (matrix1.format != matrix2.format) { + fprintf(stderr, "Formats do not match. (%s != %s)\n", + bsp_get_matrix_format_string(matrix1.format), + bsp_get_matrix_format_string(matrix2.format)); + fprintf(stderr, "FAIL!\n"); + return 1; + } + + if (matrix1.structure != matrix2.structure) { + fprintf(stderr, "Structures do not match. (%s != %s)\n", + bsp_get_structure_string(matrix1.structure), + bsp_get_structure_string(matrix2.structure)); + fprintf(stderr, "FAIL!\n"); + return 2; + } + + if (matrix1.nrows != matrix2.nrows || matrix1.ncols != matrix2.ncols) { + fprintf(stderr, "Dimensions do not match. (%zu, %zu) != (%zu, %zu)\n", + matrix1.nrows, matrix1.ncols, matrix2.nrows, matrix2.ncols); + fprintf(stderr, "FAIL!\n"); + return 3; + } + + if (matrix1.nnz != matrix2.nnz) { + fprintf(stderr, "Number of stored values does not match. %zu != %zu\n", + matrix1.nnz, matrix2.nnz); + fprintf(stderr, "FAIL!\n"); + return 4; + } + + if (matrix1.is_iso != matrix2.is_iso) { + fprintf(stderr, "ISO-ness does not match. %s != %s\n", + (matrix1.is_iso) ? "true" : "false", + (matrix2.is_iso) ? "true" : "false"); + fprintf(stderr, "FAIL!\n"); + return 5; + } + + if (check_array_equivalence(matrix1.values, matrix2.values) != 0) { + fprintf(stderr, "Value arrays not equivalent.\n"); + fprintf(stderr, "FAIL!\n"); + return 6; + } + + if (check_array_equivalence(matrix1.indices_0, matrix2.indices_0) != 0) { + fprintf(stderr, "Indices_0 arrays not equivalent.\n"); + fprintf(stderr, "FAIL!\n"); + return 7; + } + + if (check_array_equivalence(matrix1.indices_1, matrix2.indices_1) != 0) { + fprintf(stderr, "Indices_1 arrays not equivalent.\n"); + fprintf(stderr, "FAIL!\n"); + return 8; + } + + if (check_array_equivalence(matrix1.pointers_to_1, matrix2.pointers_to_1) != + 0) { + fprintf(stderr, "Pointers_to_1 arrays not equivalent.\n"); + fprintf(stderr, "FAIL!\n"); + return 9; + } + + printf("The files are equivalent.\n"); + printf("OK!\n"); + + return 0; +} diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt index cdd5d3d..2b8dcdf 100644 --- a/examples/cpp/CMakeLists.txt +++ b/examples/cpp/CMakeLists.txt @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + function(add_example example_name) add_executable(${example_name}-cpp ${example_name}.cpp) target_link_libraries(${example_name}-cpp binsparse-rc) diff --git a/examples/cpp/benchmark_read.cpp b/examples/cpp/benchmark_read.cpp index 8694b75..9c20b48 100644 --- a/examples/cpp/benchmark_read.cpp +++ b/examples/cpp/benchmark_read.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include #include #include diff --git a/examples/cpp/benchmark_write.cpp b/examples/cpp/benchmark_write.cpp index 49beab5..2bd5895 100644 --- a/examples/cpp/benchmark_write.cpp +++ b/examples/cpp/benchmark_write.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include #include #include diff --git a/examples/cpp/bsp-ls.cpp b/examples/cpp/bsp-ls.cpp index 9862222..1143563 100644 --- a/examples/cpp/bsp-ls.cpp +++ b/examples/cpp/bsp-ls.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include herr_t visit_group(hid_t loc_id, const char* name, const H5L_info_t* linfo, diff --git a/examples/cpp/bsp2mtx.cpp b/examples/cpp/bsp2mtx.cpp index e253c90..bc59692 100644 --- a/examples/cpp/bsp2mtx.cpp +++ b/examples/cpp/bsp2mtx.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include #include diff --git a/examples/cpp/check_equivalence.cpp b/examples/cpp/check_equivalence.cpp index 0706d45..2d3ef85 100644 --- a/examples/cpp/check_equivalence.cpp +++ b/examples/cpp/check_equivalence.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include int check_array_equivalence(bsp_array_t array1, bsp_array_t array2) { diff --git a/examples/cpp/mtx2bsp.cpp b/examples/cpp/mtx2bsp.cpp index 7de6d8f..61e0496 100644 --- a/examples/cpp/mtx2bsp.cpp +++ b/examples/cpp/mtx2bsp.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include #include diff --git a/examples/cpp/simple_matrix_read.cpp b/examples/cpp/simple_matrix_read.cpp index aaa8884..586955c 100644 --- a/examples/cpp/simple_matrix_read.cpp +++ b/examples/cpp/simple_matrix_read.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include int main(int argc, char** argv) { diff --git a/examples/cpp/simple_matrix_write.cpp b/examples/cpp/simple_matrix_write.cpp index bf551d2..a12965e 100644 --- a/examples/cpp/simple_matrix_write.cpp +++ b/examples/cpp/simple_matrix_write.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include int main(int argc, char** argv) { diff --git a/examples/cpp/simple_read.cpp b/examples/cpp/simple_read.cpp index 37249f9..2ab552f 100644 --- a/examples/cpp/simple_read.cpp +++ b/examples/cpp/simple_read.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include int main(int argc, char** argv) { diff --git a/examples/cpp/simple_write.cpp b/examples/cpp/simple_write.cpp index 15e3b36..e016073 100644 --- a/examples/cpp/simple_write.cpp +++ b/examples/cpp/simple_write.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #include int main(int argc, char** argv) { diff --git a/examples/mtx2bsp.c b/examples/mtx2bsp.c index 7de6d8f..07db200 100644 --- a/examples/mtx2bsp.c +++ b/examples/mtx2bsp.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include #include diff --git a/examples/simple_matrix_read.c b/examples/simple_matrix_read.c index aaa8884..acbdabc 100644 --- a/examples/simple_matrix_read.c +++ b/examples/simple_matrix_read.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include int main(int argc, char** argv) { diff --git a/examples/simple_matrix_write.c b/examples/simple_matrix_write.c index bf551d2..5ee6f3f 100644 --- a/examples/simple_matrix_write.c +++ b/examples/simple_matrix_write.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include int main(int argc, char** argv) { diff --git a/examples/simple_read.c b/examples/simple_read.c index 225ea54..f2a1184 100644 --- a/examples/simple_read.c +++ b/examples/simple_read.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include int main(int argc, char** argv) { diff --git a/examples/simple_write.c b/examples/simple_write.c index 15e3b36..deb47d8 100644 --- a/examples/simple_write.c +++ b/examples/simple_write.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include int main(int argc, char** argv) { diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 6e6266e..a423da1 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,2 +1,6 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + add_library(binsparse-rc INTERFACE) target_include_directories(binsparse-rc INTERFACE .) diff --git a/include/binsparse/array.h b/include/binsparse/array.h index 6919f74..090dc5d 100644 --- a/include/binsparse/array.h +++ b/include/binsparse/array.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/binsparse.h b/include/binsparse/binsparse.h index 7fa58e2..bb6eecd 100644 --- a/include/binsparse/binsparse.h +++ b/include/binsparse/binsparse.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #define BINSPARSE_VERSION "0.1" diff --git a/include/binsparse/convert_matrix.h b/include/binsparse/convert_matrix.h index a045209..d7b2e6f 100644 --- a/include/binsparse/convert_matrix.h +++ b/include/binsparse/convert_matrix.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/detail/cpp/array.hpp b/include/binsparse/detail/cpp/array.hpp index 2c9d268..1b5ff7d 100644 --- a/include/binsparse/detail/cpp/array.hpp +++ b/include/binsparse/detail/cpp/array.hpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2024 Binsparse Developers +// +// SPDX-License-Identifier: BSD-3-Clause + #pragma once #ifdef __cplusplus diff --git a/include/binsparse/detail/declamp_values.h b/include/binsparse/detail/declamp_values.h index ca257ec..fad2ce3 100644 --- a/include/binsparse/detail/declamp_values.h +++ b/include/binsparse/detail/declamp_values.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/detail/detail.h b/include/binsparse/detail/detail.h index 4cebf43..f98990f 100644 --- a/include/binsparse/detail/detail.h +++ b/include/binsparse/detail/detail.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/detail/parse_dataset.h b/include/binsparse/detail/parse_dataset.h index 53123c8..c40f6cd 100644 --- a/include/binsparse/detail/parse_dataset.h +++ b/include/binsparse/detail/parse_dataset.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/detail/shm_tools.h b/include/binsparse/detail/shm_tools.h index 65e6b90..77ca5c8 100644 --- a/include/binsparse/detail/shm_tools.h +++ b/include/binsparse/detail/shm_tools.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/generate.h b/include/binsparse/generate.h index 61883a3..2ea8fd8 100644 --- a/include/binsparse/generate.h +++ b/include/binsparse/generate.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/hdf5_wrapper.h b/include/binsparse/hdf5_wrapper.h index 89e84e9..9e023e8 100644 --- a/include/binsparse/hdf5_wrapper.h +++ b/include/binsparse/hdf5_wrapper.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/matrix.h b/include/binsparse/matrix.h index 2bc3470..fcfc6e5 100644 --- a/include/binsparse/matrix.h +++ b/include/binsparse/matrix.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/matrix_formats.h b/include/binsparse/matrix_formats.h index baeb837..691097a 100644 --- a/include/binsparse/matrix_formats.h +++ b/include/binsparse/matrix_formats.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/matrix_market/coo_sort_tools.h b/include/binsparse/matrix_market/coo_sort_tools.h index 805ee0e..8d3b485 100644 --- a/include/binsparse/matrix_market/coo_sort_tools.h +++ b/include/binsparse/matrix_market/coo_sort_tools.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/matrix_market/matrix_market_inspector.h b/include/binsparse/matrix_market/matrix_market_inspector.h index 724b691..3bae696 100644 --- a/include/binsparse/matrix_market/matrix_market_inspector.h +++ b/include/binsparse/matrix_market/matrix_market_inspector.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/matrix_market/matrix_market_read.h b/include/binsparse/matrix_market/matrix_market_read.h index d6745e4..5013ab9 100644 --- a/include/binsparse/matrix_market/matrix_market_read.h +++ b/include/binsparse/matrix_market/matrix_market_read.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/matrix_market/matrix_market_type_t.h b/include/binsparse/matrix_market/matrix_market_type_t.h index f13de27..e670041 100644 --- a/include/binsparse/matrix_market/matrix_market_type_t.h +++ b/include/binsparse/matrix_market/matrix_market_type_t.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once typedef enum bsp_matrix_market_type_t { diff --git a/include/binsparse/matrix_market/matrix_market_write.h b/include/binsparse/matrix_market/matrix_market_write.h index 75f9aeb..1a4a5e2 100644 --- a/include/binsparse/matrix_market/matrix_market_write.h +++ b/include/binsparse/matrix_market/matrix_market_write.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/minimize_values.h b/include/binsparse/minimize_values.h index b200e89..8764e91 100644 --- a/include/binsparse/minimize_values.h +++ b/include/binsparse/minimize_values.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/read_matrix.h b/include/binsparse/read_matrix.h index 4664be0..ac41e48 100644 --- a/include/binsparse/read_matrix.h +++ b/include/binsparse/read_matrix.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/structure.h b/include/binsparse/structure.h index c6793c8..62e2ddd 100644 --- a/include/binsparse/structure.h +++ b/include/binsparse/structure.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/types.h b/include/binsparse/types.h index 386d75c..9ce6dea 100644 --- a/include/binsparse/types.h +++ b/include/binsparse/types.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/include/binsparse/write_matrix.h b/include/binsparse/write_matrix.h index 76dd7c7..e07cedd 100644 --- a/include/binsparse/write_matrix.h +++ b/include/binsparse/write_matrix.h @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2024 Binsparse Developers + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #pragma once #include diff --git a/requirements.txt b/requirements.txt index 416634f..0de24c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,5 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + pre-commit diff --git a/scripts/read_cold_benchmarks.sh b/scripts/read_cold_benchmarks.sh index 1ab2dfe..0888502 100755 --- a/scripts/read_cold_benchmarks.sh +++ b/scripts/read_cold_benchmarks.sh @@ -1,14 +1,18 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + # COO No Compression -./test.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_coo_noz_primary > br_coo_noz.out 2>&1 +./test.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read_parallel /media/xiii/zunyingdie/data/SuiteSparse_coo_noz_primary > br_coo_noz.out 2>&1 # COO GZip 1 Compression -./test.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_coo_gzip1_primary > br_coo_gz1.out 2>&1 +./test.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read_parallel /media/xiii/zunyingdie/data/SuiteSparse_coo_gzip1_primary > br_coo_gz1.out 2>&1 # CSR No Compression -./test.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_csr_noz_primary > br_csr_noz.out 2>&1 +./test.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read_parallel /media/xiii/zunyingdie/data/SuiteSparse_csr_noz_primary > br_csr_noz.out 2>&1 # CSR GZip 1 Compression -./test.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_csr_gzip1_primary > br_csr_gz1.out 2>&1 +./test.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read_parallel /media/xiii/zunyingdie/data/SuiteSparse_csr_gzip1_primary > br_csr_gz1.out 2>&1 # MTX No Compression -./test_fastmm.sh /home/xiii/src/fast_mm_benchmarks/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_MM_noz_primary /media/xiii/zunyingdie/data/SuiteSparse_coo_noz_primary > br_mtx_noz.out 2>&1 +# ./test_fastmm.sh /home/xiii/src/fast_mm_benchmarks/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_MM_noz_primary /media/xiii/zunyingdie/data/SuiteSparse_coo_noz_primary > br_mtx_noz.out 2>&1 diff --git a/scripts/read_warm_benchmarks.sh b/scripts/read_warm_benchmarks.sh index d0b4499..9d71a72 100755 --- a/scripts/read_warm_benchmarks.sh +++ b/scripts/read_warm_benchmarks.sh @@ -1,14 +1,18 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + # COO No Compression -./test_warm.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_coo_noz_primary > br_coo_noz.out 2>&1 +./test_warm.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read_parallel /media/xiii/zunyingdie/data/SuiteSparse_coo_noz_primary > br_coo_noz.out 2>&1 # COO GZip 1 Compression -./test_warm.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_coo_gzip1_primary > br_coo_gz1.out 2>&1 +./test_warm.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read_parallel /media/xiii/zunyingdie/data/SuiteSparse_coo_gzip1_primary > br_coo_gz1.out 2>&1 # CSR No Compression -./test_warm.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_csr_noz_primary > br_csr_noz.out 2>&1 +./test_warm.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read_parallel /media/xiii/zunyingdie/data/SuiteSparse_csr_noz_primary > br_csr_noz.out 2>&1 # CSR GZip 1 Compression -./test_warm.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_csr_gzip1_primary > br_csr_gz1.out 2>&1 +./test_warm.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_read_parallel /media/xiii/zunyingdie/data/SuiteSparse_csr_gzip1_primary > br_csr_gz1.out 2>&1 # MTX No Compression -./test_fastmm_warm.sh /home/xiii/src/fast_mm_benchmarks/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_MM_noz_primary /media/xiii/zunyingdie/data/SuiteSparse_coo_noz_primary > br_mtx_noz.out 2>&1 +# ./test_fastmm_warm.sh /home/xiii/src/fast_mm_benchmarks/build/examples/benchmark_read /media/xiii/zunyingdie/data/SuiteSparse_MM_noz_primary /media/xiii/zunyingdie/data/SuiteSparse_coo_noz_primary > br_mtx_noz.out 2>&1 diff --git a/scripts/test.sh b/scripts/test.sh index ebe9423..f4b2774 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause # Usage: ./test.sh [/path/to/benchmark_read,/path/to/benchmark_write/] [/path/to/binsparse/matrices/] [optional: /path/to/filesystem/for/experiments] diff --git a/scripts/test_fastmm.sh b/scripts/test_fastmm.sh index 3a38b3b..633904e 100755 --- a/scripts/test_fastmm.sh +++ b/scripts/test_fastmm.sh @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause # Usage: ./test_fastmm.sh [/path/to/benchmark_read,/path/to/benchmark_write/] [/path/to/matrix_market/matrices/] [/path/to/binsparse/matrices] [optional: /path/to/filesystem/for/experiments] @@ -36,9 +39,9 @@ do sudo sh -c "/usr/bin/echo 3 > /proc/sys/vm/drop_caches" sleep 0.1 dataset=`echo ${file} | sed -E "s/.+\/(.+\/.+)\.mtx/\1/"` - binsparse_file=${BINSPARSE_DIR}/${dataset}*.bsp.h5 + binsparse_file=${BINSPARSE_DIR}/${dataset}.coo.bsp.h5 echo "${dataset} ${file} ${binsparse_file}" - $BENCHMARK_BINARY $file ${binsparse_file} + $BENCHMARK_BINARY $file ${binsparse_file} 6 done done diff --git a/scripts/test_fastmm_warm.sh b/scripts/test_fastmm_warm.sh index 9f6e08c..6bd512d 100755 --- a/scripts/test_fastmm_warm.sh +++ b/scripts/test_fastmm_warm.sh @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause # Usage: ./test_fastmm.sh [/path/to/benchmark_read,/path/to/benchmark_write/] [/path/to/matrix_market/matrices/] [/path/to/binsparse/matrices] [optional: /path/to/filesystem/for/experiments] @@ -29,9 +32,9 @@ echo "Benchmarking Binsparse using ${EXPERIMENT_DIR}" for file in $(find ${EXPERIMENT_DIR} -iname "*.mtx") do dataset=`echo ${file} | sed -E "s/.+\/(.+\/.+)\.mtx/\1/"` - binsparse_file=${BINSPARSE_DIR}/${dataset}*.bsp.h5 + binsparse_file=${BINSPARSE_DIR}/${dataset}.coo.bsp.h5 echo "${dataset} ${file} ${binsparse_file}" - $BENCHMARK_BINARY $file ${binsparse_file} + $BENCHMARK_BINARY $file ${binsparse_file} 6 done if [ -z "$4" ] diff --git a/scripts/test_warm.sh b/scripts/test_warm.sh index 066cb38..3b31c88 100755 --- a/scripts/test_warm.sh +++ b/scripts/test_warm.sh @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause # Usage: ./test.sh [/path/to/benchmark_read,/path/to/benchmark_write/] [/path/to/binsparse/matrices/] [optional: /path/to/filesystem/for/experiments] diff --git a/scripts/test_write.sh b/scripts/test_write.sh index fe0ff54..3d8c3be 100755 --- a/scripts/test_write.sh +++ b/scripts/test_write.sh @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause # Usage: ./test.sh [/path/to/benchmark_read,/path/to/benchmark_write/] [/path/to/binsparse/matrices/] [/path/to/filesystem/for/experiments] [compression level: [0-9] ...] diff --git a/scripts/write_cold_benchmarks.sh b/scripts/write_cold_benchmarks.sh index 105b729..a08d17f 100755 --- a/scripts/write_cold_benchmarks.sh +++ b/scripts/write_cold_benchmarks.sh @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + # COO No Compression ./test_write.sh /home/xiii/src/binsparse-reference-c/build/examples/benchmark_write /media/xiii/zunyingdie/data/SuiteSparse_coo_noz_primary /media/xiii/zunyingdie/data/scratch 0 > br_coo_noz.out 2>&1 diff --git a/scripts/write_fastmm.sh b/scripts/write_fastmm.sh index ee954f4..b0e9058 100755 --- a/scripts/write_fastmm.sh +++ b/scripts/write_fastmm.sh @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause # Usage: ./test_fastmm.sh [/path/to/benchmark_read,/path/to/benchmark_write/] [/path/to/binsparse/matrices/] [/path/to/filesystem/for/experiments] diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e8882f0..0dd7ef0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1 +1,5 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + add_subdirectory(bash) diff --git a/test/bash/CMakeLists.txt b/test/bash/CMakeLists.txt index b6fee76..3810df0 100644 --- a/test/bash/CMakeLists.txt +++ b/test/bash/CMakeLists.txt @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + function(download_data url file_name) set(DATASET_ARCHIVE ${CMAKE_BINARY_DIR}/data/${file_name}) diff --git a/test/bash/test-cpp.sh b/test/bash/test-cpp.sh index 907a7c9..828e18d 100644 --- a/test/bash/test-cpp.sh +++ b/test/bash/test-cpp.sh @@ -1,4 +1,9 @@ #!/usr/bin/env bash + +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + set -e convert_ssmc() { diff --git a/test/bash/test.sh b/test/bash/test.sh index 6a10607..2167e45 100644 --- a/test/bash/test.sh +++ b/test/bash/test.sh @@ -1,4 +1,9 @@ #!/usr/bin/env bash + +# SPDX-FileCopyrightText: 2024 Binsparse Developers +# +# SPDX-License-Identifier: BSD-3-Clause + set -e convert_ssmc() {