A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://kokkos.github.io/kokkos-core-wiki/API/core/spaces/partition_space.html below:

partition_space - Kokkos documentation

Toggle table of contents sidebar

partition_space

Header file: <Kokkos_Core.hpp>

Warning

Currently partition_space is still in the namespace Kokkos::Experimental

Usage
auto instances = Kokkos::partition_space(Kokkos::DefaultExecutionSpace(),1,1,1);
Interface
template<class ExecSpace, class ...Args>
std::array<ExecSpace, sizeof...(Args)> partition_space(const ExecSpace &space, Args... args);
template<class ExecSpace, class T>
std::vector<ExecSpace> partition_space(const ExecSpace &space, std::vector<T> const &weights);

Creates new execution space instances which dispatch to the same underlying hardware resources as an existing execution space instance. There is no implied synchronization relationship between the newly created instances and the pre-existing instance.

Parameters:
  • space – an execution space instance (see ../execution_spaces.html)

  • args – the number of created instances is equal to sizeof...(Args). The relative weight of args is a hint for the fraction of hardware resources of space to associate with each newly created instance.

  • weightsstd::vector of arithmetic type T providing a hint for the fraction of hardware resources of space to associate with each newly created instance.

Requirements Semantics

Important

For Cuda, HIP and SYCL each newly created instance is associated with its own stream/queue.

Examples

Splitting an existing instance for use with concurrent kernels

template<class ExecSpace, class ... OtherParams>
void foo(const ExecSpace& space, OtherParams...params) {
  auto [instance0, instance1] = Kokkos::partition_space(space,1,2);
  // dispatch two kernels, F1 needs less resources then F2
  // F1 and F2 may now execute concurrently
  Kokkos::parallel_for("F1",
    Kokkos::RangePolicy<ExecSpace>(instance0,0,N1),
    Functor1(params...));
  Kokkos::parallel_for("F2",
    Kokkos::RangePolicy<ExecSpace>(instance1,0,N2),
    Functor2(params...));

  // Wait for both
  // Note: space.fence() would NOT block execution of the instances
  instance0.fence();
  instance1.fence();
  Kokkos::parallel_for("F3",
    Kokkos::RangePolicy<ExecSpace>(space,0,N3),
    Functor3(params...));
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4