1 #include "caffe2/core/init.h" 2 #include "caffe2/core/operator.h" 6 CAFFE2_DEFINE_bool(caffe2_version,
false,
7 "Print Caffe2 version and build options on startup");
12 Caffe2InitializeRegistry* Caffe2InitializeRegistry::Registry() {
13 static Caffe2InitializeRegistry gRegistry;
19 static bool global_init_was_already_run =
false;
21 if (global_init_was_already_run) {
22 VLOG(1) <<
"GlobalInit has already been called: did you double-call?";
25 global_init_was_already_run =
true;
27 success &= internal::Caffe2InitializeRegistry::Registry()
28 ->RunRegisteredEarlyInitFunctions(pargc, pargv);
29 CAFFE_ENFORCE(success,
30 "Failed to run some early init functions for caffe2.");
32 success &= InitCaffeLogging(pargc, *pargv);
34 if (VLOG_IS_ON(1) || FLAGS_caffe2_version) {
35 std::cerr <<
"Caffe2 build configuration: " << std::endl;
36 for (
const auto& it : GetBuildOptions()) {
37 std::cerr <<
" " << std::setw(25) << std::left << it.first <<
" : " 38 << it.second << std::endl;
42 success &= internal::Caffe2InitializeRegistry::Registry()
43 ->RunRegisteredInitFunctions(pargc, pargv);
45 global_init_was_already_run =
false;
47 CAFFE_ENFORCE(success,
48 "Failed to run some init functions for caffe2.");
bool GlobalInit(int *pargc, char ***pargv)
Initialize the global environment of caffe2.
bool ParseCaffeCommandLineFlags(int *pargc, char ***pargv)
Parses the commandline flags.
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...