Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7726619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:15:39+00:00 2026-06-01T05:15:39+00:00

With parallelpython, I am trying to convert my old serial code to parallel, which

  • 0

With parallelpython, I am trying to convert my old serial code to parallel, which heavily relies on objects that have methods that change that object’s variables. A stripped example in which I omit the syntax in favor of simplicity:

class Network:
    self.adjacency_matrix = [ ... ]
    self.state = [ ... ]
    self.equilibria = [ ... ]

...

   def populate_equilibria(self):
       # this function takes every possible value that self.state can be in
       # runs the boolean dynamical system 
       # and writes an integer within self.equilibria for each self.state
       # doesn't return anything

I call this method as:
Code:

j1 = jobserver.submit(net2.populate_equilibria,(),(),("numpy as num"))

The job is sumbitted, and I know that a long computation takes place, so I speculate that my code is ran.

The problem is, i am new to parallelpython , I was expecting that, when the method is called, the variable net2.equilibria would be written accordingly, and I would get a revised object (net2) . That is how my code works, independent objects with methods that act upon the object’s variables.

Rather, though the computation is apparent, and reasonably timed, the variable net2.equilibria remains unchanged.
As if PP only takes the function and the object, computes it elsewhere, but never returns the object, so I am left with the old one.

What do I miss?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:15:40+00:00Added an answer on June 1, 2026 at 5:15 am

    ParallelPython does not work this way. When you submit a function to the job server, you get a handle which you can call to get the result of the computation. This is the only way to get the result of your computation. Local objects are not modified by distant concurrent processes.

    What you should do is wrap your method invocation inside a function which returns the new state of the object:

    def populate_equilibria (obj):
        obj.populate_equilibria()
        return obj
    
    j1 = jobserver.submit(populate_equilibria,(net2,),(),("numpy as num"))
    net2 = j1()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whats a simple code that does parallel processing in python 2.7? All the examples
I have a function (neural network model) which produces figures. I wish to test
I have a python script that works great when run by itself. Based on
I have a python program running using a parallel python. This module scales my
I have written a simple program using parallel python, and all works well. However,
I'm using parallel-python and start a new job server in a function. after the
A python script is running two parallel python processes ( created via os.fork() )
I'm using ParallelPython to develop a performance-critical script. I'd like to share one value
Is there any easy way to make 2 methods, let's say MethodA() and MethodB()
I have a list. It contains x lists, each with y elements. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.