cuda_nvml.cpp 810 Bytes
Newer Older
1
2
3
4
5
6
/*************************************************************************
 * Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 *
 * See LICENSE for license information.
 ************************************************************************/

yuguo's avatar
yuguo committed
7
8
9
#ifdef USE_ROCM
#include "hip_nvml.h"
#else
10
#include "cuda_nvml.h"
yuguo's avatar
yuguo committed
11
#endif
12
13
14
15
16
17

#include "shared_lib_wrapper.h"

namespace transformer_engine {

namespace cuda_nvml {
yuguo's avatar
yuguo committed
18
#ifndef __HIP_PLATFORM_AMD__
19
20
21
22
23
24
25
26
27

/*! \brief Lazily-initialized shared library for CUDA NVML */
Library &cuda_nvml_lib() {
  constexpr char lib_name[] = "libnvidia-ml.so.1";
  static Library lib(lib_name);
  return lib;
}

void *get_symbol(const char *symbol) { return cuda_nvml_lib().get_symbol(symbol); }
yuguo's avatar
yuguo committed
28
#endif
29
30
31
}  // namespace cuda_nvml

}  // namespace transformer_engine