HAMR
The Heterogeneous Accelerator Memory Resource
hamr_hip_device.h
Go to the documentation of this file.
1 #ifndef hamr_hip_device_h
2 #define hamr_hip_device_h
3 
4 #include "hamr_config.h"
5 
6 ///@file
7 
8 namespace hamr
9 {
10 /// gets the device identifier for the first GPU. @returns zero if successful.
11 inline int HAMR_EXPORT get_hip_device_identifier(int &dev_id) { dev_id = 0; return 0; }
12 
13 /// gets the device identifier for the host. @returns zero if successful.
14 inline int HAMR_EXPORT get_hip_host_identifier(int &dev_id) { dev_id = -1; return 0; }
15 
16 /// gets the currently atcive HIP device. returns zero if successful.
17 int HAMR_EXPORT get_active_hip_device(int &dev_id);
18 
19 /// sets the active HIP device. returns zero if successful.
20 int HAMR_EXPORT set_active_hip_device(int dev_id);
21 
22 /// gets the device that owns the given pointer. @returns zero if successful.
23 int HAMR_EXPORT get_hip_device(const void *ptr, int &device_id);
24 
25 
26 /** Activate the specified HIP device, and restore the previously active
27  * device when the object is destroyed.
28  */
29 class HAMR_EXPORT activate_hip_device
30 {
31 public:
32  activate_hip_device() = delete;
33  activate_hip_device(const activate_hip_device &) = delete;
34  void operator=(const activate_hip_device &) = delete;
35 
36  activate_hip_device(int id);
38 
39 private:
40  int m_device;
41 };
42 
43 }
44 
45 
46 
47 
48 #endif
hamr::activate_hip_device
Definition: hamr_hip_device.h:29
hamr::get_hip_device
int HAMR_EXPORT get_hip_device(const void *ptr, int &device_id)
gets the device that owns the given pointer.
hamr::get_hip_host_identifier
int HAMR_EXPORT get_hip_host_identifier(int &dev_id)
gets the device identifier for the host.
Definition: hamr_hip_device.h:14
hamr::set_active_hip_device
int HAMR_EXPORT set_active_hip_device(int dev_id)
sets the active HIP device. returns zero if successful.
hamr
heterogeneous accelerator memory resource
Definition: hamr_buffer.h:13
hamr::get_hip_device_identifier
int HAMR_EXPORT get_hip_device_identifier(int &dev_id)
gets the device identifier for the first GPU.
Definition: hamr_hip_device.h:11
hamr::get_active_hip_device
int HAMR_EXPORT get_active_hip_device(int &dev_id)
gets the currently atcive HIP device. returns zero if successful.