Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Multithreading #230

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

WIP: Multithreading #230

wants to merge 8 commits into from

Conversation

ranjanan
Copy link
Member

@ranjanan ranjanan commented Apr 13, 2020

Error I'm stuck on just now: when I'm running multi-threaded, I get NaNs for my voltages

@ranjanan
Copy link
Member Author

Steps to reproduce:

  1. Check out Circuitscape with this branch.
  2. Start Julia with multiple threads
  3. From the REPL run, buzz = Ref{Any}() and foo = Vector{Any}()
  4. Run cd(joinpath(pkgdir(Circuitscape), "test")
  5. Run compute(test_problem("sgVerify1.ini")

@ViralBShah
Copy link
Member

What exactly are you multi-threading here? I couldn't tell from the diff - so would help to have a quick explanation.

@ranjanan
Copy link
Member Author

I am trying to spawn several tasks that independently solve linear systems and generate and write current maps

@ViralBShah
Copy link
Member

@ranjanan Can you document what you tried here and experiments with RR?

@vlandau vlandau linked an issue May 5, 2020 that may be closed by this pull request
@ViralBShah ViralBShah mentioned this pull request May 9, 2020
@ranjanan
Copy link
Member Author

Currently runs but with returns incorrect result on raster pairwise. PR for AMG submitted: JuliaLinearAlgebra/AlgebraicMultigrid.jl#68

@ViralBShah
Copy link
Member

Say I have 4 cores, and hence 4 threads, but I spawn 100 solves. Won't those 100 solves be concurrently updating this data structure, unless you schedule the solves to ensure that each processor is only working on one solve at a time?

I think you need to implement locking in the AMG code, so that each thread that is solving has a lock on the AMG data structure until its job is done, you should get it to work correctly.

@vlandau
Copy link
Member

vlandau commented Aug 6, 2021

Won't those 100 solves be concurrently updating this data structure, unless you schedule the solves to ensure that each processor is only working on one solve at a time?

I had a similar issue with Omniscape, which is why I had to expand the array along a third dimension, with one slice per thread -- not the most ideal solution memory-wise, but not sure what the lock/unlock overhead might be with so many solves (can be one solve per second or even faster).

@ViralBShah
Copy link
Member

Seeing errors with SharedArrays makes me feel that we really should just get multi-threading done. I feel like we were really close the last time and need to correctly handle a couple of races in AMG.

@ranjanan
Copy link
Member Author

ranjanan commented Mar 4, 2022

Yes, you are right. Trying to find bandwidth, which is a little elusive.

@ranjanan
Copy link
Member Author

ranjanan commented Mar 4, 2022

Will try to make a push this month

@ViralBShah ViralBShah marked this pull request as draft August 11, 2023 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use multi-threading
3 participants