aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/stream_executor/lib/initialize.h
blob: d1832d6b26868a84273914c039b14c4cb23e774d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef TENSORFLOW_STREAM_EXECUTOR_LIB_INITIALIZE_H_
#define TENSORFLOW_STREAM_EXECUTOR_LIB_INITIALIZE_H_

#include "tensorflow/stream_executor/platform/port.h"

#if defined(PLATFORM_GOOGLE)
#else

#undef REGISTER_MODULE_INITIALIZER

namespace perftools {
namespace gputools {
namespace port {

class Initializer {
 public:
  typedef void (*InitializerFunc)();
  explicit Initializer(InitializerFunc func) { func(); }
};

}  // namespace port
}  // namespace gputools
}  // namespace perftools

#define REGISTER_INITIALIZER(type, name, body)                               \
  static void google_init_##type##_##name() { body; }                        \
  perftools::gputools::port::Initializer google_initializer_##type##_##name( \
      google_init_##type##_##name)

#define REGISTER_MODULE_INITIALIZER(name, body) \
  REGISTER_INITIALIZER(module, name, body)

#endif  // !defined(PLATFORM_GOOGLE)

#endif  // TENSORFLOW_STREAM_EXECUTOR_LIB_INITIALIZE_H_