Skip to content

Commit

Permalink
Restructure code
Browse files Browse the repository at this point in the history
  • Loading branch information
maawad committed Jan 25, 2024
1 parent c114ca2 commit 1f57180
Show file tree
Hide file tree
Showing 42 changed files with 117 additions and 141 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
add_library(bght INTERFACE)
add_library(bght::bght ALIAS bght)

add_library(bght::bght ALIAS bght)


# CUDA and C++ compiler flags
set(CXX_FLAGS
Expand All @@ -46,7 +44,7 @@ set(CUDA_FLAGS
--forward-unknown-to-host-linker
--forward-unknown-to-host-compiler
--expt-relaxed-constexpr
$<$<CONFIG:Release>:-Xptxas -warn-spills -res-usage>
# $<$<CONFIG:Release>:-Xptxas -warn-spills -res-usage>
)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bucket_size Bucket size for device-side APIs cooperative gro
#### Example
```c++
// Example using host-side APIs
#include <bcht.hpp>
#include <bght/cht.hpp>
int main(){
using key_type = uint32_t;
using value_type = uint32_t;
Expand Down
15 changes: 7 additions & 8 deletions benchmarks/probes_per_technique.cu
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
#include <utility>

#include <thrust/device_vector.h>
#include <cmd.hpp>
#include <gpu_timer.hpp>
#include <bght/cmd.hpp>
#include <bght/gpu_timer.hpp>

#include <benchmark_helpers.cuh>
#include <bght/benchmark_helpers.cuh>
#include <bght/cht.hpp>

#include <cht.hpp>

#include <bcht.hpp>
#include <iht.hpp>
#include <p2bht.hpp>
#include <bght/bcht.hpp>
#include <bght/iht.hpp>
#include <bght/p2bht.hpp>

using key_type = uint32_t;
using value_type = uint32_t;
Expand Down
14 changes: 7 additions & 7 deletions benchmarks/rates_per_technique.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
#include <unordered_set>
#include <utility>

#include <cht.hpp>
#include <bght/cht.hpp>

#include <thrust/device_vector.h>
#include <bcht.hpp>
#include <cmd.hpp>
#include <gpu_timer.hpp>
#include <iht.hpp>
#include <p2bht.hpp>
#include <bght/bcht.hpp>
#include <bght/cmd.hpp>
#include <bght/gpu_timer.hpp>
#include <bght/iht.hpp>
#include <bght/p2bht.hpp>

#include <benchmark_helpers.cuh>
#include <bght/benchmark_helpers.cuh>

using key_type = uint32_t;
using value_type = uint32_t;
Expand Down
59 changes: 21 additions & 38 deletions benchmarks/rates_per_technique_fixed_lf.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
#include <unordered_set>
#include <utility>

#include <cht.hpp>
#include <bght/cht.hpp>

#include <thrust/device_vector.h>
#include <bcht.hpp>
#include <cmd.hpp>
#include <gpu_timer.hpp>
#include <iht.hpp>
#include <p2bht.hpp>
#include <bght/bcht.hpp>
#include <bght/cmd.hpp>
#include <bght/gpu_timer.hpp>
#include <bght/iht.hpp>
#include <bght/p2bht.hpp>

#include <benchmark_helpers.cuh>
#include <bght/benchmark_helpers.cuh>

using key_type = uint32_t;
using value_type = uint32_t;
Expand Down Expand Up @@ -66,7 +66,6 @@ template <typename HashMap,
typename pair_type,
typename Function>
bench_insert_find_result bench_insert_find(
std::vector<key_type>& keys,
thrust::device_vector<key_type>& d_keys,
thrust::device_vector<pair_type>& d_pairs,
thrust::device_vector<key_type>& d_find_keys,
Expand All @@ -80,8 +79,6 @@ bench_insert_find_result bench_insert_find(
std::vector<float>& exist_ratios,
Function to_value,
int bucket_size) {
assert(keys.size() == 2 * num_keys);

std::cout << "Bench insert/search rates: " << num_keys << " keys, ";
std::cout << "bucket_size: " << bucket_size << ", ";
std::cout << "load_factor: " << load_factor << ", ";
Expand Down Expand Up @@ -248,8 +245,7 @@ void bench_bcht(std::vector<key_type>& keys,
// 1
{
auto bcht_1_result =
bench_insert_find<bght::cht<key_type, value_type>>(keys,
d_keys,
bench_insert_find<bght::cht<key_type, value_type>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -270,8 +266,7 @@ void bench_bcht(std::vector<key_type>& keys,

// 8
{
auto bcht_8_result = bench_insert_find<bcht8<key_type, value_type>>(keys,
d_keys,
auto bcht_8_result = bench_insert_find<bcht8<key_type, value_type>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -292,8 +287,7 @@ void bench_bcht(std::vector<key_type>& keys,

// 16
{
auto bcht_16_result = bench_insert_find<bcht16<key_type, value_type>>(keys,
d_keys,
auto bcht_16_result = bench_insert_find<bcht16<key_type, value_type>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -314,8 +308,7 @@ void bench_bcht(std::vector<key_type>& keys,

// 32
{
auto bcht_32_result = bench_insert_find<bcht32<key_type, value_type>>(keys,
d_keys,
auto bcht_32_result = bench_insert_find<bcht32<key_type, value_type>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand Down Expand Up @@ -388,8 +381,7 @@ void bench_iht(std::vector<key_type>& keys,

// 16 0.2
{
auto iht_16_result = bench_insert_find<iht16<key_type, value_type, 3>>(keys,
d_keys,
auto iht_16_result = bench_insert_find<iht16<key_type, value_type, 3>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -410,8 +402,7 @@ void bench_iht(std::vector<key_type>& keys,

// 16 0.4
{
auto iht_16_result = bench_insert_find<iht16<key_type, value_type, 6>>(keys,
d_keys,
auto iht_16_result = bench_insert_find<iht16<key_type, value_type, 6>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -432,8 +423,7 @@ void bench_iht(std::vector<key_type>& keys,

// 16 0.6
{
auto iht_16_result = bench_insert_find<iht16<key_type, value_type, 9>>(keys,
d_keys,
auto iht_16_result = bench_insert_find<iht16<key_type, value_type, 9>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -455,8 +445,7 @@ void bench_iht(std::vector<key_type>& keys,
// 16 0.8
{
auto iht_16_result =
bench_insert_find<iht16<key_type, value_type, 12>>(keys,
d_keys,
bench_insert_find<iht16<key_type, value_type, 12>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -477,8 +466,7 @@ void bench_iht(std::vector<key_type>& keys,

// 32 0.2
{
auto iht_32_result = bench_insert_find<iht32<key_type, value_type, 6>>(keys,
d_keys,
auto iht_32_result = bench_insert_find<iht32<key_type, value_type, 6>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -500,8 +488,7 @@ void bench_iht(std::vector<key_type>& keys,
// 32 0.4
{
auto iht_32_result =
bench_insert_find<iht32<key_type, value_type, 12>>(keys,
d_keys,
bench_insert_find<iht32<key_type, value_type, 12>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -523,8 +510,7 @@ void bench_iht(std::vector<key_type>& keys,
// 32 0.6
{
auto iht_32_result =
bench_insert_find<iht32<key_type, value_type, 19>>(keys,
d_keys,
bench_insert_find<iht32<key_type, value_type, 19>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -546,8 +532,7 @@ void bench_iht(std::vector<key_type>& keys,
// 32 0.8
{
auto iht_32_result =
bench_insert_find<iht32<key_type, value_type, 25>>(keys,
d_keys,
bench_insert_find<iht32<key_type, value_type, 25>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand Down Expand Up @@ -615,8 +600,7 @@ void bench_p2bht(std::vector<key_type>& keys,
// 16
{
auto p2cht_16_result =
bench_insert_find<p2bht16<key_type, value_type>>(keys,
d_keys,
bench_insert_find<p2bht16<key_type, value_type>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand All @@ -638,8 +622,7 @@ void bench_p2bht(std::vector<key_type>& keys,
// 32
{
auto p2cht_32_result =
bench_insert_find<p2bht32<key_type, value_type>>(keys,
d_keys,
bench_insert_find<p2bht32<key_type, value_type>>(d_keys,
d_pairs,
d_find_keys,
d_find_results,
Expand Down
10 changes: 5 additions & 5 deletions examples/1cht_example.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/sequence.h>
#include <benchmark_helpers.cuh>
#include <cht.hpp>
#include <cmd.hpp>
#include <gpu_timer.hpp>
#include <bght/benchmark_helpers.cuh>
#include <bght/cht.hpp>
#include <bght/cmd.hpp>
#include <bght/gpu_timer.hpp>
#include <bght/perf_report.hpp>
#include <limits>
#include <perf_report.hpp>
#include <type_traits>

int main(int argc, char** argv) {
Expand Down
2 changes: 1 addition & 1 deletion examples/array_example.cu
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <cstdint>

#include <bcht.hpp>
#include <bght/bcht.hpp>

// Testing passing a hashmap to the device
template <typename HashMap, typename Keys>
Expand Down
10 changes: 5 additions & 5 deletions examples/bcht_example.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/sequence.h>
#include <bcht.hpp>
#include <cmd.hpp>
#include <gpu_timer.hpp>
#include <bght/bcht.hpp>
#include <bght/cmd.hpp>
#include <bght/gpu_timer.hpp>
#include <bght/perf_report.hpp>
#include <bght/rkg.hpp>
#include <limits>
#include <perf_report.hpp>
#include <rkg.hpp>
#include <type_traits>

int main(int argc, char** argv) {
Expand Down
2 changes: 1 addition & 1 deletion examples/cpm/test_cpm.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <thrust/host_vector.h>
#include <limits>
#include <vector>
#include "bcht.hpp"
#include "bght/bcht.hpp"

int main() {
using K = unsigned;
Expand Down
7 changes: 5 additions & 2 deletions examples/custom_allocator_example.cu
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@

#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <bcht.hpp>
#include <bght/bcht.hpp>
#include <memory>

template <typename T1, typename T2>
void CHECK(T1 t1, T2 t2) {
assert(t1 == t2);
if (t1 != t2) {
std::cerr << t1 << "!=" << t2 << std::endl;
std::terminate();
}
}

template <class T>
Expand Down
14 changes: 7 additions & 7 deletions examples/custom_types_example.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/sequence.h>
#include <cmd.hpp>
#include <gpu_timer.hpp>
#include <bght/cmd.hpp>
#include <bght/gpu_timer.hpp>
#include <bght/rkg.hpp>
#include <limits>
#include <rkg.hpp>
#include <type_traits>

#include <cht.hpp>
#include <bght/cht.hpp>

#include <bcht.hpp>
#include <iht.hpp>
#include <p2bht.hpp>
#include <bght/bcht.hpp>
#include <bght/iht.hpp>
#include <bght/p2bht.hpp>

template <class K, class V>
using iht16_80 = iht16<K, V, 12>;
Expand Down
4 changes: 2 additions & 2 deletions examples/hash_join.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <thrust/for_each.h>
#include <thrust/host_vector.h>
#include <thrust/iterator/counting_iterator.h>
#include <iht.hpp>
#include <bght/iht.hpp>
#include <bght/tile_wide_queue.hpp>
#include <limits>
#include <tile_wide_queue.hpp>
#include <type_traits>
#include <vector>

Expand Down
10 changes: 5 additions & 5 deletions examples/iht_example.cu
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/sequence.h>
#include <cmd.hpp>
#include <gpu_timer.hpp>
#include <iht.hpp>
#include <bght/cmd.hpp>
#include <bght/gpu_timer.hpp>
#include <bght/iht.hpp>
#include <bght/perf_report.hpp>
#include <bght/rkg.hpp>
#include <limits>
#include <perf_report.hpp>
#include <rkg.hpp>
#include <type_traits>

template <template <typename, typename, int> class hashmap, int threshold>
Expand Down
7 changes: 0 additions & 7 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
file(GLOB_RECURSE bght_src
"*.h"
"*.hpp"
"*.cuh"
"*.cu")
set(SOURCE_LIST ${bght_src})
target_sources(bght INTERFACE ${bght_src})
target_include_directories(bght INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
Loading

0 comments on commit 1f57180

Please sign in to comment.