GMT.jl is not thread capable

Open
#564 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia

Research direction

Start by reproducing the failure with Threads.nthreads(), Threads.@threads, and repeated grdgradient(G, A=0) calls. Read the gmt() process and API-session handling described in the issue, then verify that concurrent calls use independent sessions and no longer produce duplicate-option errors.

Written by the indexing model from the issue text.

Description

Made this experiment

julia> Threads.nthreads()
6

julia> G = GMT.peaks(N=2000);

julia> @time for k=1:20 grdgradient(G, A=0); end
  9.382858 seconds (160.01 M allocations: 2.683 GiB, 4.60% gc time)

julia> @time Threads.@threads for k=1:20 grdgradient(G, A=0); end
grdgradient [ERROR]: Option -n given more than once
grdgradient [ERROR]: Option -n parsing failure. Correct syntax:
...

The problem is very likely that all threads are using the same API session and mess follows as it has to be.
The solution seems to be to create a mechanism where each new thread launches a new gmt() process with its own API session.

Dominant language
Julia
Stars
222
Forks
35
Avg merge
8h 1m
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GenericMappingTools/GMT.jl

All issues in GenericMappingTools/GMT.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.