1 #ifdef COMPILATION_INSTRUCTIONS 2 (echo '#include"'$0'"'>$0.cpp)&& `#nvcc -ccbin=cuda-`c++ -D_TEST_MULTI_MEMORY_ADAPTORS_CUDA_MANAGED_MALLOC $0.cpp -o $0x -lcudart &&$0x&&rm $0x; exit 3 #endif 4 5 #ifndef MULTI_MEMORY_ADAPTORS_CUDA_MANAGED_MALLOC_HPP 6 #define MULTI_MEMORY_ADAPTORS_CUDA_MANAGED_MALLOC_HPP 7 8 #include "../../../adaptors/cuda/managed/clib.hpp" 9 #include "../../../adaptors/cuda/managed/ptr.hpp" 10 11 namespace boost{namespace multi{ 12 namespace memory{ 13 14 namespace cuda{ 15 16 namespace managed{ 17 #if __cplusplus >= 201703L 18 #if __has_cpp_attribute(nodiscard) >= 201603L 19 [[nodiscard]] 20 #endif 21 #endif 22 managed::ptr<void> malloc(size_t bytes){return managed::ptr<void>{Cuda::Managed::malloc(bytes)};} 23 void free(managed::ptr<void> p){Cuda::Managed::free(static_cast<void*>(p));} 24 } 25 26 } 27 28 } 29 }} 30 31 #ifdef _TEST_MULTI_MEMORY_ADAPTORS_CUDA_MANAGED_MALLOC 32 33 int main(){ 34 } 35 36 #endif 37 #endif 38