|
|
|
@ -23,7 +23,7 @@ namespace ucl_hip {
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
typedef hipStream_t command_queue;
|
|
|
|
typedef hipStream_t command_queue;
|
|
|
|
|
|
|
|
|
|
|
|
inline void ucl_flush(command_queue &cq) {}
|
|
|
|
inline void ucl_flush(command_queue &) {}
|
|
|
|
|
|
|
|
|
|
|
|
inline void ucl_sync(hipStream_t &stream) {
|
|
|
|
inline void ucl_sync(hipStream_t &stream) {
|
|
|
|
CU_SAFE_CALL(hipStreamSynchronize(stream));
|
|
|
|
CU_SAFE_CALL(hipStreamSynchronize(stream));
|
|
|
|
@ -141,12 +141,12 @@ class UCL_Device {
|
|
|
|
/// Get a string telling the type of the current device
|
|
|
|
/// Get a string telling the type of the current device
|
|
|
|
inline std::string device_type_name() { return device_type_name(_device); }
|
|
|
|
inline std::string device_type_name() { return device_type_name(_device); }
|
|
|
|
/// Get a string telling the type of the device
|
|
|
|
/// Get a string telling the type of the device
|
|
|
|
inline std::string device_type_name(const int i) { return "GPU"; }
|
|
|
|
inline std::string device_type_name(const int) { return "GPU"; }
|
|
|
|
|
|
|
|
|
|
|
|
/// Get current device type (UCL_CPU, UCL_GPU, UCL_ACCELERATOR, UCL_DEFAULT)
|
|
|
|
/// Get current device type (UCL_CPU, UCL_GPU, UCL_ACCELERATOR, UCL_DEFAULT)
|
|
|
|
inline enum UCL_DEVICE_TYPE device_type() { return device_type(_device); }
|
|
|
|
inline enum UCL_DEVICE_TYPE device_type() { return device_type(_device); }
|
|
|
|
/// Get device type (UCL_CPU, UCL_GPU, UCL_ACCELERATOR, UCL_DEFAULT)
|
|
|
|
/// Get device type (UCL_CPU, UCL_GPU, UCL_ACCELERATOR, UCL_DEFAULT)
|
|
|
|
inline enum UCL_DEVICE_TYPE device_type(const int i) { return UCL_GPU; }
|
|
|
|
inline enum UCL_DEVICE_TYPE device_type(const int) { return UCL_GPU; }
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns true if host memory is efficiently addressable from device
|
|
|
|
/// Returns true if host memory is efficiently addressable from device
|
|
|
|
inline bool shared_memory() { return shared_memory(_device); }
|
|
|
|
inline bool shared_memory() { return shared_memory(_device); }
|
|
|
|
@ -204,7 +204,7 @@ class UCL_Device {
|
|
|
|
// Get the bytes of free memory in the current device
|
|
|
|
// Get the bytes of free memory in the current device
|
|
|
|
inline size_t free_bytes() { return free_bytes(_device); }
|
|
|
|
inline size_t free_bytes() { return free_bytes(_device); }
|
|
|
|
// Get the bytes of free memory
|
|
|
|
// Get the bytes of free memory
|
|
|
|
inline size_t free_bytes(const int i) {
|
|
|
|
inline size_t free_bytes(const int) {
|
|
|
|
CUDA_INT_TYPE dfree, dtotal;
|
|
|
|
CUDA_INT_TYPE dfree, dtotal;
|
|
|
|
CU_SAFE_CALL_NS(hipMemGetInfo(&dfree, &dtotal));
|
|
|
|
CU_SAFE_CALL_NS(hipMemGetInfo(&dfree, &dtotal));
|
|
|
|
return static_cast<size_t>(dfree);
|
|
|
|
return static_cast<size_t>(dfree);
|
|
|
|
@ -257,26 +257,26 @@ class UCL_Device {
|
|
|
|
inline bool fission_equal()
|
|
|
|
inline bool fission_equal()
|
|
|
|
{ return fission_equal(_device); }
|
|
|
|
{ return fission_equal(_device); }
|
|
|
|
/// True if splitting device into equal subdevices supported
|
|
|
|
/// True if splitting device into equal subdevices supported
|
|
|
|
inline bool fission_equal(const int i)
|
|
|
|
inline bool fission_equal(const int)
|
|
|
|
{ return false; }
|
|
|
|
{ return false; }
|
|
|
|
/// True if splitting device into subdevices by specified counts supported
|
|
|
|
/// True if splitting device into subdevices by specified counts supported
|
|
|
|
inline bool fission_by_counts()
|
|
|
|
inline bool fission_by_counts()
|
|
|
|
{ return fission_by_counts(_device); }
|
|
|
|
{ return fission_by_counts(_device); }
|
|
|
|
/// True if splitting device into subdevices by specified counts supported
|
|
|
|
/// True if splitting device into subdevices by specified counts supported
|
|
|
|
inline bool fission_by_counts(const int i)
|
|
|
|
inline bool fission_by_counts(const int)
|
|
|
|
{ return false; }
|
|
|
|
{ return false; }
|
|
|
|
/// True if splitting device into subdevices by affinity domains supported
|
|
|
|
/// True if splitting device into subdevices by affinity domains supported
|
|
|
|
inline bool fission_by_affinity()
|
|
|
|
inline bool fission_by_affinity()
|
|
|
|
{ return fission_by_affinity(_device); }
|
|
|
|
{ return fission_by_affinity(_device); }
|
|
|
|
/// True if splitting device into subdevices by affinity domains supported
|
|
|
|
/// True if splitting device into subdevices by affinity domains supported
|
|
|
|
inline bool fission_by_affinity(const int i)
|
|
|
|
inline bool fission_by_affinity(const int)
|
|
|
|
{ return false; }
|
|
|
|
{ return false; }
|
|
|
|
|
|
|
|
|
|
|
|
/// Maximum number of subdevices allowed from device fission
|
|
|
|
/// Maximum number of subdevices allowed from device fission
|
|
|
|
inline int max_sub_devices()
|
|
|
|
inline int max_sub_devices()
|
|
|
|
{ return max_sub_devices(_device); }
|
|
|
|
{ return max_sub_devices(_device); }
|
|
|
|
/// Maximum number of subdevices allowed from device fission
|
|
|
|
/// Maximum number of subdevices allowed from device fission
|
|
|
|
inline int max_sub_devices(const int i)
|
|
|
|
inline int max_sub_devices(const int)
|
|
|
|
{ return 0; }
|
|
|
|
{ return 0; }
|
|
|
|
|
|
|
|
|
|
|
|
/// True if the device supports shuffle intrinsics
|
|
|
|
/// True if the device supports shuffle intrinsics
|
|
|
|
@ -290,8 +290,7 @@ class UCL_Device {
|
|
|
|
inline void print_all(std::ostream &out);
|
|
|
|
inline void print_all(std::ostream &out);
|
|
|
|
|
|
|
|
|
|
|
|
/// For compatability with OCL API
|
|
|
|
/// For compatability with OCL API
|
|
|
|
inline int auto_set_platform(const enum UCL_DEVICE_TYPE type=UCL_GPU,
|
|
|
|
inline int auto_set_platform(const enum UCL_DEVICE_TYPE, const std::string)
|
|
|
|
const std::string vendor="")
|
|
|
|
|
|
|
|
{ return set_platform(0); }
|
|
|
|
{ return set_platform(0); }
|
|
|
|
|
|
|
|
|
|
|
|
inline int load_module(const void* program, hipModule_t& module, std::string *log=nullptr){
|
|
|
|
inline int load_module(const void* program, hipModule_t& module, std::string *log=nullptr){
|
|
|
|
@ -404,7 +403,7 @@ UCL_Device::~UCL_Device() {
|
|
|
|
clear();
|
|
|
|
clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int UCL_Device::set_platform(const int pid) {
|
|
|
|
int UCL_Device::set_platform(const int) {
|
|
|
|
clear();
|
|
|
|
clear();
|
|
|
|
#ifdef UCL_DEBUG
|
|
|
|
#ifdef UCL_DEBUG
|
|
|
|
assert(pid<num_platforms());
|
|
|
|
assert(pid<num_platforms());
|
|
|
|
|