3333#include " dpctl_sycl_type_casters.hpp"
3434#include " dpctl_utils_helper.h"
3535#include < algorithm>
36- #include < cstring >
36+ #include < sstream >
3737#include < stddef.h>
3838#include < sycl/sycl.hpp> /* SYCL headers */
3939#include < utility>
@@ -918,19 +918,19 @@ bool DPCTLDevice_CanAccessPeer(__dpctl_keep const DPCTLSyclDeviceRef DRef,
918918 BE1 != sycl::backend::ext_oneapi_cuda &&
919919 BE1 != sycl::backend::ext_oneapi_hip)
920920 {
921- error_handler ( " Backend " + std::to_string ( static_cast < int >(BE1)) +
922- " does not support peer access" ,
923- __FILE__, __func__, __LINE__);
921+ std::ostringstream os;
922+ os << " Backend " << BE1 << " does not support peer access" ;
923+ error_handler (os. str (), __FILE__, __func__, __LINE__);
924924 return false ;
925925 }
926926
927927 if (BE2 != sycl::backend::ext_oneapi_level_zero &&
928928 BE2 != sycl::backend::ext_oneapi_cuda &&
929929 BE2 != sycl::backend::ext_oneapi_hip)
930930 {
931- error_handler ( " Backend " + std::to_string ( static_cast < int >(BE2)) +
932- " does not support peer access" ,
933- __FILE__, __func__, __LINE__);
931+ std::ostringstream os;
932+ os << " Backend " << BE2 << " does not support peer access" ;
933+ error_handler (os. str (), __FILE__, __func__, __LINE__);
934934 return false ;
935935 }
936936 try {
@@ -956,20 +956,18 @@ void DPCTLDevice_EnablePeerAccess(__dpctl_keep const DPCTLSyclDeviceRef DRef,
956956 BE1 != sycl::backend::ext_oneapi_cuda &&
957957 BE1 != sycl::backend::ext_oneapi_hip)
958958 {
959- error_handler (" Backend " + std::to_string (static_cast <int >(BE1)) +
960- " does not support peer access" ,
961- __FILE__, __func__, __LINE__);
962- return ;
959+ std::ostringstream os;
960+ os << " Backend " << BE1 << " does not support peer access" ;
961+ error_handler (os.str (), __FILE__, __func__, __LINE__);
963962 }
964963
965964 if (BE2 != sycl::backend::ext_oneapi_level_zero &&
966965 BE2 != sycl::backend::ext_oneapi_cuda &&
967966 BE2 != sycl::backend::ext_oneapi_hip)
968967 {
969- error_handler (" Backend " + std::to_string (static_cast <int >(BE2)) +
970- " does not support peer access" ,
971- __FILE__, __func__, __LINE__);
972- return ;
968+ std::ostringstream os;
969+ os << " Backend " << BE2 << " does not support peer access" ;
970+ error_handler (os.str (), __FILE__, __func__, __LINE__);
973971 }
974972 try {
975973 D->ext_oneapi_enable_peer_access (*PD);
@@ -993,20 +991,18 @@ void DPCTLDevice_DisablePeerAccess(__dpctl_keep const DPCTLSyclDeviceRef DRef,
993991 BE1 != sycl::backend::ext_oneapi_cuda &&
994992 BE1 != sycl::backend::ext_oneapi_hip)
995993 {
996- error_handler (" Backend " + std::to_string (static_cast <int >(BE1)) +
997- " does not support peer access" ,
998- __FILE__, __func__, __LINE__);
999- return ;
994+ std::ostringstream os;
995+ os << " Backend " << BE1 << " does not support peer access" ;
996+ error_handler (os.str (), __FILE__, __func__, __LINE__);
1000997 }
1001998
1002999 if (BE2 != sycl::backend::ext_oneapi_level_zero &&
10031000 BE2 != sycl::backend::ext_oneapi_cuda &&
10041001 BE2 != sycl::backend::ext_oneapi_hip)
10051002 {
1006- error_handler (" Backend " + std::to_string (static_cast <int >(BE2)) +
1007- " does not support peer access" ,
1008- __FILE__, __func__, __LINE__);
1009- return ;
1003+ std::ostringstream os;
1004+ os << " Backend " << BE2 << " does not support peer access" ;
1005+ error_handler (os.str (), __FILE__, __func__, __LINE__);
10101006 }
10111007 try {
10121008 D->ext_oneapi_disable_peer_access (*PD);
0 commit comments