EnzymeAD/Reactant.jl

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

Open

#591 aperta il 21 gen 2025

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Julia (64 fork)github user discovery
bugenhancementgood first issue

Metriche repository

Star
 (336 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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;
}

Guida contributor