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

  • Home
  • SEARCH
  • 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 551353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:23:05+00:00 2026-05-13T11:23:05+00:00

How can multiple calculations be launched in parallel, while stopping them all when the

  • 0

How can multiple calculations be launched in parallel, while stopping them all when the first one returns?

The application I have in mind is the following: there are multiple ways of calculating a certain value; each method takes a different amount of time depending on the function parameters; by launching calculations in parallel, the fastest calculation would automatically be “selected” each time, and the other calculations would be stopped.

Now, there are some “details” that make this question more difficult:

  • The parameters of the function to be calculated include functions (that are calculated from data points; they are not top-level module functions). In fact, the calculation is the convolution of two functions. I’m not sure how such function parameters could be passed to a subprocess (they are not pickeable).
  • I do not have access to all calculation codes: some calculations are done internally by Scipy (probably via Fortran or C code). I’m not sure whether threads offer something similar to the termination signals that can be sent to processes.

Is this something that Python can do relatively easily?

  • 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-05-13T11:23:05+00:00Added an answer on May 13, 2026 at 11:23 am

    I would look at the multiprocessing module if you haven’t already. It offers a way of offloading tasks to separate processes whilst providing you with a simple, threading like interface.

    It provides the same kinds of primatives as you get in the threading module, for example, worker pools and queues for passing messages between your tasks, but it allows you to sidestep the issue of the GIL since your tasks actually run in separate processes.

    The actual semantics of what you want are quite specific so I don’t think there is a routine that fits the bill out-of-the-box, but you can surely knock one up.

    Note: if you want to pass functions around, they cannot be bound functions since these are not pickleable, which is a requirement for sharing data between your tasks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that does complex calculations for members. Each member can have
I have a filename that can have multiple dots in it and could end
I have a web application running on Tomcat. There are several calculations that need
I have added multiple JProgressBar to TableColumn of JTable . I am updating all
I've searched for adding multiple AVG calculations and have found a few entries, however
Can multiple joins be a condition? final CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Game> query =
Can multiple SSRS share the same DB? We're getting into an SSRS customization scenario,
In C#, can multiple threads read and write to a Dictionary provided each thread
Because shells other than ksh do not support pass-by-reference, how can multiple arrays be
Is registering components on castle windsor thread-safe? I.e., can multiple threads simultaneously register components

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.