Skip to content

Instantly share code, notes, and snippets.

View gonidelis's full-sized avatar

Giannis Gonidelis gonidelis

  • CCCL @ Nvidia
  • San Francisco Bay Area, CA
  • X @gonidelis
View GitHub Profile
@gonidelis
gonidelis / clang-format.cpp
Created May 13, 2020 16:40
clang configs
// after my ctrl+s format
namespace hpx {
namespace parallel {
inline namespace v1 {
///////////////////////////////////////////////////////////////////////////
// copy
namespace detail {
/// \cond NOINTERNAL
#pragma once
#include <hpx/type_support/always_void.hpp>
#include <hpx/iterator_support/traits/is_iterator.hpp>
#include <utility>
#include <hpx/iterator_support/traits/is_sentinel_for.hpp>
#include <hpx/testing.hpp>
#include "iter_sent.hpp"
void is_sentinel_for()
{
HPX_TEST_MSG((hpx::traits::is_sentinel_for<Iterator<std::int64_t>{0}, Sentinel<int64_t>{100}>::value == true), "sent for iter");
}
///////////////////////////////////////////////////////////////////////////////
@gonidelis
gonidelis / begin_end.cpp
Created June 12, 2020 11:33
Check wether `is_sentinel_for` works with begin / end iterator pair
HPX_TEST_MSG((hpx::traits::is_sentinel_for<std::vector<int>::iterator,
std::vector<int>::iterator>::value == true),
"iterator being / end pair");
/home/john/hpx_is_sentinel_for/libs/performance_counters/src/performance_counter_set.cpp: In member function ‘std::vector<hpx::performance_counters::counter_value> hpx::performance_counters::performance_counter_set::get_counter_values(hpx::launch::sync_policy, bool, hpx::error_code&) const’:
/home/john/hpx_is_sentinel_for/libs/performance_counters/src/performance_counter_set.cpp:337:37: error: could not convert ‘hpx::util::unwrap(Args&& ...) [with Args = {std::vector<hpx::lcos::future<hpx::performance_counters::counter_value>, std::allocator<hpx::lcos::future<hpx::performance_counters::counter_value> > >}; decltype (unwrap_depth_impl<1>((forward<Args>)(hpx::util::unwrap::args)...)) = std::vector<hpx::lcos::future<hpx::performance_counters::counter_value> >]()’ from ‘std::vector<hpx::lcos::future<hpx::performance_counters::counter_value> >’ to ‘std::vector<hpx::performance_counters::counter_value>’
return hpx::util::unwrap(get_counter_values(reset));
~~~~~~~~~~~~~~~~~^~~~~~~~~~
@gonidelis
gonidelis / cxx20_disable_sized_sentinel_for.cpp
Created June 16, 2020 11:46
feature check test for disable_sized_sentinel_for
#include <disable_sized_sentinel_for>
int main()
{
inline constexpr bool b = std::disable_sized_sentinel_for<void, void>;
return 0;
}
/home/giannis/foreach_adapt/libs/algorithms/include/hpx/parallel/util/detail/algorithm_result.hpp: In instantiation of ‘static hpx::parallel::util::detail::algorithm_result_impl<ExPolicy, T>::type hpx::parallel::util::detail::algorithm_result_impl<ExPolicy, T>::get(T_&&) [with T_ = Sentinel<long int>; ExPolicy = hpx::parallel::execution::sequenced_policy; T = Iterator<long int>; hpx::parallel::util::detail::algorithm_result_impl<ExPolicy, T>::type = Iterator<long int>]’:
/home/giannis/foreach_adapt/libs/algorithms/include/hpx/parallel/algorithms/for_each.hpp:427:35: required from ‘typename hpx::parallel::util::detail::algorithm_result<ExPolicy, T>::type hpx::parallel::v1::detail::for_each_(ExPolicy&&, FwdIterB, FwdIterE, F&&, Proj&&, std::false_type) [with ExPolicy = const hpx::parallel::execution::sequenced_policy&; FwdIterB = Iterator<long int>; FwdIterE = Sentinel<long int>; F = void (&)(int); Proj = hpx::parallel::util::projection_identity; typename hpx::parallel::util::detail::algorithm_result<ExPolicy
#include <hpx/hpx_main.hpp>
#include <hpx/include/parallel_for_each.hpp>
#include <hpx/modules/testing.hpp>
#include "iter_sent.hpp"
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <iostream>
In file included from /home/giannis/foreach_adapt/libs/include/include/hpx/include/parallel_for_each.hpp:10,
from /home/giannis/foreach_adapt/libs/algorithms/tests/unit/container_algorithms/foreach_adapt.cpp:2:
/home/giannis/foreach_adapt/libs/algorithms/include/hpx/parallel/algorithms/for_each.hpp: In instantiation of ‘static typename std::enable_if<(! hpx::traits::is_random_access_iterator<InIterB>::value), InIterB>::type hpx::parallel::v1::detail::for_each<Iter>::sequential(ExPolicy&&, InIterB, InIterE, F&&, Proj&&) [with ExPolicy = const hpx::parallel::execution::sequenced_policy&; InIterB = Iterator<long int>; InIterE = Sentinel<long int>; F = void (&)(int); Proj = hpx::parallel::util::projection_identity; Iter = Iterator<long int>; typename std::enable_if<(! hpx::traits::is_random_access_iterator<InIterB>::value), InIterB>::type = Iterator<long int>]’:
/home/giannis/foreach_adapt/libs/algorithms/include/hpx/parallel/algorithms/detail/dispatch.hpp:108:44: required from ‘typename hpx::p
@gonidelis
gonidelis / transform_loop.hpp
Created July 30, 2020 20:13
adapted transform loop
namespace detail {
template <typename Iter>
struct transform_loop
{
template <typename InIterB, typename InIterE, typename OutIter, typename F>
HPX_HOST_DEVICE HPX_FORCEINLINE static util::in_out_result<InIterB, OutIter>
call(InIterB first, InIterE last, OutIter dest, F&& f)
{
for (/* */; first != last; (void) ++first, ++dest)
{