diff --git a/ttg/ttg/device.h b/ttg/ttg/device.h new file mode 100644 index 000000000..769a147bf --- /dev/null +++ b/ttg/ttg/device.h @@ -0,0 +1,15 @@ +#ifndef TTG_DEVICE_H +#define TTG_DEVICE_H + +#include "ttg/fwd.h" + +namespace ttg { + namespace device { + std::size_t get_nb() { return TTG_IMPL_NS::device::get_nb(); } + void *memory_allocate(int did, std::size_t size) { return TTG_IMPL_NS::device::memory_allocate(did, size); } + void memory_free(int did, void *p) { TTG_IMPL_NS::device::memory_free(did, p); } + ttg::ExecutionSpace execution_space(int did) { return TTG_IMPL_NS::device::execution_space(did); } + } +} + +#endif /* TTG_DEVICE_H */ \ No newline at end of file diff --git a/ttg/ttg/madness/fwd.h b/ttg/ttg/madness/fwd.h index d12ddfd83..e5fd5273e 100644 --- a/ttg/ttg/madness/fwd.h +++ b/ttg/ttg/madness/fwd.h @@ -46,10 +46,10 @@ namespace ttg_madness { inline void ttg_broadcast(ttg::World world, T &data, int source_rank); namespace device { - std::size_t nb(); - void *allocate(int did, std::size_t size); - void free(int did, void *ptr); - ttg::ExecutionSpace space(int did); + std::size_t get_nb(); + void *memory_allocate(int did, std::size_t size); + void memory_free(int did, void *ptr); + ttg::ExecutionSpace execution_space(int did); } } // namespace ttg_madness diff --git a/ttg/ttg/madness/ttg.h b/ttg/ttg/madness/ttg.h index 96497cf46..65c8cc60c 100644 --- a/ttg/ttg/madness/ttg.h +++ b/ttg/ttg/madness/ttg.h @@ -1278,20 +1278,20 @@ namespace ttg_madness { #include "ttg/make_tt.h" namespace device { - std::size_t nb() { return 1; } - void *allocate(int did, std::size_t size) { + std::size_t get_nb() { return 1; } + void *memory_allocate(int did, std::size_t size) { if(did != 0) { throw std::out_of_range("TTG MADNESS Backend does not support other devices than CPU at this time"); } return ::malloc(size); } - void free(int did, void *ptr) { + void memory_free(int did, void *ptr) { if(did != 0) { throw std::out_of_range("TTG MADNESS Backend does not support other devices than CPU at this time"); } ::free(ptr); } - ttg::ExecutionSpace space(int did) { + ttg::ExecutionSpace execution_space(int did) { if(did != 0) { throw std::out_of_range("TTG MADNESS Backend does not support other devices than CPU at this time"); } diff --git a/ttg/ttg/parsec/fwd.h b/ttg/ttg/parsec/fwd.h index 06c4dadf4..d0bb0a60b 100644 --- a/ttg/ttg/parsec/fwd.h +++ b/ttg/ttg/parsec/fwd.h @@ -67,12 +67,12 @@ namespace ttg_parsec { static void ttg_broadcast(ttg::World world, T &data, int source_rank); namespace device { - std::size_t nb(); - void *allocate(int did, std::size_t size); - void free(int did, void *ptr); - ttg::ExecutionSpace space(int did); + std::size_t get_nb(); + void *memory_allocate(int did, std::size_t size); + void memory_free(int did, void *ptr); + ttg::ExecutionSpace execution_space(int did); } - + #if 0 template inline std::pair>...>> get_ptr(Args&&... args); diff --git a/ttg/ttg/parsec/ttg.h b/ttg/ttg/parsec/ttg.h index 77991551c..9a7ee37fa 100644 --- a/ttg/ttg/parsec/ttg.h +++ b/ttg/ttg/parsec/ttg.h @@ -3510,7 +3510,7 @@ namespace ttg_parsec { static int *ttg_devid; } - std::size_t nb() { + std::size_t get_nb() { if(0 != detail::nb_ttg_devices) return detail::nb_ttg_devices; detail::ttg_devid = new int[parsec_nb_devices]; for(int i = 0; i < parsec_nb_devices; i++) { @@ -3531,8 +3531,8 @@ namespace ttg_parsec { return detail::nb_ttg_devices; } - void *allocate(int did, std::size_t size) { - if(did >= nb()) { + void *memory_allocate(int did, std::size_t size) { + if(did >= get_nb()) { throw std::out_of_range("TTG PaRSEC - device identifier out of range"); } if(0 == did) @@ -3545,8 +3545,8 @@ namespace ttg_parsec { return zone_malloc(gm->memory, size); } - void free(int did, void *ptr) { - if(did >= nb()) { + void memory_free(int did, void *ptr) { + if(did >= get_nb()) { throw std::out_of_range("TTG PaRSEC - device identifier out of range"); } if(0 == did) { @@ -3560,8 +3560,8 @@ namespace ttg_parsec { zone_free(gm->memory, ptr); } - ttg::ExecutionSpace space(int did) { - if(did >= nb()) { + ttg::ExecutionSpace execution_space(int did) { + if(did >= get_nb()) { throw std::out_of_range("TTG PaRSEC - device identifier out of range"); } if(0 == did) { diff --git a/ttg/ttg/util/device.h b/ttg/ttg/util/device.h deleted file mode 100644 index 76567f5ea..000000000 --- a/ttg/ttg/util/device.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef TTG_UTILS_DEVICE_H -#define TTG_UTILS_DEVICE_H - -#include "ttg/fwd.h" - -namespace ttg { - std::size_t nb_device() { return TTG_IMPL_NS::device::nb(); } - void *device_allocate(int did, std::size_t size) { return TTG_IMPL_NS::device::allocate(did, size); } - void device_free(int did, void *p) { TTG_IMPL_NS::device::free(did, p); } - ttg::ExecutionSpace device_space(int did) { return TTG_IMPL_NS::device::space(did); } -} - -#endif /* TTG_UTILS_DEVICE_H */ \ No newline at end of file