Skip to content

Instantly share code, notes, and snippets.

Avatar

Giovanni De Toni geektoni

View GitHub Profile
View gist:fbedaad5874cf66e69195d241cacf394
Scanning dependencies of target libshogun
[ 5%] Building CXX object src/shogun/CMakeFiles/libshogun.dir/distance/Distance.cpp.o
/tmp/ccfEJFLM.s: Assembler messages:
/tmp/ccfEJFLM.s:200: Error: symbol `_ZNSt17_Function_handlerIFbvEN6shogunUlvE_EE9_M_invokeERKSt9_Any_data' is already defined
/tmp/ccfEJFLM.s:1023: Error: symbol `_ZNSt14_Function_base13_Base_managerIN6shogunUlvE_EE10_M_managerERSt9_Any_dataRKS4_St18_Manager_operation' is already defined
src/shogun/CMakeFiles/libshogun.dir/build.make:15718: recipe for target 'src/shogun/CMakeFiles/libshogun.dir/distance/Distance.cpp.o' failed
make[2]: *** [src/shogun/CMakeFiles/libshogun.dir/distance/Distance.cpp.o] Error 1
CMakeFiles/Makefile2:126: recipe for target 'src/shogun/CMakeFiles/libshogun.dir/all' failed
make[1]: *** [src/shogun/CMakeFiles/libshogun.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
View CSignal prototypes.cpp
init_shogun(bool active=true) {
Some<CSignal> sg_signal = some<CSignal>(active);
std::signal(SIGINT, sg_signal.handler());
std::signal(SIGURG, sg_signal.handler());
}
CSignal {
View Shogun Style Guidelines.md

Shogun Style Guidelines

Shogun is a large project with many contributors and we have decided to define some general coding guidelines which form a "Shogun Standard" which should be followed when writing code for the toolbox. That was made to maintain a clean and polished code-base. Shogun use an automatic style checker (namely Clang Format) to verify if code follows Shogun's coding guidelines. Please make sure that your patches conform to these guidelines, otherwise our Continuous Integration tools will spot these errors and they will mark your pull requests as failed.

You can use our custom script, located in <your_shogun_source_dir>/scripts/check_format.sh to see if the code you have written follows our guidelines. The script will also give you instruction on how to fix style errors. Note that to use the script, clang-format-3.8 must be installed on your system.

Formatting Guidelines

Function Parameters

View handler_example.cpp
#include <shogun/base/init.h>
#include <shogun/base/some.h>
#include <shogun/labels/BinaryLabels.h>
#include <shogun/lib/SGVector.h>
#include <shogun/lib/Signal.h>
#include <shogun/machine/Machine.h>
#include <iostream>
#include <thread>
using namespace shogun;
View pause_computation.cpp
#include <shogun/base/init.h>
#include <shogun/base/some.h>
#include <shogun/labels/BinaryLabels.h>
#include <shogun/lib/SGVector.h>
#include <shogun/lib/Signal.h>
#include <shogun/machine/Machine.h>
#include <iostream>
#include <thread>
using namespace shogun;
View TB_example.cpp
#include <shogun/base/init.h>
#include <shogun/base/some.h>
#include <shogun/labels/BinaryLabels.h>
#include <shogun/lib/SGVector.h>
#include <shogun/lib/Signal.h>
#include <shogun/machine/Machine.h>
#include <shogun/lib/ParameterObserverScalar.h>
#include <shogun/lib/any.h>
#include <vector>
View keykeykey
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCS9R0xqyV9L701mLdXgvdAo1eUNWud2Jv6Kc+VgHJReZ/aq+qQxP0eNJhgpL5S0cTqzylBNT8EeSkqSYgtE0aqyaIOAS9cWxkWV9836moXgj0uWqO5UYjpQMVqK93f8ek+NAGbJmvJpBdC9LAN13qM4TAL3Na5Qg1RZI+eX3U7yr+cyfNm38tm+N14v+gJqm6kqbC6zF4s3Rth/vLoG7VnFO2RtA9qNApX/MEprMRZNWDky7IkplnZigSg6FaQ/TGV3ofzoynwg5LEUSiPxM4Sagwt/oOZAk7Q1/0pMeCQkpxBK2B4r0CCJsV6QqiFj6GLQhRxoOLgk674/xUbudr uriel@uriel
View ObservedValue.h
// Main class (represents a single observed value)
class ObservedValue : public CSGObject
{
ObservedValue();
ObservedValue(int64_t step, std::string name, Any v);
~ObservedValue();
int64_t get_step();
std::string get_name();
View backtrace
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff0ea13fa in __GI_abort () at abort.c:89
#2 0x00007ffff0eddbd0 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff0fd2dd0 "*** Error in `%s': %s: 0x%s ***\n")
at ../sysdeps/posix/libc_fatal.c:175
#3 0x00007ffff0ee3f96 in malloc_printerr (action=3, str=0x7ffff0fd31d8 "malloc(): memory corruption (fast)", ptr=<optimized out>,
ar_ptr=<optimized out>) at malloc.c:5049
#4 0x00007ffff0ee6461 in _int_malloc (av=av@entry=0x7ffff1206b00 <main_arena>, bytes=bytes@entry=7) at malloc.c:3424
#5 0x00007ffff0ee7f34 in __GI___libc_malloc (bytes=7) at malloc.c:2928
#6 0x00007ffff5df91da in (anonymous namespace)::sg_malloc (size=7) at /home/geektoni/shogun/src/shogun/lib/memory.cpp:205
#7 0x00007ffff584fe19 in (anonymous namespace)::sg_generic_malloc<unsigned char> (len=7) at /home/geektoni/shogun/src/shogun/lib/memory.h:91
You can’t perform that action at this time.