Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Kokkos documentation
Kokkos documentation
  • Get Started
    • Quick Start
    • Requirements
    • Integrating Kokkos into Your Project
    • Building From Source
    • CMake Keywords
    • Package Managers
  • Programming Guide
    • 1. Introduction
    • 2. Machine Model
    • 3. Programming Model
    • 4. Compiling
    • 5. Initialization
    • 6. View: Multidimensional array
    • 7. Parallel dispatch
    • 8. Hierarchical Parallelism
    • 9. Custom Reductions
      • 9.1. Built-In-Reducers
      • 9.2. Built-In Reducers with Custom Scalar Types
      • 9.3. Custom Reducers
    • 10. Atomic Operations
    • 11. Subviews
    • 12. Backwards & Future Compatibility
    • 13. Interoperability and Legacy Codes
    • 14. Kokkos and Virtual Functions
    • 15. SIMD Types
    • 16. Graphs
  • API References
    • Core API
      • Initialize and Finalize
        • initialize
        • finalize
        • ScopeGuard
        • InitializationSettings
        • InitArguments
        • push_finalize_hook
      • View and related
        • create_mirror[_view]
        • deep_copy
        • LayoutLeft
        • LayoutRight
        • LayoutStride
        • realloc
        • resize
        • subview
        • Kokkos::Subview
        • View
        • view_alloc
        • View-like Types
      • Parallel Execution/Dispatch
        • parallel_for
        • parallel_reduce
        • parallel_scan
        • fence
        • ParallelForTag
        • ParallelReduceTag
        • ParallelScanTag
      • Built-in Reducers
        • ReducerConcept
        • BAnd
        • BOr
        • LAnd
        • LOr
        • Max
        • MaxLoc
        • Min
        • MinLoc
        • MinMax
        • MinMaxLoc
        • Prod
        • Sum
        • Reduction Scalar Types
          • MinMaxLocScalar
          • MinMaxScalar
          • ValLocScalar
      • Execution Policies
        • ExecutionPolicy
        • MDRangePolicy
        • NestedPolicies
        • RangePolicy
        • TeamHandleConcept
        • TeamPolicy
        • TeamThreadMDRange
        • TeamThreadRange
        • TeamVectorMDRange
        • TeamVectorRange
        • ThreadVectorMDRange
        • ThreadVectorRange
      • Spaces
        • Execution Spaces
        • partition_space
        • Memory Spaces
        • Space Accessibility
      • Task-Parallelism
      • Multi-GPU Support
      • Atomics
        • atomic_load
        • atomic_store
        • atomic_exchange
        • atomic_compare_exchange
        • atomic_compare_exchange_strong
        • atomic_assign
        • atomic_fetch_[op]
        • atomic_[op]
        • atomic_[op]_fetch
      • Numerics
        • Mathematical constants
        • Common math functions
        • Numeric traits
        • Bit manipulation
      • C-style memory management
        • kokkos_malloc
        • kokkos_realloc
        • kokkos_free
      • Traits
      • Kokkos Concepts
      • STL Compatibility Issues
        • Array
        • Kokkos::pair
      • Utilities
        • Kokkos::abort
        • Kokkos::ALL
        • KOKKOS_ASSERT
        • Kokkos::complex
        • Minimum/maximum operations
        • Kokkos::printf
        • Kokkos::kokkos_swap
        • Kokkos::Timer
        • Kokkos::device_id
        • Kokkos::num_devices
        • Kokkos::num_threads
        • Kokkos::Experimental
      • Detection Idiom
      • Macros
        • Function Annotation Macros
      • Profiling
        • Profiling::ScopedRegion
        • Profiling::ProfilingSection
    • Algorithms API
      • Random-Number
      • Generator
      • Sort
      • Sorting with nested policies (team- and thread-level)
      • Std Algorithms
        • Iterators
        • Minimum/maximum
          • min_element
          • max_element
          • minmax_element
        • Modifying Sequence
          • copy
          • copy_if
          • copy_n
          • copy_backward
          • move
          • move_backward
          • fill
          • fill_n
          • transform
          • generate
          • generate_n
          • remove
          • remove_if
          • remove_copy
          • remove_copy_if
          • replace
          • replace_if
          • replace_copy
          • replace_copy_if
          • swap_ranges
          • reverse
          • reverse_copy
          • rotate
          • rotate_copy
          • shift_left
          • shift_right
          • unique
          • unique_copy
        • Non-modifying Sequence
          • adjacent_find
          • count
          • count_if
          • equal
          • all_of
          • any_of
          • none_of
          • find
          • find_if
          • find_if_not
          • find_end
          • find_first_of
          • for_each
          • for_each_n
          • lexicographical_compare
          • mismatch
          • search
          • search_n
        • Numeric
          • adjacent_difference
          • reduce
          • exclusive_scan
          • inclusive_scan
          • transform_reduce
          • transform_exclusive_scan
          • transform_inclusive_scan
        • Partitioning
          • is_partitioned
          • partition_point
          • partition_copy
        • Sorting
          • is_sorted
          • is_sorted_until
    • Containers API
      • Bitset
      • ConstBitset
      • DualView
      • DynamicView
      • DynRankView
      • OffsetView
      • ScatterView
      • StaticCrsGraph [DEPRECATED]
      • UnorderedMap
      • vector [DEPRECATED]
    • SIMD API
      • Experimental::simd
      • Experimental::simd_mask
      • Experimental::where_expression
    • API in Alphabetical Order
    • Deprecations
  • Tutorials and Examples
    • Tutorials
    • Video lectures and slides
      • 1. Intro, Build, Parallel dispatch
      • 2. Views and Spaces
      • 3. Multidim loops and Data Structures
      • 4. Hierarchical Parallelism
      • 5. SIMD, Streams, Tasking
      • 6. Fortran/Python interop, MPI, PGAS
      • 7. Kokkos Tools
      • 8. Kokkos Kernels Math Library
    • Use Cases and Examples
      • MPI Halo Exchange
      • ScatterView averaging elements to nodes
      • MDRangePolicy Use Case
      • Tagged Operators
      • Overlapping Host and Device work
      • Kokkos Tasking Use Case
      • Fortran Interop Use Case
      • Array of Structures and Structure of Arrays with Cabana
      • Kokkos and Windows.h
      • Moving code from requiring Kokkos_ENABLE_CUDA_UVM to using SharedSpace
  • Contributing
    • Documentation Templates
      • Class API Template
    • Developer Guides
      • PRs and Reviews
    • Kokkos Planning and Testing
      • Kokkos Project Planning
      • Requirements, Issues and Feedback
      • Attachments
      • Kokkos Testing Processes and Change Process
      • Kokkos Testing Workflow Components
  • GitHub Repo
  • Known issues
  • FAQ
  • Citing Kokkos
  • License
Back to top
Edit this page
View this page

search¶

Header File: Kokkos_StdAlgorithms.hpp

namespace Kokkos{
namespace Experimental{

template <class ExecutionSpace, class IteratorType1, class IteratorType2>
IteratorType1 search(const ExecutionSpace& exespace, IteratorType1 first,
                     IteratorType1 last, IteratorType2 s_first,                      (1)
                     IteratorType2 s_last);

template <class ExecutionSpace, class IteratorType1, class IteratorType2>
IteratorType1 search(const std::string& label, const ExecutionSpace& exespace,
                     IteratorType1 first, IteratorType1 last,                        (2)
                     IteratorType2 s_first, IteratorType2 s_last);

template <class ExecutionSpace, class DataType1, class... Properties1,
          class DataType2, class... Properties2>
auto search(const ExecutionSpace& exespace,
            const ::Kokkos::View<DataType1, Properties1...>& view,                   (3)
            const ::Kokkos::View<DataType2, Properties2...>& s_view);

template <class ExecutionSpace, class DataType1, class... Properties1,
          class DataType2, class... Properties2>
auto search(const std::string& label, const ExecutionSpace& exespace,
            const ::Kokkos::View<DataType1, Properties1...>& view,                   (4)
            const ::Kokkos::View<DataType2, Properties2...>& s_view);

// overload set 2: binary predicate passed
template <class ExecutionSpace, class IteratorType1, class IteratorType2,
          class BinaryPredicateType>
IteratorType1 search(const ExecutionSpace& exespace, IteratorType1 first,                  (5)
                     IteratorType1 last, IteratorType2 s_first,
                     IteratorType2 s_last, const BinaryPredicateType& pred);

template <class ExecutionSpace, class IteratorType1, class IteratorType2,
          class BinaryPredicateType>
IteratorType1 search(const std::string& label, const ExecutionSpace& exespace,
                     IteratorType1 first, IteratorType1 last,                        (6)
                     IteratorType2 s_first, IteratorType2 s_last,
                     const BinaryPredicateType& pred);

template <class ExecutionSpace, class DataType1, class... Properties1,
          class DataType2, class... Properties2, class BinaryPredicateType>
auto search(const ExecutionSpace& exespace,
            const ::Kokkos::View<DataType1, Properties1...>& view,                   (7)
            const ::Kokkos::View<DataType2, Properties2...>& s_view,
            const BinaryPredicateType& pred);

template <class ExecutionSpace, class DataType1, class... Properties1,
          class DataType2, class... Properties2, class BinaryPredicateType>
auto search(const std::string& label, const ExecutionSpace& exespace,
            const ::Kokkos::View<DataType1, Properties1...>& view,                   (8)
            const ::Kokkos::View<DataType2, Properties2...>& s_view,
            const BinaryPredicateType& pred)

} //end namespace Experimental
} //end namespace Kokkos

Description¶

Searches for the first occurrence of the sequence of elements [s_first, s_last) in the range [first, last) in (1,2,5,6). Searches for the first occurrence of the sequence of elements s_view in view in (3,4,7,8). Elements in (1,2,3,4) are compared using == and elements in (5,6,7,8) are compared using pred.

Parameters and Requirements¶

  • exespace, s_first, s_last, first, last, s_view and view similar to mismatch.

  • label:

    • 1,5: The default string is “Kokkos::search_iterator_api_default”.

    • 3,7: The default string is “Kokkos::search_view_api_default”.

  • pred - similar to equal

Next
search_n
Previous
mismatch
Copyright © 2025, National Technology & Engineering Solutions of Sandia, LLC (NTESS)
Made with Sphinx and @pradyunsg's Furo
On this page
  • search
    • Description
    • Parameters and Requirements