[Contents] [TitleIndex] [WordIndex

logo.jpg

GSoC 2017 - Matlab Mex Files Wrapper

Student and Mentors

Student Name -

Mentors -

Timeline for GSoC 2017

This timeline is for after the students projects were announced on 4th of May, 2017.

Overview

The main aim of this project is to provide a wrapper of Matlab MEX-Files headers on the current API Scilab. By using the MEX-Files wrapper the toolboxes in Matlab will be very easy to port to Scilab and also existing libraries using Matlab MEX could be directly used in Scilab. A module - mexlib module already exists in Scilab which is compatible with the Matlab-Mex API. Extending the current module and writing tests for each extension will be the major part of the project. Adding tests and a working demo for the already existing MEX functions will be included.

Community Bonding

The community bonding period was from May 5 - 30, 2017.

Tasks

Description

Status

Discussing with mentors the workflow and get a final idea of how to approach the project.

Here I was told by my mentors to go through the existing module and the tests.

Done

Boost my knowledge about the API’s and skills required for the project.

I went through the Scilab API 6 help wiki and some of the examples to get a better understanding of the API.

Done

Get acquainted with the code base and exploring the Matlab Mex module examples and documentation to get a complete understanding of the module.

Re-iteration of going through the code base and the existing module plus going through the mex examples distributed with MATLAB.

Done

Make final changes to any open bugs/coverity issues.

Commit made for Bug #6701, Coverity fix : CID #1098686, CID #1360807.

Pending

(1.) Findings and updates from the community bonding period -

(2.) There is no proper help/documentation for the usage of mex in Scilab. There is no list of functions which are present in the "mexlib" module in Scilab. So it is very difficult for users to use mex files without any proper help pages. The bugs related to this are as follows -

(3.) There are many functions which are still not present in the "mexlib" module in Scilab, that are there in the MEX API of MATLAB. (These have been mentioned in my proposal but am re-listing them here for reference)

* MEX Library API:
  * mexCallMATLABWithTrap()
  * mexEvalStringWithTrap()
  * mexGet()
  * mexSet()
  * mexPrintf(.) - size limit not defined currently
  * mexSetTrapFlag()
  * mexErrMsgIdAndTxt()
  * mexWarnMsgIdAndTxt()
  * mexIsLocked()
  * mexLock()
  * mexUnlock()
  * mexMakeArrayPersistent()
  * mexMakeMemoryPersistent()

 * Create or Delete Array:
  * mxCreateUninitNumericMatrix()
  * mxCreateUninitNumericArray()
  * mxCreateSparseLogicalMatrix()
  * mxCreateSparse()
  * mxCalloc()
  * mxMalloc()
  * mxRealloc()
  * mxFree()

 * Validate Data:
  * mxIsScalar()
  * mxIsClass() - does not handle class name and class id
  * mxIsSparse()
  * mxIsFromGlobalWS()

 * Convert Data Types
  * mxArrayToUTF8String()

 * Access Data
  * mxSetClassName()
  * mxSetDimensions() - mxIsSparse() is not handled.
  * mxGetProperty()
  * mxSetProperty()
  * mxRemoveField()
  * mxGetNzmax()
  * mxSetNzmax()
  * mxGetIr()
  * mxSetIr()
  * mxGetJc()
  * mxSetJc()

Coding Period Begins May 30, 2017

My mentor suggested that I should select an already existing toolbox for mex to focus my dev on. One can also refer the mex examples which are distributed with MATLAB, so that we can say that the Scilab mex is fully compatible with atleast all the MATLAB mex modules.

Here are some of the modules which I shortlisted, but I feel they are too "big" for including as a working demo with Scilab. (also they are dependent on external libraries)

Week 1-2 Report (May 31, 2017 - June 14, 2017)

Tasks

Description

Status

Write tests for the already existing mexlib module.

Worked on writing tests for the functions which did not have test coverage. (These functions are identified in the above section).

Done

Finding corner cases and boundary conditions for the functions.

The tests for the functions have to be written with care.

Done

Resolve bugs related to the Mex module in the Bug Tracker - MEX Module Bugs Link

Most of the issues/bugs related to mex are lack of proper documentation or help for the usage. It is given here - Mex Bugs

Ongoing

Findings, updates and achievements from weeks 1 and 2 -

Commits made during this period - (Mostly for the adding the tests for the functions)

Week 3-4 Report (May 15, 2017 - June 26, 2017)

Tasks

Description

Status

Get everything merged in the master branch and fix any kind of issues arising during implementation or clearing any backlog.

Made final commits for some of coverity issues and bugs I was working on. (Although some still are pending review and further refactor.)

Done

Continue writing the tests for the already existing module and finish with all the tests for the mx* and mex* functions.

All the tests for the existing module were written in the past weeks. Now we could add more tests for solid coverage. (Will add tests for the new functions as they are implemented.)

Done

Work on the unresolved bugs related to the Mex module in the Bug Tracker - MEX Module Bugs Link

As mentioned earlier, most of the bugs in the bug tracker are due to lack of proper help.

Ongoing

Identify the areas which still use the old Scilab API.

Did identify some regions which use the old API. Like the mxCreateNumeric functions.

Done

Upgrade the current implementation to use the new API for Scilab 6.

Some work done.

Ongoing

Write documentation for the functions and usage of the mexlib module. This will be added to the Scilab help system.

The layout was identified in the last couple of weeks. It still has to be worked upon.

Ongoing

Findings, updates and achievements from weeks 3 and 4 -

Commits made during this period - (Modified functions and new functions implemented along with their tests)

Next plan of action

Will be working on the following in the upcoming weeks -

Week 5-6 Report (July 4, 2017 - July 17, 2017)

Tasks

Description

Status

Implement the functions which are missing from the current module and have been listed in Part 1 of the Project Proposal.

The functions left have to be implemented.

Done (some left)

Write unit tests for each function which has been implemented.

The tests were written for the functions which were implemented.

Done

Week 7-8 Report (July 18, 2017 - July 23, 2017)

Tasks

Description

Status

Get everything merged in the master branch and fix any kind of issues arising during implementation or clearing any backlog.

The backlog was reviewed and merged.

Done

Continue with the implementation of the missing functions.

The functions left have to be implemented.

Done

Write unit tests for each function which has been implemented.

The tests were written for the functions which were implemented.

Done

Get the code ready for the Phase 2 evaluation and fix any kind of issues which might arise.

Fix any errors and get your code merged.

Ongoing

Findings, updates and achievements from weeks 3 and 4 -

Note - Carried forward from phase 1 - The implementation for mxCreateSparse is incomplete because still have to figure out how to handle/use the "nzmax" variable. Same is the issue with mxCreateSparseLogicalMatrix function.

Commits made during weeks 5-8 (Modified functions and new functions implemented along with their tests)

final work report ongoing

Week 9-10 Report (July 24, 2017 - August 6, 2017)

Tasks

Description

Status

Get the code ready for the Phase 2 evaluation and fix any kind of issues which might arise.

If everything works fine then jump to the next task.

Done

Get finished with the implementation of all the missing functions.

The remaining functions which were left (for which Scilab API was present) were implemented.

Done*

Write unit tests for each function which has been implemented.

The tests were written for the functions which were implemented.

Done

Note - *All the functions for which Scilab API is present have been implemented. The list of functions which have not been implemented or are not compatible with Scilab will be listed at the end. (Have to discuss this with my mentors).

Week 11-12 Report (August 7, 2017 - August 21, 2017)

Tasks

Description

Status

Write documentation and demonstrate with the help of examples the use of the MEX API for existing MEX based libraries. Explaining in detail how each function works.

Add pages to the Scilab help system for user reference

Done

Write a working demo for the Mex module for Scilab.

This would be a working example for reference.

Pending

Findings, updates and achievements from weeks 3 and 4 -

Note - Carried forward from phase 1 and phase 2 - The implementation for mxCreateSparse is incomplete because still have to figure out how to handle/use the "nzmax" variable. Same is the issue with mxCreateSparseLogicalMatrix function.

Commits made during weeks 9-12 (Modified functions and new functions implemented along with their tests)

Updates on August 25, 2017. Some points to note and comments after discussion with my mentor -

Note - There maybe still somethings left to do, which are indicated by the "TODO" comments or other appropriate comments in the mexlib.cpp file.

My Commits

Link

CategoryHomepage


2022-09-08 09:27