#include "acl/acl.h"
#include <iostream>
int32_t deviceId = 0;
void InitResource()
{
aclError ret = aclInit(nullptr);
if (ret != ACL_SUCCESS) {
std::cerr << "aclInit failed, ret = " << ret << std::endl;
exit(1);
}
ret = aclrtSetDevice(deviceId);
if (ret != ACL_SUCCESS) {
std::cerr << "aclrtSetDevice failed, ret = " << ret << std::endl;
exit(1);
}
}
void DestroyResource()
{
aclError ret = aclrtResetDevice(deviceId);
aclFinalize();
}
int main()
{
InitResource();
std::cout << "ACL resources initialized successfully." << std::endl;
const char* socName = aclrtGetSocName();
if (socName != nullptr) {
std::cout << "SoC Name: " << socName << std::endl;
} else {
std::cout << "Failed to get SoC name (returned nullptr)." << std::endl;
}
DestroyResource();
std::cout << "ACL resources released successfully." << std::endl;
return 0;
}