diff --git a/include/WORKSPACE b/include/WORKSPACE new file mode 100644 index 00000000..544f75ae --- /dev/null +++ b/include/WORKSPACE @@ -0,0 +1,3 @@ +load("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_configure") + +cc_configure() diff --git a/include/parlay/BUILD b/include/parlay/BUILD new file mode 100644 index 00000000..87d2a4dc --- /dev/null +++ b/include/parlay/BUILD @@ -0,0 +1,214 @@ +licenses(["notice"]) + +package( + default_visibility = ["//visibility:public"], +) + +cc_library( + name = "alloc", + hdrs = ["alloc.h"], + deps = [ + ":type_traits", + ":utilities", + "//parlay/internal:block_allocator", + "//parlay/internal:memory_size", + "//parlay/internal:pool_allocator", + ], +) + +cc_library( + name = "delayed", + hdrs = ["delayed.h"], + deps = [ + ":delayed_sequence", + ":range", + ":type_traits", + "//parlay/internal/delayed:filter", + "//parlay/internal/delayed:filter_op", + "//parlay/internal/delayed:flatten", + "//parlay/internal/delayed:map", + "//parlay/internal/delayed:scan", + "//parlay/internal/delayed:terminal", + "//parlay/internal/delayed:zip", + "//parlay/internal:sequence_ops", + ], +) + +cc_library( + name = "delayed_sequence", + hdrs = ["delayed_sequence.h"], + deps = [ + ":utilities", + ], +) + +cc_library( + name = "hash_table", + hdrs = ["hash_table.h"], + deps = [ + ":delayed_sequence", + ":monoid", + ":parallel", + ":primitives", + ":sequence", + ":slice", + ":utilities", + "//parlay/internal:sequence_ops", + ], +) + +cc_library( + name = "io", + hdrs = ["io.h"], + deps = [ + ":primitives", + ":sequence", + ":slice", + "//parlay/internal:file_map", + ], +) + +cc_library( + name = "monoid", + hdrs = ["monoid.h"], + deps = [ + ":portability", + ":type_traits", + ] +) + +cc_library( + name = "parallel", + hdrs = ["parallel.h"], + deps = [ + ":scheduler", + "//parlay/internal/scheduler_plugins:sequential", + ], +) + +cc_library( + name = "portability", + hdrs = ["portability.h"], +) + +cc_library( + name = "primitives", + hdrs = ["primitives.h"], + deps = [ + ":delayed", + ":delayed_sequence", + ":monoid", + ":parallel", + ":random", + ":range", + ":sequence", + ":slice", + ":type_traits", + ":utilities", + "//parlay/internal:block_delayed", + "//parlay/internal:collect_reduce", + "//parlay/internal:counting_sort", + "//parlay/internal:group_by", + "//parlay/internal:integer_sort", + "//parlay/internal:heap_tree", + "//parlay/internal:merge", + "//parlay/internal:merge_sort", + "//parlay/internal:sample_sort", + "//parlay/internal:sequence_ops", + ], +) + +cc_library( + name = "random", + hdrs = ["random.h"], + deps = [ + ":delayed_sequence", + ":parallel", + ":range", + ":sequence", + ":slice", + ":utilities", + "//parlay/internal:counting_sort", + ], +) + +cc_library( + name = "range", + hdrs = ["range.h"], + deps = [ + ":type_traits", + ] +) + +cc_library( + name = "relocation", + hdrs = ["relocation.h"], + deps = [ + ":parallel", + ":range", + ":type_traits", + ":utilities", + "//parlay/internal:debug_uninitialized", + ] +) + +cc_library( + name = "scheduler", + hdrs = ["scheduler.h"], + deps = [ + "//parlay/internal:atomic_wait", + "//parlay/internal:work_stealing_deque", + "//parlay/internal:work_stealing_job", + ], +) + +cc_library( + name = "sequence", + hdrs = ["sequence.h"], + deps = [ + ":alloc", + ":parallel", + ":range", + ":slice", + ":type_traits", + ":utilities", + "//parlay/internal:debug_uninitialized", + "//parlay/internal:sequence_base", + ], +) + +cc_library( + name = "slice", + hdrs = ["slice.h"], + deps = [ + ":range", + ], +) + +cc_library( + name = "thread_specific", + hdrs = ["thread_specific.h"], + deps = [ + ":portability", + ":range", + ":type_traits", + "//parlay/internal:thread_id_pool", + ], +) + +cc_library( + name = "type_traits", + hdrs = ["type_traits.h"], +) + +cc_library( + name = "utilities", + hdrs = ["utilities.h"], + deps = [ + ":parallel", + ":portability", + ":range", + ":type_traits", + "//parlay/internal:debug_uninitialized", + ], +) diff --git a/include/parlay/internal/BUILD b/include/parlay/internal/BUILD new file mode 100644 index 00000000..beadba61 --- /dev/null +++ b/include/parlay/internal/BUILD @@ -0,0 +1,319 @@ +licenses(["notice"]) + +package( + default_visibility = ["//visibility:public"], +) + +cc_library( + name = "atomic_wait", + hdrs = ["atomic_wait.h"], + deps = [ + "//parlay:type_traits", + ], +) + +cc_library( + name = "binary_search", + hdrs = ["binary_search.h"], +) + +cc_library( + name = "block_allocator", + hdrs = ["block_allocator.h"], + deps = [ + ":memory_size", + "//parlay:utilities", + "//parlay:thread_specific", + "//parlay/internal/concurrency:hazptr_stack", + ], +) + +cc_library( + name = "block_delayed", + hdrs = ["block_delayed.h"], + deps = [ + ":get_time", + ":sequence_ops", + ":stream_delayed", + "//parlay:delayed_sequence", + "//parlay:monoid", + "//parlay:parallel", + "//parlay:sequence", + "//parlay:slice", + ], +) + +cc_library( + name = "bucket_sort", + hdrs = ["bucket_sort.h"], + deps = [ + ":merge_sort", + ":quicksort", + ":uninitialized_sequence", + "//parlay:parallel", + "//parlay:relocation", + "//parlay:sequence", + "//parlay:slice", + "//parlay:utilities", + ], +) + +cc_library( + name = "collect_reduce", + hdrs = ["collect_reduce.h"], + deps = [ + ":counting_sort", + ":get_time", + ":integer_sort", + ":sequence_ops", + ":uninitialized_sequence", + "//parlay:parallel", + "//parlay:sequence", + "//parlay:slice", + "//parlay:utilities", + ], +) + +cc_library( + name = "counting_sort", + hdrs = ["counting_sort.h"], + deps = [ + ":sequence_ops", + ":uninitialized_sequence", + "//parlay:monoid", + "//parlay:parallel", + "//parlay:relocation", + "//parlay:sequence", + "//parlay:slice", + "//parlay:utilities", + ], +) + +cc_library( + name = "debug_uninitialized", + hdrs = ["debug_uninitialized.h"], +) + +cc_library( + name = "file_map", + hdrs = ["file_map.h"], + deps = [ + "//parlay/internal/posix:file_map_impl_posix", + ], +) + +cc_library( + name = "get_time", + hdrs = ["get_time.h"], + deps = [], +) + +cc_library( + name = "group_by", + hdrs = ["group_by.h"], + deps = [ + ":block_delayed", + ":collect_reduce", + ":counting_sort", + ":integer_sort", + ":sample_sort", + ":sequence_ops", + "//parlay:monoid", + "//parlay:parallel", + "//parlay:range", + "//parlay:sequence", + "//parlay:slice", + "//parlay:utilities", + ], +) + +cc_library( + name = "heap_tree", + hdrs = ["heap_tree.h"], + deps = [ + "//parlay:sequence", + "//parlay:utilities", + ], +) + +cc_library( + name = "integer_sort", + hdrs = ["integer_sort.h"], + deps = [ + ":counting_sort", + ":get_time", + ":sequence_ops", + ":uninitialized_sequence", + "//parlay:delayed_sequence", + "//parlay:monoid", + "//parlay:parallel", + "//parlay:range", + "//parlay:relocation", + "//parlay:sequence", + "//parlay:slice", + "//parlay:utilities", + ], +) + +cc_library( + name = "memory_size", + hdrs = ["memory_size.h"], +) + +cc_library( + name = "merge", + hdrs = ["merge.h"], + deps = [ + ":binary_search", + "//parlay:sequence", + "//parlay:utilities", + ], +) + +cc_library( + name = "merge_sort", + hdrs = ["merge_sort.h"], + deps = [ + ":merge", + ":quicksort", + ":uninitialized_sequence", + "//parlay:utilities", + ], +) + +cc_library( + name = "pool_allocator", + hdrs = ["pool_allocator.h"], + deps = [ + ":block_allocator", + "//parlay/internal/concurrency:hazptr_stack", + "//parlay:portability", + "//parlay:utilities", + ], +) + +cc_library( + name = "quicksort", + hdrs = ["quicksort.h"], + deps = [ + ":counting_sort", + ":sequence_ops", + ":uninitialized_sequence", + ":uninitialized_storage", + "//parlay:utilities", + ], +) + +cc_library( + name = "sample_sort", + hdrs = ["sample_sort.h"], + deps = [ + ":bucket_sort", + ":quicksort", + ":sequence_ops", + ":transpose", + ":uninitialized_sequence", + "//parlay:delayed_sequence", + "//parlay:parallel", + "//parlay:relocation", + "//parlay:sequence", + "//parlay:slice", + "//parlay:utilities", + ], +) + +cc_library( + name = "sequence_base", + hdrs = ["sequence_base.h"], + deps = [ + "//parlay:parallel", + "//parlay:portability", + "//parlay:relocation", + "//parlay:type_traits", + "//parlay/internal:debug_uninitialized", + ], +) + +cc_library( + name = "sequence_ops", + hdrs = ["sequence_ops.h"], + deps = [ + "//parlay:delayed_sequence", + "//parlay:monoid", + "//parlay:parallel", + "//parlay:range", + "//parlay:sequence", + "//parlay:slice", + "//parlay:utilities", + ], +) + +cc_library( + name = "stream_delayed", + hdrs = ["stream_delayed.h"], + deps = [ + ":uninitialized_sequence", + "//parlay:sequence", + "//parlay:utilities", + ], +) + +cc_library( + name = "thread_id_pool", + hdrs = ["thread_id_pool.h"], + deps = [ + ], +) + +cc_library( + name = "transpose", + hdrs = ["transpose.h"], + deps = [ + ":sequence_ops", + "//parlay:monoid", + "//parlay:parallel", + "//parlay:sequence", + "//parlay:slice", + "//parlay:utilities", + ], +) + +cc_library( + name = "uninitialized_iterator", + hdrs = ["uninitialized_iterator.h"], + deps = [ + "//parlay:range", + "//parlay:type_traits", + ], +) + +cc_library( + name = "uninitialized_sequence", + hdrs = ["uninitialized_sequence.h"], + deps = [ + ":debug_uninitialized", + "//parlay:alloc", + "//parlay:portability", + ], +) + +cc_library( + name = "uninitialized_storage", + hdrs = ["uninitialized_storage.h"], + deps = [ + ":debug_uninitialized", + ], +) + +cc_library( + name = "work_stealing_deque", + hdrs = ["work_stealing_deque.h"], +) + +cc_library( + name = "work_stealing_job", + hdrs = ["work_stealing_job.h"], + deps = [ + ":atomic_wait", + ], +) diff --git a/include/parlay/internal/bucket_sort.h b/include/parlay/internal/bucket_sort.h index 8700fe52..18adf204 100644 --- a/include/parlay/internal/bucket_sort.h +++ b/include/parlay/internal/bucket_sort.h @@ -7,6 +7,7 @@ #include + #include "merge_sort.h" #include "quicksort.h" diff --git a/include/parlay/internal/concurrency/BUILD b/include/parlay/internal/concurrency/BUILD new file mode 100644 index 00000000..26a87d0c --- /dev/null +++ b/include/parlay/internal/concurrency/BUILD @@ -0,0 +1,22 @@ +licenses(["notice"]) + +package( + default_visibility = ["//visibility:public"], +) + +cc_library( + name = "acquire_retire", + hdrs = ["acquire_retire.h"], + deps = [ + "//parlay:portability", + "//parlay:thread_specific", + ], +) + +cc_library( + name = "hazptr_stack", + hdrs = ["hazptr_stack.h"], + deps = [ + ":acquire_retire", + ], +) diff --git a/include/parlay/internal/debug_uninitialized.h b/include/parlay/internal/debug_uninitialized.h index e061f544..5fc976e0 100644 --- a/include/parlay/internal/debug_uninitialized.h +++ b/include/parlay/internal/debug_uninitialized.h @@ -1,6 +1,7 @@ #ifndef PARLAY_INTERNAL_DEBUG_UNINITIALIZED_H_ #define PARLAY_INTERNAL_DEBUG_UNINITIALIZED_H_ +#include #include namespace parlay { diff --git a/include/parlay/internal/delayed/BUILD b/include/parlay/internal/delayed/BUILD new file mode 100644 index 00000000..7dbb9cac --- /dev/null +++ b/include/parlay/internal/delayed/BUILD @@ -0,0 +1,115 @@ +licenses(["notice"]) + +package( + default_visibility = ["//visibility:public"], +) + +cc_library( + name = "common", + hdrs = ["common.h"], + deps = [ + "//parlay:range", + ], +) + +cc_library( + name = "filter", + hdrs = ["filter.h"], + deps = [ + ":common", + ":flatten", + ":map", + "//parlay:range", + "//parlay:relocation", + "//parlay:sequence", + "//parlay:utilities", + "//parlay/internal:sequence_ops", + "//parlay/internal:uninitialized_sequence", + ], +) + +cc_library( + name = "filter_op", + hdrs = ["filter_op.h"], + deps = [ + ":common", + ":flatten", + "//parlay:range", + "//parlay:relocation", + "//parlay:sequence", + "//parlay:utilities", + "//parlay/internal:sequence_ops", + "//parlay/internal:uninitialized_sequence", + ], +) + +cc_library( + name = "flatten", + hdrs = ["flatten.h"], + deps = [ + ":common", + ":map", + ":terminal", + "//parlay:monoid", + "//parlay:parallel", + "//parlay:range", + "//parlay:sequence", + "//parlay:slice", + "//parlay:type_traits", + "//parlay:utilities", + "//parlay/internal:sequence_ops", + ], +) + +cc_library( + name = "map", + hdrs = ["map.h"], + deps = [ + ":common", + "//parlay:range", + "//parlay:type_traits", + "//parlay:utilities", + "//parlay/internal:sequence_ops", + ], +) + +cc_library( + name = "scan", + hdrs = ["scan.h"], + deps = [ + ":common", + "//parlay:monoid", + "//parlay:parallel", + "//parlay:range", + "//parlay:sequence", + "//parlay:slice", + "//parlay:type_traits", + "//parlay:utilities", + "//parlay/internal:sequence_ops", + ], +) + +cc_library( + name = "terminal", + hdrs = ["terminal.h"], + deps = [ + ":common", + "//parlay:monoid", + "//parlay:parallel", + "//parlay:range", + "//parlay:sequence", + "//parlay:slice", + "//parlay/internal:sequence_ops", + ], +) + +cc_library( + name = "zip", + hdrs = ["zip.h"], + deps = [ + ":common", + "//parlay:range", + "//parlay:type_traits", + "//parlay/internal:sequence_ops", + ], +) diff --git a/include/parlay/internal/file_map.h b/include/parlay/internal/file_map.h index 5f69a3c7..3524414e 100644 --- a/include/parlay/internal/file_map.h +++ b/include/parlay/internal/file_map.h @@ -26,7 +26,6 @@ #if defined(PARLAY_NO_FILE_MAP) || defined(PARLAY_USE_FALLBACK_FILE_MAP) #include - #include #include diff --git a/include/parlay/internal/posix/BUILD b/include/parlay/internal/posix/BUILD new file mode 100644 index 00000000..ec8d28bd --- /dev/null +++ b/include/parlay/internal/posix/BUILD @@ -0,0 +1,10 @@ +licenses(["notice"]) + +package( + default_visibility = ["//visibility:public"], +) + +cc_library( + name = "file_map_impl_posix", + hdrs = ["file_map_impl_posix.h"], +) diff --git a/include/parlay/internal/scheduler_plugins/BUILD b/include/parlay/internal/scheduler_plugins/BUILD new file mode 100644 index 00000000..3ee90a1c --- /dev/null +++ b/include/parlay/internal/scheduler_plugins/BUILD @@ -0,0 +1,10 @@ +licenses(["notice"]) + +package( + default_visibility = ["//visibility:public"], +) + +cc_library( + name = "sequential", + hdrs = ["sequential.h"], +) diff --git a/include/parlay/internal/scheduler_plugins/sequential.h b/include/parlay/internal/scheduler_plugins/sequential.h index 20e9b4d4..0227a5dc 100644 --- a/include/parlay/internal/scheduler_plugins/sequential.h +++ b/include/parlay/internal/scheduler_plugins/sequential.h @@ -2,6 +2,7 @@ #define PARLAY_INTERNAL_SCHEDULER_PLUGINS_SEQUENTIAL_H_ #include +#include #include #include diff --git a/include/parlay/internal/windows/BUILD b/include/parlay/internal/windows/BUILD new file mode 100644 index 00000000..bb7a41a2 --- /dev/null +++ b/include/parlay/internal/windows/BUILD @@ -0,0 +1,5 @@ +licenses(["notice"]) + +package( + default_visibility = ["//visibility:public"], +)