bugGNU Octave - Bugs: bug #57486, mex missing outdir option

 
 

bug #57486: mex missing outdir option

Submitter:  None
Submitted:  Fri 27 Dec 2019 10:26:44 AM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 16 Dec 2022 11:28:07 PM UTC, comment #12: 

I, for example, compile MEX files by calling 'mkoctfile --mex' from outside Octave so I am not sure how separate option parsing could take place.

Concerning the -outdir and -output flags, a backward-compatible way forward could be to do:

  • -outdir X: accept
  • -output Y: accept, even if Y contains a path (i..e Octave's current behavior)
  • -outdir X -output Y: accept if Y doesn't contain a path (or if path is not absolute?)
  • -outdir X -output Y: if Y has an absolute path, there's a conflict. Either throw an error or a warning and ignore X.


Not depending on liboctave for mkoctfile might be preferred but the implementation of above would require access to cross-platform equivalents of filesep, fullfile, is_absolute_filename.

Guillaume <gyom>
Fri 16 Dec 2022 02:31:23 AM UTC, comment #11: 

Would it make sense to completely separate option parsing for the mex and mkoctfile utilities?

I suppose it's OK to use functions defined in liboctave, but then we'll have to start linking the mex/mkoctfile utilities with that library?  I'm not sure whether they are now, but I don't see a reason not to if it is helpful to use functions from that library.

John W. Eaton <jwe>
Group administrator
Thu 15 Dec 2022 02:03:34 PM UTC, comment #10: 

Matlab's mex uses the `-outdir` and `output` flags to specify output directory and output filename respectively. Octave's mkoctfile uses the `--output` flag to specify the output filename but it can also be used with a full path.

When implementing `-outdir` in `mkoctfile.in.cc`, what to do if `-outdir` is used as well as `--output' with a full path?

On a side note, can I use functions defined in `file_opts.h` in `mkoctfile.in.cc`?)

Guillaume <gyom>
Mon 30 Dec 2019 06:59:15 PM UTC, comment #9: 

I think there are gray areas and which category to use is sometimes up for debate.  For example, if Octave's griddata function has never accepted 3D inputs, then I would probably say that it's a missing feature rather than a compatibility issue.  OTOH, if Octave accepts 3D inputs and does something that makes sense but is different from Matlab, then it would be a compatibility issue.  If it accepts 3D inputs and does something obviously wrong, then it would be incorrect result, unexpected error, or something else depending on the nature of the failure.

John W. Eaton <jwe>
Group administrator
Mon 30 Dec 2019 05:13:44 PM UTC, comment #8: 

@Juan: Yes to the second part of your question.  A missing function should be tagged as a "Feature Request".  "Matlab Compatibility" is where the function exists in Octave and Matlab, but behaves differently between the two.  For example, griddata in Matlab accepts both 2-D and 3-D inputs, wherease Octave's version only accepts 2-D.  This would be an example of "Incompatibility" even though it involves coding a new feature.  Finally, "Incorrect Result" is for something that is just plain wrong.  If the interpreter returned 2 + 2 = 5 that would be "Incorrect".

Rik <rik5>
Group administrator
Sat 28 Dec 2019 08:00:30 PM UTC, comment #7: 

Hey, thanks I missed that! I stand corrected.

So matlab comp., is for already existing behavior, like if -outdir did not work as expected? What is then Incorrect result?
Will all missing functions be marked as feature request?

Juan Pablo Carbajal <juanpi>
Group Member
Sat 28 Dec 2019 07:52:15 PM UTC, comment #6: 

Maybe we can share some core features so we don't have to maintain two entirely separate functions.  But there are options for mex compatibility (-R2017b, -R2018a, -largeArrayDims, -compatibleArrayDims, -client engine) that don't make sense for mkoctfile.

John W. Eaton <jwe>
Group administrator
Fri 27 Dec 2019 11:28:09 PM UTC, comment #5: 

@Juan: I changed the Item Group to Feature Request because that is the convention that we have been using since late 2018.  However, you are right that previously we used to mark anything that was different from Matlab as Matlab Compatibility.

@jwe: This seems like a minor feature which it wouldn't hurt mkoctfile to have either.  Splitting the functions seems like it will double the maintenance burden.

Rik <rik5>
Group administrator
Fri 27 Dec 2019 09:41:56 PM UTC, comment #4: 

Rik: Although Octave's mex function is currently built on top of mkoctfile, I'm not sure that makes sense now.  Matlab's mex function accepts a number of arguments now that probably don't make sense for mkoctfile.  Maybe it would be better to split mex and mkoctfile and aim for a compatible mex function?

John W. Eaton <jwe>
Group administrator
Fri 27 Dec 2019 08:57:59 PM UTC, comment #3: 

It seems to me that the -outdir option is not implemented yet, so it is a missing feature and we should set the item group to "feature request".

If the option were already present but worked in a different way, then we would set the group to "matlab compatibility".

Additional rationale is here:  https://lists.gnu.org/archive/html/octave-maintainers/2018-08/msg00058.html

John W. Eaton <jwe>
Group administrator
Fri 27 Dec 2019 08:26:34 PM UTC, comment #2: 

I do not think this is a feature request. There is at least one instance of code that works in matlab and fails in octave:

https://gitlab.com/hnickisch/gpml-matlab/blob/master/util/minfunc/mex/mexAll_matlab.m

This is a clear matlab incompatibility.

Juan Pablo Carbajal <juanpi>
Group Member
Fri 27 Dec 2019 06:18:11 PM UTC, comment #1: 

mex is based on mkoctfile so the option would need to be added to mkoctfile.in.cc first.

Rik <rik5>
Group administrator
Fri 27 Dec 2019 10:26:44 AM UTC, original submission:  

Matlab's mex accepts the outdir option to store the compiled files in a given folder.

Octave's mex accepts output to specify the output name for the mex file that can be used to also set the folder.

Hence implementing outdir seems a matter of just parsing the option and then appending to the output arguments that are currently used. I do not think one should check for the validity of the output name/folder, and I would delegate that to the system utilities to manipulate folders and files.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gyom (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by juanpi (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-27 jwe Item GroupMatlab Compatibility Feature Request
    2019-12-27 juanpi Item GroupFeature Request Matlab Compatibility
    2019-12-27 rik5 Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
        Item GroupMatlab Compatibility Feature Request
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code