Files
rocm-systems/projects/rocr-runtime/rocrtst/samples/rocm_async/os.cpp
T
Ramesh Errabolu d4972f3c67 Benchmark copy of data from one pool to another pool either in
one or both directions. Users can enumerate the pools reported
  by system to specify which pools serve as source / destination

Change-Id: I8e6d0adb3743b3328dd3ce9152762ca840ea613b


[ROCm/ROCR-Runtime commit: c2caa5ae2c]
2017-10-04 20:53:25 -04:00

50 wiersze
1.1 KiB
C++

// Compiling for Windows Platform
#ifdef _WIN32
#include "os.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
void SetEnv(const char* env_var_name, const char* env_var_value) {
bool err = SetEnvironmentVariable(env_var_name, env_var_value);
if (false == err) {
printf("Set environment variable failed!\n");
exit(1);
}
return;
}
char* GetEnv(const char* env_var_name) {
char* buff;
DWORD char_count = GetEnvironmentVariable(env_var_name, NULL, 0);
if (char_count == 0) return NULL;
buff = (char*)malloc(sizeof(char) * char_count);
GetEnvironmentVariable(env_var_name, buff, char_count);
buff[char_count - 1] = '\0';
return buff;
}
#endif // End of Windows Code
// Compiling for Linux Platform
#ifdef __linux__
#include "os.hpp"
#include <stdlib.h>
void SetEnv(const char* env_var_name, const char* env_var_value) {
int err = setenv(env_var_name, env_var_value, 1);
if (0 != err) {
printf("Set environment variable failed!\n");
exit(1);
}
return;
}
char* GetEnv(const char* env_var_name) { return getenv(env_var_name); }
#endif // End of Linux Code