Opened 6 years ago

Closed 6 years ago

#830 closed bug (not a bug)

rings returned via parallel.lib do not remember their objects

Reported by: ren Owned by: somebody
Priority: major Milestone: 4-2-0 and higher
Component: dontKnow Version: 4-1-0
Keywords: Cc:

Description

While parallelizing my code for tropical geometry, I realized that rings returned from a function called via parallel.lib do not remember their members. Is this something that is easily fixable within the current framework?

proc ttt() { ring r; ideal I; export(I); return(r); }
def r = ttt();
setring r;
listvar(); // contains I

LIB "parallel.lib";
list out = parallelWaitAll("ttt",list(list()));
def s = out[1];
setring s;
listvar(); // no I

Change History (1)

comment:1 Changed 6 years ago by steenpass

Resolution: not a bug
Status: newclosed

No, it wouldn't be easy to change this and in fact, it is not supposed to work like this. The technical background is the following: The input data for parallel tasks usually doesn't need to be sent over Singular links. It is already "there" due to the fork mechanism (copy-on-write). In contrast to this, the output data must always be sent over a link. In your case, only the ring is sent, but not the ideal.

A possible solution is to use a newstruct as in the following code:

newstruct("ideal_in_another_ring", "ring r, ideal I");

proc ttt()
{
    ring r;
    ideal I = 3*x;
    ideal_in_another_ring s;
    s.r = r;
    s.I = I;
    return(s);
}

LIB "parallel.lib";
list out = parallelWaitAll("ttt", list(list()));
def s = out[1];
def r = s.r;
setring r;
ideal I = s.I;
I;
listvar();
Note: See TracTickets for help on using tickets.