Function global_init

Source
pub fn global_init(pargc: *mut i32, pargv: *mut *mut *mut u8) -> bool
Expand description

| ———– | @brief | | Initialize the global environment | of caffe2. | | Caffe2 uses a registration pattern | for initialization functions. Custom | initialization functions should take | the signature bool (func)(int, char***) | where the pointers to argc and argv are | passed in. Caffe2 then runs the initialization | in three phases: | | (1) Functions registered with | REGISTER_CAFFE2_EARLY_INIT_FUNCTION. | | Note that since it is possible the logger | is not initialized yet, any logging | in such early init functions may not | be printed correctly. | | (2) Parses Caffe-specific commandline | flags, and initializes caffe logging. | | (3) Functions registered with | REGISTER_CAFFE2_INIT_FUNCTION. | | If there is something wrong at each stage, | the function returns false. If the global | initialization has already been run, | the function returns false as well. | | GlobalInit is re-entrant safe; a re-entrant | call will no-op and exit. | | GlobalInit is safe to call multiple | times but not idempotent; successive | calls will parse flags and re-set caffe2 | logging levels from flags as needed, | but NOT re-run early init and init functions. | | GlobalInit is also thread-safe and | can be called concurrently. |