13 #include <shogun/lib/config.h> 26 #ifdef TRACE_MEMORY_ALLOCS 32 #include <google/protobuf/stubs/common.h> 42 std::unique_ptr<SGLinalg>
sg_linalg(
nullptr);
57 void init_shogun(
void (*print_message)(FILE* target,
const char* str),
58 void (*print_warning)(FILE* target,
const char* str),
59 void (*print_error)(FILE* target,
const char* str),
60 void (*cancel_computations)(
bool &delayed,
bool &immediately))
75 #ifdef TRACE_MEMORY_ALLOCS 97 fprintf(target,
"%s", str);
108 #ifdef TRACE_MEMORY_ALLOCS 109 list_memory_allocs();
126 ::google::protobuf::ShutdownProtobufLibrary();
147 sg_parallel=parallel;
194 #ifndef SWIG // SWIG should skip this part 202 char* env_log_val = NULL;
204 env_log_val = getenv(
"SHOGUN_LOG_LEVEL");
207 if(strncmp(env_log_val,
"DEBUG", 5) == 0)
209 else if(strncmp(env_log_val,
"WARN", 4) == 0)
211 else if(strncmp(env_log_val,
"ERROR", 5) == 0)
216 char* env_warnings_val = NULL;
218 env_warnings_val = getenv(
"SHOGUN_GPU_WARNINGS");
219 if (env_warnings_val)
221 if (strncmp(env_warnings_val,
"off", 3) == 0)
226 char* env_thread_val = NULL;
228 env_thread_val = getenv(
"SHOGUN_NUM_THREADS");
233 int32_t num_threads = std::stoi(std::string(env_thread_val));
236 SG_WARNING(
"The specified SHOGUN_NUM_THREADS environment (%s)" 237 "variable could not be parsed as integer!\n", env_thread_val);
void set_num_threads(int32_t n)
void init_shogun(void(*print_message)(FILE *target, const char *str), void(*print_warning)(FILE *target, const char *str), void(*print_error)(FILE *target, const char *str), void(*cancel_computations)(bool &delayed, bool &immediately))
void set_loglevel(EMessageType level)
void set_global_version(Version *version)
void set_global_math(CMath *math)
void(* sg_print_warning)(FILE *target, const char *str)
function called to print warning messages
void init_shogun_with_defaults()
std::unique_ptr< SGLinalg > sg_linalg
CMath * get_global_math()
void(* sg_print_error)(FILE *target, const char *str)
function called to print error messages
Parallel * get_global_parallel()
void(* sg_cancel_computations)(bool &delayed, bool &immediately)
function called to cancel things
the class CMap, a map based on the hash-table. w: http://en.wikipedia.org/wiki/Hash_table ...
Class Version provides version information.
void set_global_parallel(Parallel *parallel)
void(* sg_print_message)(FILE *target, const char *str)
function called to print normal messages
: Pseudo random number geneartor
SGLinalg * get_global_linalg()
Class Parallel provides helper functions for multithreading.
all of classes and functions are contained in the shogun namespace
Version * get_global_version()
Class which collects generic mathematical functions.
void set_global_rand(CRandom *rand)
void sg_global_print_default(FILE *target, const char *str)
void set_global_io(SGIO *io)
Class SGIO, used to do input output operations throughout shogun.
CRandom * get_global_rand()
void set_linalg_warnings(bool enable_warnings=true)