33
33
#include " dpctl_sycl_type_casters.hpp"
34
34
#include " dpctl_utils_helper.h"
35
35
#include < algorithm>
36
- #include < cstring >
36
+ #include < sstream >
37
37
#include < stddef.h>
38
38
#include < sycl/sycl.hpp> /* SYCL headers */
39
39
#include < utility>
@@ -918,19 +918,19 @@ bool DPCTLDevice_CanAccessPeer(__dpctl_keep const DPCTLSyclDeviceRef DRef,
918
918
BE1 != sycl::backend::ext_oneapi_cuda &&
919
919
BE1 != sycl::backend::ext_oneapi_hip)
920
920
{
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__);
924
924
return false ;
925
925
}
926
926
927
927
if (BE2 != sycl::backend::ext_oneapi_level_zero &&
928
928
BE2 != sycl::backend::ext_oneapi_cuda &&
929
929
BE2 != sycl::backend::ext_oneapi_hip)
930
930
{
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__);
934
934
return false ;
935
935
}
936
936
try {
@@ -956,20 +956,18 @@ void DPCTLDevice_EnablePeerAccess(__dpctl_keep const DPCTLSyclDeviceRef DRef,
956
956
BE1 != sycl::backend::ext_oneapi_cuda &&
957
957
BE1 != sycl::backend::ext_oneapi_hip)
958
958
{
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__);
963
962
}
964
963
965
964
if (BE2 != sycl::backend::ext_oneapi_level_zero &&
966
965
BE2 != sycl::backend::ext_oneapi_cuda &&
967
966
BE2 != sycl::backend::ext_oneapi_hip)
968
967
{
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__);
973
971
}
974
972
try {
975
973
D->ext_oneapi_enable_peer_access (*PD);
@@ -993,20 +991,18 @@ void DPCTLDevice_DisablePeerAccess(__dpctl_keep const DPCTLSyclDeviceRef DRef,
993
991
BE1 != sycl::backend::ext_oneapi_cuda &&
994
992
BE1 != sycl::backend::ext_oneapi_hip)
995
993
{
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__);
1000
997
}
1001
998
1002
999
if (BE2 != sycl::backend::ext_oneapi_level_zero &&
1003
1000
BE2 != sycl::backend::ext_oneapi_cuda &&
1004
1001
BE2 != sycl::backend::ext_oneapi_hip)
1005
1002
{
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__);
1010
1006
}
1011
1007
try {
1012
1008
D->ext_oneapi_disable_peer_access (*PD);
0 commit comments