Unverified Commit 35d4ce90 authored by Tom Benson's avatar Tom Benson Committed by GitHub
Browse files

Handle hipErrorFileNotFound gracefully in ROCm 7 (#5303)

parent fc21fd19
......@@ -184,7 +184,7 @@ HipContext::HipContext(const System& system, int deviceIndex, bool useBlockingSy
hostMallocFlags = hipHostMallocDefault;
#if !defined(WIN32)
// hipHostMallocNumaUser may not be allowed in some conditions, for example, if docker container
// hipHostMallocNumaUser may not be allowed in some conditions, for example, if docker container
// is created without --security-opt seccomp=unconfined or --cap-add=SYS_NICE
int* tmpHostBuffer;
if(hipHostMalloc(&tmpHostBuffer, sizeof(*tmpHostBuffer), hipHostMallocNumaUser) == hipSuccess) {
......@@ -589,6 +589,16 @@ hipModule_t HipContext::createModule(const string source, const map<string, stri
loadedModules.push_back(module);
return module;
}
else {
// Need to call hipGetLastError to clear the error code
hipError_t last_error = hipGetLastError();
if (last_error != hipErrorFileNotFound) {
std::ostringstream msg;
msg << "Detected HIP error: " << hipGetErrorString(last_error)
<< "(" << last_error << ") at " << __FILE__ << ":" << __LINE__;
throw OpenMMException(msg.str());
}
}
// Select names for the various temporary files.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment