We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
reduce
I implemented a function with reduce and ThreadsX.reduce. The threads version failed.
ThreadsX.reduce
using ThreadsX feature = rand(Int, 1_000_000) target = rand(Bool, 1_000_000) function reduce_groupreduce(feature, target) zft = zip(feature, target) f_fold, t_fold = reduce((u, x) -> begin last_f = last(u[1]) target_sum = last(u[2]) f = x[1] t = x[2] if isequal(f, last_f) u[2][end] += t else push!(u[1], f) push!(u[2], t) end u end, zft; init = (feature[1:1], Int[0])) end @time reduce_groupreduce(feature, target) # this works function reduce_groupreduce(feature, target) zft = zip(feature, target) f_fold, t_fold = ThreadsX.reduce((u, x) -> begin last_f = last(u[1]) target_sum = last(u[2]) f = x[1] t = x[2] if isequal(f, last_f) u[2][end] += t else push!(u[1], f) push!(u[2], t) end u end, zft; init = (feature[1:1], Int[0])) end @time reduce_groupreduce(feature, target) # this doesn't
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I implemented a function with
reduce
andThreadsX.reduce
. The threads version failed.The text was updated successfully, but these errors were encountered: