pydatastructs icon indicating copy to clipboard operation
pydatastructs copied to clipboard

Implementing C++ Backend for Python APIs

Open czgdp1807 opened this issue 3 years ago • 3 comments

Description of the problem

We are starting off with implementing different backends for our APIs. C++ will be the first one to be implemented. We are planning to include both in our next release. Though not all APIs will be covered till the next release. However having as much as possible will be great. Following is a list of questions and task that needs to be considered for this issue,

  • [ ] How to call C++ code from Python? - I am thinking to provide an optional keyword argument which will help in selecting the backend to be used. For example, in case of quick sort, the call would look like, quick_sort(input_array, backend=pydatastructs.Backend.CPP) or quick_sort(input_array, backend=pydatastructs.Backend.Cython). If backend parameter is not provided then, the most efficient backend will be used. For example, quick_sort will automatically select the right backend according to the benchmarks we have.
  • [ ] File Structure - This mainly concerns to C++ backend. I am thinking to create one .h and .cpp file for one API. For example, OneDimensionalArray will be implemented in a different .cpp file and MultiDimensionalArray will be implemented in a different .cpp file. Note both these kind of arrays are in the same python file. The reason for separating codes is to disconnect the API implementations internally. This will also help in reducing the binary size of each implementation. If compilation of one fails then that won't effect the usage of others.
  • [ ] #438
  • [ ] Build system to be used - I am leaning towards Meson as it's easier to deal with as compared to CMake, it's modern and is recently being adopted by libraries like SciPy.
  • [x] #433

Example of the problem

References/Other comments

[1] https://github.com/orgs/codezonediitj/projects/1/views/1

cc: @pratikgl

czgdp1807 avatar Nov 19 '21 13:11 czgdp1807

Regarding unordered_map alternatives we should benchmark all the implementations and the decide. There is no well designed benchmark for this purpose AFAIK.

czgdp1807 avatar Nov 19 '21 14:11 czgdp1807

I am determined to work for this issue. I don't know Cython but good at C++ for algorithm implementations and all. I wanted to contribute for this. Can I get to know what role can I do to resolve this issue? I would like to work on this issue under GSoC 2023.

Abekaesh avatar Mar 25 '23 06:03 Abekaesh

Can I get to know what role can I do to resolve this issue?

This is a long term issue. Please read the description and write your proposal accordingly.

czgdp1807 avatar Mar 25 '23 10:03 czgdp1807