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

thread local variable / storage #127

Open
benneti opened this issue May 11, 2022 · 0 comments
Open

thread local variable / storage #127

benneti opened this issue May 11, 2022 · 0 comments

Comments

@benneti
Copy link

benneti commented May 11, 2022

Hi,
I'd like to implement something like

@floop for _λ in Iterators.product(1:5,1:5,1:5)
    let λ = [ 1, _λ... ] # TODO it would be nice if we could have one per thread
            λ .= λ ./ sqrt( norm(λ) )
            m = f(λ)
            @reduce() do (_min = Inf; m), (λmin = zeros(4); λ)
                if gm < _min
                    _min = gm
                    λmin .= λ
                end
            end
      end
end

where instead of the let λ I have one λ per thread to minimize garbage collection when the product-space size gets really large.

Is this possible with the implementation of the multithreading?

@benneti benneti changed the title thread local variable thread local variable / storage May 13, 2022
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

No branches or pull requests

1 participant