Skip to content
This repository has been archived by the owner on Mar 18, 2023. It is now read-only.

Possible TPU crash #36

Open
staticfloat opened this issue Feb 22, 2019 · 0 comments
Open

Possible TPU crash #36

staticfloat opened this issue Feb 22, 2019 · 0 comments

Comments

@staticfloat
Copy link
Collaborator

Base.@pure calc_rounds(L; exponent=3) = ceil(UInt32, exponent * log(L) / log(typemax(UInt32)))
function shuffle(x::XRTArray)
    rounds = calc_rounds(length(x))
    round_idx = XRTArray(rounds)
    while round_idx > XRTArray(0)
        keys = rand(XRTArray{UInt32}, length(x))
        x = sort(x, keys=keys)
        # Commenting this out crashes the TPU
        #round_idx -= XRTArray(1)
    end
    return x
end
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant