Adding support for reading Environmental variable for samples (#186)
* check if env var set and choose device
* clean up for env var
* app modification
* move getEnvVar function to header
* fork example
* spacing adjust
* review comments
* use hipGetErrorName to throw errors
[ROCm/rocdecode commit: 8ec38d2d24]
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e416b5a192
Коммит
a186a42593
@@ -1078,3 +1078,15 @@ bool RocVideoDecoder::InitHIP(int device_id) {
|
||||
HIP_API_CALL(hipStreamCreate(&hip_stream_));
|
||||
return true;
|
||||
}
|
||||
|
||||
int GetEnvVar(const char *name, int &dev_count) {
|
||||
char *v = std::getenv(name);
|
||||
if (v) {
|
||||
char* p_tkn = std::strtok(v, ",");
|
||||
while (p_tkn != nullptr) {
|
||||
dev_count++;
|
||||
p_tkn = strtok(nullptr, ",");
|
||||
}
|
||||
}
|
||||
return dev_count;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ THE SOFTWARE.
|
||||
#include <queue>
|
||||
#include <stdexcept>
|
||||
#include <exception>
|
||||
#include <cstring>
|
||||
#include <hip/hip_runtime.h>
|
||||
extern "C" {
|
||||
#include "libavutil/md5.h"
|
||||
@@ -149,6 +150,8 @@ typedef struct ReconfigParams_t {
|
||||
uint32_t reconfig_flush_mode;
|
||||
} ReconfigParams;
|
||||
|
||||
int GetEnvVar(const char *name, int &dev_count);
|
||||
|
||||
class RocVideoDecoder {
|
||||
public:
|
||||
/**
|
||||
|
||||
Ссылка в новой задаче
Block a user