Peano 4
Loading...
Searching...
No Matches
tarch::accelerator::Device Class Reference

Core. More...

#include <Device.h>

Collaboration diagram for tarch::accelerator::Device:

Public Member Functions

 ~Device ()
 Destructor.
 
void configure (const std::set< int > &devicesToUse={})
 
void shutdown ()
 Shutdown parallel environment.
 
bool isInitialised () const
 
int getNumberOfDevices () const
 Return the number of GPUs that are available.
 
 ~Device ()
 Destructor.
 
void configure ()
 
void shutdown ()
 Shutdown parallel environment.
 
bool isInitialised () const
 
int getNumberOfDevices () const
 Return the number of GPUs that are available.
 
 ~Device ()
 Destructor.
 
void configure (const std::set< int > &devicesToUse={})
 
void shutdown ()
 Shutdown parallel environment.
 
bool isInitialised () const
 
int getNumberOfDevices () const
 Return the number of GPUs that are available.
 
int getLocalDeviceId () const
 
 ~Device ()
 Destructor.
 
void configure (const std::set< int > &devicesToUse)
 
void shutdown ()
 Shutdown parallel environment.
 
bool isInitialised () const
 
int getNumberOfDevices () const
 Return the number of GPUs that are available.
 

Static Public Member Functions

static DevicegetInstance ()
 
static DevicegetInstance ()
 
static DevicegetInstance ()
 
static DevicegetInstance ()
 

Static Public Attributes

static constexpr int HostDevice = -1
 Accelerator devices (GPUs) are enumerated starting from 0.
 

Private Member Functions

 Device ()
 
 Device ()
 
 Device ()
 
 Device ()
 

Private Attributes

int _numberOfDevices
 
std::set< int_devicesToUse
 

Static Private Attributes

static tarch::logging::Log _log
 Logging device.
 
static int _localDeviceId = 0
 

Detailed Description

Core.

Any shared memory implementation has to provide a singleton Core. Its full qualified name is tarch::multicore::Core. If no shared memory variant is switched on, Peano provides a default Core implementation that does nothing.

If you don't configure the core explicitly, it will try to use some meaningful default.

See also
configure()
Author
Tobias Weinzierl

Definition at line 31 of file Device.h.

Constructor & Destructor Documentation

◆ Device() [1/4]

tarch::accelerator::Device::Device ( )
private

◆ ~Device() [1/4]

tarch::accelerator::Device::~Device ( )

Destructor.

◆ Device() [2/4]

tarch::accelerator::Device::Device ( )
private

◆ ~Device() [2/4]

tarch::accelerator::Device::~Device ( )

Destructor.

◆ Device() [3/4]

tarch::accelerator::Device::Device ( )
private

◆ ~Device() [3/4]

tarch::accelerator::Device::~Device ( )

Destructor.

◆ Device() [4/4]

tarch::accelerator::Device::Device ( )
private

◆ ~Device() [4/4]

tarch::accelerator::Device::~Device ( )

Destructor.

Member Function Documentation

◆ configure() [1/4]

void tarch::accelerator::Device::configure ( )

TBB

In the TBB context, the GPU setting are ignored. If you however combine TBB with SYCL, then the SYCL policies (see below) hold.

OpenMP

By default, OpenMP makes all devices visible to the user.

SYCL

In SYCL, you cannot alter the core count atm on the node. Obviously, we could split the queue on the host according to this spec, but then we'd end up with some cores idling. So we do not support resetting the thread count on the host with SYCL.

By default, SYCL makes no device visible to the user. You have to call configure() manually to make GPUs available to Peano.

◆ configure() [2/4]

void tarch::accelerator::Device::configure ( const std::set< int > & devicesToUse)

TBB

In the TBB context, the GPU setting are ignored. If you however combine TBB with SYCL, then the SYCL policies (see below) hold.

OpenMP

By default, OpenMP makes all devices visible to the user.

SYCL

In SYCL, you cannot alter the core count atm on the node. Obviously, we could split the queue on the host according to this spec, but then we'd end up with some cores idling. So we do not support resetting the thread count on the host with SYCL.

By default, SYCL makes no device visible to the user. You have to call configure() manually to make GPUs available to Peano.

◆ configure() [3/4]

void tarch::accelerator::Device::configure ( const std::set< int > & devicesToUse = {})

TBB

In the TBB context, the GPU setting are ignored. If you however combine TBB with SYCL, then the SYCL policies (see below) hold.

OpenMP

By default, OpenMP makes all devices visible to the user.

SYCL

In SYCL, you cannot alter the core count atm on the node. Obviously, we could split the queue on the host according to this spec, but then we'd end up with some cores idling. So we do not support resetting the thread count on the host with SYCL.

By default, SYCL makes no device visible to the user. You have to call configure() manually to make GPUs available to Peano.

Referenced by swift2::parseCommandLineArguments().

Here is the caller graph for this function:

◆ configure() [4/4]

void tarch::accelerator::Device::configure ( const std::set< int > & devicesToUse = {})

TBB

In the TBB context, the GPU setting are ignored. If you however combine TBB with SYCL, then the SYCL policies (see below) hold.

OpenMP

By default, OpenMP makes all devices visible to the user.

SYCL

In SYCL, you cannot alter the core count atm on the node. Obviously, we could split the queue on the host according to this spec, but then we'd end up with some cores idling. So we do not support resetting the thread count on the host with SYCL.

By default, SYCL makes no device visible to the user. You have to call configure() manually to make GPUs available to Peano.

◆ getInstance() [1/4]

◆ getInstance() [2/4]

static Device & tarch::accelerator::Device::getInstance ( )
static
Returns
Singleton instance

◆ getInstance() [3/4]

static Device & tarch::accelerator::Device::getInstance ( )
static
Returns
Singleton instance

◆ getInstance() [4/4]

static Device & tarch::accelerator::Device::getInstance ( )
static
Returns
Singleton instance

◆ getLocalDeviceId()

int tarch::accelerator::Device::getLocalDeviceId ( ) const

Definition at line 34 of file Device.cpp.

Referenced by runBenchmarks().

Here is the caller graph for this function:

◆ getNumberOfDevices() [1/4]

int tarch::accelerator::Device::getNumberOfDevices ( ) const

Return the number of GPUs that are available.

It is then Peano's policy that you access these GPUs with numbers from 0 to ... We work with logical GPU numbers, i.e. they might be mapped onto different numbers internally. How this mapping is realised however is strongly depending on the used GPU backend.

Referenced by tarch::multicore::orchestration::BackfillAndDeployRoundRobin::toggleDevice().

Here is the caller graph for this function:

◆ getNumberOfDevices() [2/4]

int tarch::accelerator::Device::getNumberOfDevices ( ) const

Return the number of GPUs that are available.

It is then Peano's policy that you access these GPUs with numbers from 0 to ... We work with logical GPU numbers, i.e. they might be mapped onto different numbers internally. How this mapping is realised however is strongly depending on the used GPU backend.

◆ getNumberOfDevices() [3/4]

int tarch::accelerator::Device::getNumberOfDevices ( ) const

Return the number of GPUs that are available.

It is then Peano's policy that you access these GPUs with numbers from 0 to ... We work with logical GPU numbers, i.e. they might be mapped onto different numbers internally. How this mapping is realised however is strongly depending on the used GPU backend.

◆ getNumberOfDevices() [4/4]

int tarch::accelerator::Device::getNumberOfDevices ( ) const

Return the number of GPUs that are available.

It is then Peano's policy that you access these GPUs with numbers from 0 to ... We work with logical GPU numbers, i.e. they might be mapped onto different numbers internally. How this mapping is realised however is strongly depending on the used GPU backend.

◆ isInitialised() [1/4]

bool tarch::accelerator::Device::isInitialised ( ) const
Returns
Shared memory environment is up and running. Most shared memory implementations work properly with the defaults. They just return true always.

◆ isInitialised() [2/4]

bool tarch::accelerator::Device::isInitialised ( ) const
Returns
Shared memory environment is up and running. Most shared memory implementations work properly with the defaults. They just return true always.

◆ isInitialised() [3/4]

bool tarch::accelerator::Device::isInitialised ( ) const
Returns
Shared memory environment is up and running. Most shared memory implementations work properly with the defaults. They just return true always.

◆ isInitialised() [4/4]

bool tarch::accelerator::Device::isInitialised ( ) const
Returns
Shared memory environment is up and running. Most shared memory implementations work properly with the defaults. They just return true always.

◆ shutdown() [1/4]

void tarch::accelerator::Device::shutdown ( )

Shutdown parallel environment.

◆ shutdown() [2/4]

void tarch::accelerator::Device::shutdown ( )

Shutdown parallel environment.

◆ shutdown() [3/4]

void tarch::accelerator::Device::shutdown ( )

Shutdown parallel environment.

◆ shutdown() [4/4]

void tarch::accelerator::Device::shutdown ( )

Shutdown parallel environment.

Field Documentation

◆ _devicesToUse

std::set< int > tarch::accelerator::Device::_devicesToUse
private

Definition at line 41 of file Device.h.

◆ _localDeviceId

int tarch::accelerator::Device::_localDeviceId = 0
staticprivate

Definition at line 39 of file Device.h.

◆ _log

static tarch::logging::Log tarch::accelerator::Device::_log
staticprivate

Logging device.

Definition at line 36 of file Device.h.

◆ _numberOfDevices

int tarch::accelerator::Device::_numberOfDevices
private

Definition at line 40 of file Device.h.

◆ HostDevice

static constexpr int tarch::accelerator::Device::HostDevice = -1
staticconstexpr

Accelerator devices (GPUs) are enumerated starting from 0.

If you argue where to offload tasks and want to pick the host, then pass in this constant instead.

Definition at line 48 of file Device.h.

Referenced by runBenchmarks(), wrapBatchedHeapFunctorHostKernels(), wrapDeviceKernel(), wrapPatchwiseHeapFunctorsHostKernel(), wrapStatelessHostKernel(), and wrapVolumewiseFunctorHostKernels().


The documentation for this class was generated from the following files: