HAMR
The Heterogeneous Accelerator Memory Resource
hamr_openmp_device.h
Go to the documentation of this file.
1 #ifndef hamr_openmp_device_h
2 #define hamr_openmp_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_openmp_device_identifier(int &dev_id) { dev_id = 0; return 0; }
12 
13 /// gets the device identifier for the CPU. @returns zero if successful.
14 int HAMR_EXPORT get_openmp_cpu_identifier(int &dev_id);
15 
16 /// gets the currently atcive HIP device. returns zero if successful.
17 int HAMR_EXPORT get_active_openmp_device(int &dev_id);
18 
19 /// sets the active HIP device. returns zero if successful.
20 int HAMR_EXPORT set_active_openmp_device(int dev_id);
21 
22 /// gets the device that owns the given pointer. @returns zero if successful.
23 int HAMR_EXPORT get_openmp_device(const void *ptr, int &device_id);
24 
25 /** Activate the specified HIP device, and restore the previously active
26  * device when the object is destroyed.
27  */
28 class HAMR_EXPORT activate_openmp_device
29 {
30 public:
31  activate_openmp_device() = delete;
33  void operator=(const activate_openmp_device &) = delete;
34 
35  activate_openmp_device(int id);
37 
38 private:
39  int m_device;
40 };
41 
42 }
43 
44 
45 
46 
47 #endif
hamr::get_openmp_device
int HAMR_EXPORT get_openmp_device(const void *ptr, int &device_id)
gets the device that owns the given pointer.
hamr
heterogeneous accelerator memory resource
Definition: hamr_buffer.h:40
hamr::activate_openmp_device
Definition: hamr_openmp_device.h:28
hamr::get_openmp_cpu_identifier
int HAMR_EXPORT get_openmp_cpu_identifier(int &dev_id)
gets the device identifier for the CPU.
hamr::get_openmp_device_identifier
int HAMR_EXPORT get_openmp_device_identifier(int &dev_id)
gets the device identifier for the first GPU.
Definition: hamr_openmp_device.h:11
hamr::set_active_openmp_device
int HAMR_EXPORT set_active_openmp_device(int dev_id)
sets the active HIP device. returns zero if successful.
hamr::get_active_openmp_device
int HAMR_EXPORT get_active_openmp_device(int &dev_id)
gets the currently atcive HIP device. returns zero if successful.