system.h 999 Bytes
Newer Older
Tim Moon's avatar
Tim Moon committed
1
/*************************************************************************
2
 * Copyright (c) 2022-2024, 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
20
21
 *
 * See LICENSE for license information.
 ************************************************************************/

#ifndef TRANSFORMER_ENGINE_COMMON_UTIL_SYSTEM_H_
#define TRANSFORMER_ENGINE_COMMON_UTIL_SYSTEM_H_

#include <string>

#include "../common.h"

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>
22
T getenv(const char *variable);
Tim Moon's avatar
Tim Moon committed
23
24
25

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

/*! \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_