Fix AMD_LOG_LEVEL_SIZE env variable (#2463)
AMD_LOG_LEVEL_SIZE is being used in a global variable. This always uses the default value of 2048 because the HIP runtime doesn't have the opportunity to load environment variables at the point where global variables are initialized. The solution is to use AMD_LOG_LEVEL_SIZE inside truncate_log_file() function.
This commit is contained in:
committad av
GitHub
förälder
35a5274b84
incheckning
61325db1c8
@@ -40,13 +40,14 @@
|
||||
namespace amd {
|
||||
|
||||
FILE* outFile = stderr;
|
||||
const size_t maxLogSize = AMD_LOG_LEVEL_SIZE * Mi;
|
||||
|
||||
// ================================================================================================
|
||||
void truncate_log_file() {
|
||||
if (outFile != stderr) {
|
||||
fseek(outFile, 0, SEEK_END);
|
||||
long size = ftell(outFile);
|
||||
|
||||
const size_t maxLogSize = AMD_LOG_LEVEL_SIZE * Mi;
|
||||
if (size > maxLogSize) {
|
||||
if (nullptr == freopen(NULL, "w", outFile)) {
|
||||
outFile = stderr;
|
||||
|
||||
Referens i nytt ärende
Block a user