device.h
Go to the documentation of this file.
1 #ifndef TTG_PARSEC_DEVICE_H
2 #define TTG_PARSEC_DEVICE_H
3 
4 #include "ttg/device/device.h"
5 #include <parsec/mca/device/device.h>
6 
7 namespace ttg_parsec {
8 
9  namespace detail {
10 
11  // the first ID of an accelerator in the parsec ID-space
12  inline int first_device_id = -1;
13 
17  inline
19  if (device.is_host()) {
20  return 0;
21  } else {
22  return device.id() + first_device_id;
23  }
24  }
25 
29  inline
31  if (parsec_id < first_device_id) {
33  }
34  return ttg::device::Device(parsec_id - first_device_id,
36  }
37  } // namespace detail
38 
39 
40  inline
41  int num_devices() {
42  return parsec_nb_devices - detail::first_device_id;
43  }
44 
45 } // namespace ttg_parsec
46 
47 #endif // TTG_PARSEC_DEVICE_H
Represents a device in a specific execution space.
Definition: device.h:23
bool is_host() const
Definition: device.h:56
int id() const
Definition: device.h:34
constexpr ttg::ExecutionSpace available_execution_space
Definition: device.h:19
ttg::device::Device parsec_device_to_ttg_device(int parsec_id)
Definition: device.h:30
int first_device_id
Definition: device.h:12
int ttg_device_to_parsec_device(const ttg::device::Device &device)
Definition: device.h:18
this contains PaRSEC-based TTG functionality
Definition: fwd.h:18
int num_devices()
Definition: device.h:41