system.h 975 Bytes
Newer Older
Tim Moon's avatar
Tim Moon committed
1
/*************************************************************************
2
 * Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Tim Moon's avatar
Tim Moon committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 * See LICENSE for license information.
 ************************************************************************/

#ifndef TRANSFORMER_ENGINE_COMMON_UTIL_SYSTEM_H_
#define TRANSFORMER_ENGINE_COMMON_UTIL_SYSTEM_H_

#include <string>

namespace transformer_engine {

/*! \brief Get environment variable and convert to type
 *
 * If the environment variable is unset or empty, a falsy value is
 * returned.
 */
template <typename T = std::string>
20
T getenv(const char *variable);
Tim Moon's avatar
Tim Moon committed
21
22
23

/*! \brief Get environment variable and convert to type */
template <typename T = std::string>
24
T getenv(const char *variable, const T &default_value);
Tim Moon's avatar
Tim Moon committed
25
26
27
28
29
30
31

/*! \brief Check if a file exists and can be read */
bool file_exists(const std::string &path);

}  // namespace transformer_engine

#endif  // TRANSFORMER_ENGINE_COMMON_UTIL_SYSTEM_H_