| 128 | |
| 129 | template<typename T> |
| 130 | T *pinnedAlloc(const size_t &elements) { |
| 131 | // TODO: make pinnedAlloc aware of array shapes |
| 132 | dim4 dims(elements); |
| 133 | void *ptr = pinnedMemoryManager().alloc(false, 1, dims.get(), sizeof(T)); |
| 134 | return static_cast<T *>(ptr); |
| 135 | } |
| 136 | |
| 137 | void pinnedFree(void *ptr) { pinnedMemoryManager().unlock(ptr, false); } |
| 138 |