@@ -69,10 +69,12 @@ class CCommInitOpAscend : public framework::OperatorBase {
6969 for (int32_t idx = 0 ; idx < size; idx++) {
7070 input[idx] = 1.0 ;
7171 }
72- aclrtMalloc (reinterpret_cast <void **>(&buff), size * sizeof (float ),
73- ACL_MEM_MALLOC_HUGE_FIRST);
74- aclrtMemcpy (reinterpret_cast <void *>(buff), size * sizeof (float ),
75- input.data (), size * sizeof (float ), ACL_MEMCPY_HOST_TO_DEVICE);
72+ PADDLE_ENFORCE_NPU_SUCCESS (aclrtMalloc (reinterpret_cast <void **>(&buff),
73+ size * sizeof (float ),
74+ ACL_MEM_MALLOC_HUGE_FIRST));
75+ PADDLE_ENFORCE_NPU_SUCCESS (aclrtMemcpy (
76+ reinterpret_cast <void *>(buff), size * sizeof (float ), input.data (),
77+ size * sizeof (float ), ACL_MEMCPY_HOST_TO_DEVICE));
7678 VLOG (3 ) << " Build buff data successful." ;
7779
7880 aclrtStream stream = nullptr ;
@@ -83,8 +85,8 @@ class CCommInitOpAscend : public framework::OperatorBase {
8385 auto dev_ctx = platform::DeviceContextPool::Instance ().Get (place);
8486 stream = static_cast <platform::NPUDeviceContext*>(dev_ctx)->stream ();
8587 }
86- platform::dynload::HcclBroadcast (buff, size, HCCL_DATA_TYPE_FP32, 0 ,
87- comm->comm (), stream);
88+ PADDLE_ENFORCE_NPU_SUCCESS ( platform::dynload::HcclBroadcast (
89+ buff, size, HCCL_DATA_TYPE_FP32, 0 , comm->comm (), stream) );
8890 VLOG (3 ) << " Build connection successful." ;
8991#else
9092 PADDLE_THROW (platform::errors::PreconditionNotMet (
0 commit comments