.. _program_listing_file_src_sparsebase_converter_converter_cuda.cu: Program Listing for File converter_cuda.cu ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/sparsebase/converter/converter_cuda.cu``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "converter_cuda.cuh" #include "sparsebase/context/cpu_context.h" #include "sparsebase/context/cuda_context_cuda.cuh" #include "sparsebase/converter/converter.h" #include "sparsebase/format/cuda_csr_cuda.cuh" #include "sparsebase/format/format.h" #include "sparsebase/format/format_order_one.h" #include "sparsebase/format/format_order_two.h" namespace sparsebase::converter { bool CUDAPeerToPeer(context::Context *from, context::Context *to) { if (!(to->get_id() == context::CUDAContext::get_id_static() || from->get_id() == context::CUDAContext::get_id_static())) return false; auto from_gpu = static_cast(from); auto to_gpu = static_cast(to); int can_access; cudaDeviceCanAccessPeer(&can_access, from_gpu->device_id, to_gpu->device_id); return can_access; } } // namespace sparsebase::converter