This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SourceLocation location_of_delete_keyword(FunctionDecl* FD, SourceManager& SM, const LangOptions& LO) | |
{ | |
// getSourceRange() of a CXXMethodDecl seems to include the "= delete" | |
if(isa<CXXMethodDecl>(FD)) return FD->getSourceRange().getEnd(); | |
// we need to lex to find the end of "delete" for functions | |
// that are not methods because their SourceRange omits | |
// the trailing "= delete" | |
SourceLocation loc = FD->getBeginLoc(); | |
SourceLocation result = FD->getEndLoc(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $ clang-5.0 -std=c++17 -Iexecutors-impl/include -lstdc++ neo_executor.cpp | |
#include <experimental/execution> | |
#include <type_traits> | |
#include <iostream> | |
template<class T> | |
struct __is_bulk_task | |
{ | |
template<class U = T, | |
class = decltype(std::declval<U>().function()), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. | |
// | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions | |
// are met: | |
// * Redistributions of source code must retain the above copyright | |
// notice, this list of conditions and the following disclaimer. | |
// * Redistributions in binary form must reproduce the above copyright | |
// notice, this list of conditions and the following disclaimer in the | |
// documentation and/or other materials provided with the distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<class T> | |
class always_ready_future | |
{ | |
public: | |
always_ready_future(T&& value) | |
: value_(std::move(value)) | |
{} | |
// never blocks | |
void wait(){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <cassert> | |
template<int i, class Whence, class T, bool = std::is_empty<T>::value> | |
struct tuple_leaf | |
{ | |
tuple_leaf(T x) : val(x) {} | |
T& get() { return val; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if !defined(__CUDA_ARCH__) || (__CUDA_ARCH__>= 350 && defined(__CUDACC_RDC__)) | |
# define CUB_CDP 1 | |
#endif | |
#if defined(__CUDACC__) | |
# if !defined(__CUDA_ARCH__) || (__CUDA_ARCH__>= 350 && defined(__CUDACC_RDC__)) | |
# define HAS_CUDART 1 | |
# else | |
# define HAS_CUDART 0 | |
# endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename Vector> | |
struct Particles { | |
typedef typename Vector::value_type T; | |
typedef thrust::zip_iterator< | |
thrust::tuple< | |
typename Vector::iterator, | |
typename Vector::iterator, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Figure 16.1 | |
#include <thrust/host_vector.h> | |
#include <thrust/device_vector.h> | |
#include <thrust/generate.h> | |
#include <thrust/sort.h> | |
#include <thrust/copy.h> | |
#include <cstdlib> | |
int main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <thrust/pair.h> | |
#include <thrust/tuple.h> | |
#include <thrust/iterator/zip_iterator.h> | |
#include <thrust/functional.h> | |
#include <thrust/merge.h> | |
#include <iostream> | |
#include <algorithm> | |
// compares the 0th elements of two tuples | |
template<typename Compare> |