Skip to content

GSoC_2020_project_interfaces

Fernando J. Iglesias García edited this page Feb 2, 2020 · 2 revisions

SWIG interfaces: Matlab, Javascript (NodeJs)

One of Shogun's biggest strengths is that it supports a wide range of programming languages via binding interfaces. This project is about extending Shogun interfaces to support Matlab and Javascript.

Mentors

Difficulty & Requirements

Medium.

You will need to know about or get up-to-speed with

  • SWIG
  • Shogun's modular interface framework (C/C++)
  • Matlab (or similar, Octave, Scilab)
  • Javascript
  • Shogun's meta example / testing framework (Python)
  • Cmake

Description

This project is about adding new interfaced languages. We want to focus on two extremely important ones: Matlab and Javascript. The former is used heavily by the scientific community (in which Shogun has its roots) while the latter is very interesting for commercial applications of Shogun.

Details

Shogun over the years changed its face: we first only had static interfaces. Those are hand-crafted and every new algorithm needs to be added manually. This is cumbersome and leads to many parts not being visible from outside C++. Then the world became a better place and we started using SWIG. SWIG allows to automatically generate interfaces to a large range of target languages automatically. Every class added to Shogun is exposed to all languages with adding one line to the interface file. Magic.

Adding interfaces means writing typemaps for each target language. Essentially the typemaps define conversions of memory representations between the target language and Shogun. Since we already have many typemaps for the languages currently supported, they can be used for inspiration or starting point (making the task way easier!).

Next, we need to extend the meta example generation system to include the new languages. This requires understanding the existing Python code, and extend where needed.

Finally, all new languages should be added to the cmake build and test system.

Waypoints and initial work

For each langauge:

  • Build working proof of concept with minimal (or nop) typemaps (see here and here for javascript)
  • Integrate into build
  • Extend typemaps to cover all cases
  • Integrate meta examples, cookbook, test suite
  • Make sure integration tests (=all interfaces produce the same results) pass (i.e. your typemaps work correctly)

Why this is cool

Everyone wants Matlab and javascript interfaces, you will be a star! You will learn a lot about SWIG (which is amazing), software testing, and the magic sauce behind Shogun's biggest strength: automagic interfacing to all programming languages. All in all, this is a real-world software engineering project. As an added bonus, you will get to know and could work with people from other open source projects like SWIG - share the GSoC love!

Useful resources

Clone this wiki locally