EnzymeAD/Reactant.jl

Need a mechanism to query whether a particular backend (e.g. CUDA) is actually available in Reactant

Open

#591 opened on Jan 21, 2025

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Julia (64 forks)github user discovery
bugenhancementgood first issue

Repository metrics

Stars
 (336 stars)
PR merge metrics
 (PR metrics pending)

Description

At the moment we're using in a couple of places CUDA.functional() to check whether CUDA is available. However that refers to CUDA.jl only, using hermetic CUDA builds of XLA (🥲) in Reactant means that that check may disagree with what's actually available in Reactant (notable current cases: CUDA < 12.1 on x86_64-linux, or any CUDA GPU on aarch64-linux). This causes tests to fail on such systems, because for example at https://github.com/EnzymeAD/Reactant.jl/blob/29627dbbd69d65dc6875f9d0b5eae2965cf6a714/test/integration/cuda.jl#L30 Reactant tries to use CUDA capabilities which aren't there.

@mofeing suggested something like

extern "C" const char* PjRtClientPlatformVersion(PjRtClient* client)
{
    auto text = client->platform_version();
    char *cstr = (char *)malloc(text.size() + 1);
    memcpy(cstr, text.data(), text.size());
    cstr[text.size()] = '\0';
    return cstr;
}

Contributor guide