bugGNU Octave - Bugs: bug #58676, spmd keyword


bug #58676: spmd keyword

Submitted by:  Andrew Janke <apjanke>
Submitted on:  Mon 29 Jun 2020 02:22:33 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  3 - Low Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Wed 01 Jul 2020 09:47:21 PM UTC, comment #8: 

Works fine now.  Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Wed 01 Jul 2020 08:00:35 PM UTC, comment #7: 
John W. Eaton <jwe>
Project Administrator
Wed 01 Jul 2020 04:03:17 PM UTC, comment #6: 

To just make it a no-op, I could have done something simpler.  Instead of creating a new command type, I could have made the block return a statement list object directly.  But I thought it was worth doing the extra work to set things up so that it would be easier in the future to make the spmd block do the real job just by modifying a function in the evaluator (well, after adding the necessary infrastructure to support a parallel server thing).

My quick test worked and I didn't see the segfault.  I'll check that out.

John W. Eaton <jwe>
Project Administrator
Wed 01 Jul 2020 03:25:33 PM UTC, comment #5: 

This is why I worry about the future.  I looked at the changeset jwe checked in and I would not have figured that this many changes were required just to implement a no-op block.

I verified that spmd/end blocks work as expected, but spmd/endspmd blocks produce a segfault.

octave:1> spmd
> disp ('hello');
> disp ('world');
> endspmd
octave-gui: libinterp/parse-tree/token.cc:133: octave::token::end_tok_type octave::token::ettype() const: Assertion `m_type_tag == ettype_token' failed.
fatal: caught signal Aborted -- stopping myself...
Abort (core dumped)

Rik <rik5>
Project Administrator
Tue 30 Jun 2020 08:22:05 PM UTC, comment #4: 

👍 I think that's all that's really needed. To make `spmd` actually do SPMD, you're basically gonna need a whole toolbox, and the Parallel ain't there yet from what I've seen. But with this change, code will actually run; it'll just be slower.

Thank you for your attention to this!

Andrew Janke <apjanke>
Tue 30 Jun 2020 08:08:38 PM UTC, comment #3: 

I pushed the following changeset:


We'll need a lot more to really support spmd blocks but this change will at least allow the commands in spmd blocks to execute serially.

John W. Eaton <jwe>
Project Administrator
Tue 30 Jun 2020 04:56:32 PM UTC, comment #2: 

Sounds good. Thank you!

Andrew Janke <apjanke>
Tue 30 Jun 2020 04:53:09 PM UTC, comment #1: 

I think this is a good idea just to future proof Octave a bit, and allow Matlab code to run in Octave.

I added 'spmd', 'endspmd' as keywords in this changeset: https://hg.savannah.gnu.org/hgweb/octave/rev/6e8a9845d118.

I documented them, but this isn't a perfect changeset.  What should happen is that spmd is accepted, but ignored, and the block of code executes normally in the Octave interpreter.  At the moment, 'spmd' produces a syntax error from the parser.  I'm adding jwe to the CC list since he can fix this faster than I can learn the code to figure out how to make this a no-op statement.

Rik <rik5>
Project Administrator
Mon 29 Jun 2020 02:22:33 PM UTC, original submission:  

In Matlab, spmd is a keyword. It defines an `spmd ... end` block for use in the Parallel Computing Toolbox, but is part of the core language syntax (kind of like parfor). iskeyword('spmd') answers true.


Should Octave add "spmd" as a keyword, reserved for future use, for Matlab compatibility, and to allow easy non-breaking introduction of this feature in the future?

Andrew Janke <apjanke>


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

Attach Files:

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 jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by apjanke (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-01 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2020-06-30 jwe Item GroupMatlab Compatibility => Feature Request
        StatusIn Progress => Ready For Test
    2020-06-30 rik5 Priority5 - Normal => 3 - Low
        StatusNone => In Progress
        Carbon-Copy- => Added jwe

    Back to the top

    Powered by Savane 3.5