config.cc 809 Bytes
Newer Older
1
/**
2
 *  Copyright (c) 2019 by Contributors
3
4
 * @file runtime/config.cc
 * @brief DGL runtime config
5
6
7
 */

#include <dgl/runtime/config.h>
8
#include <dgl/runtime/registry.h>
9
10
11
12
13
14

using namespace dgl::runtime;

namespace dgl {
namespace runtime {

15
void Config::EnableLibxsmm(bool b) { libxsmm_ = b; }
16

17
bool Config::IsLibxsmmAvailable() const { return libxsmm_; }
18
19

DGL_REGISTER_GLOBAL("global_config._CAPI_DGLConfigSetLibxsmm")
20
21
22
23
    .set_body([](DGLArgs args, DGLRetValue* rv) {
      bool use_libxsmm = args[0];
      dgl::runtime::Config::Global()->EnableLibxsmm(use_libxsmm);
    });
24
25

DGL_REGISTER_GLOBAL("global_config._CAPI_DGLConfigGetLibxsmm")
26
27
28
    .set_body([](DGLArgs args, DGLRetValue* rv) {
      *rv = dgl::runtime::Config::Global()->IsLibxsmmAvailable();
    });
29
30
31

}  // namespace runtime
}  // namespace dgl