1 #include "caffe2/core/init.h" 3 #ifndef CAFFE2_BUILD_STRING 4 #define CAFFE2_BUILD_STRING "build_version_not_set" 9 Caffe2InitializeRegistry* Caffe2InitializeRegistry::Registry() {
10 static Caffe2InitializeRegistry gRegistry;
16 static bool global_init_was_already_run =
false;
17 if (global_init_was_already_run) {
18 VLOG(1) <<
"GlobalInit has already been called: did you double-call?";
21 global_init_was_already_run =
true;
23 success &= internal::Caffe2InitializeRegistry::Registry()
24 ->RunRegisteredEarlyInitFunctions(pargc, pargv);
25 CAFFE_ENFORCE(success,
26 "Failed to run some early init functions for caffe2.");
28 success &= InitCaffeLogging(pargc, *pargv);
30 VLOG(1) <<
"Caffe2 build version: " << CAFFE2_BUILD_STRING;
32 success &= internal::Caffe2InitializeRegistry::Registry()
33 ->RunRegisteredInitFunctions(pargc, pargv);
35 global_init_was_already_run =
false;
37 CAFFE_ENFORCE(success,
38 "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.
Simple registry implementation in Caffe2 that uses static variables to register object creators durin...