akielaries / openGPMP

Hardware Accelerated General Purpose Mathematics Package
https://akielaries.github.io/openGPMP/
MIT License
8 stars 3 forks source link

Expanding Language APIs #40

Closed akielaries closed 3 months ago

akielaries commented 1 year ago

At the moment a stable Python API is in place with the help of SWIG. Attempts with expanding to other languages are seen in the experiment folder, where FORTRAN, Go, R, and OCaml were explored. I was only able to successfully flesh out the API for FORTRAN, Go, and R but some cleaning up needs to do with class translation especially when it comes to C++ templates. It is also worth stating OCaml is very much in the experimental phase when it comes to the languages SWIG can work with and requires some extra effort/dependencies to get this working correctly (especially with the class translations and templates)

Some attempts were also made with creating a binding for Julia, this was attempted with the help of wrapit an open source and early stage tool for automatization of C++ ---> Julia wrapper generation. Some attempt were unsuccessfuly but this tool appears promising for using openMTPK as an import within Julia programs.

FOR CONTRIBUTORS

R: This will likely be the easiest API to get working. Some attempts were made in the R/ directory. Read up on how this is done using the SWIG documentation seen here https://www.swig.org/Doc1.3/R.html... also keep in mind generating wrappers for C++ with SWIG is not intuitive at times especially when it comes to C++ templates. SWIG requires there to be a definitive type instead of any type, therefore C++ -> R classes may require some extra design behind it. Take a look at the SWIG interface files (ending in .i) within the openmtpk folder that is used to house the Python API to copy the necessary header files into the interface file.

rahulinti79 commented 1 year ago

@akielaries I will take care of this task can you please assign to me ...

akielaries commented 1 year ago

Yup! Went ahead and assigned you @rahulinti79

rahulinti79 commented 1 year ago

@akielaries

While executing the below command I got the error that swig -r openmtpk.i openmtpk.i:15: Error: Unable to find '../../include/arithmetic/arith.hpp' openmtpk.i:16: Error: Unable to find '../../include/number_theory/primes.hpp' openmtpk.i:17: Error: Unable to find '../../include/number_theory/rc4.hpp' openmtpk.i:18: Error: Unable to find '../../include/number_theory/cipher.hpp'

it seems like path for the above files were wrong and need to update the path for those files in openmtpk.i

image