EnzymeAD/Reactant.jl

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

Open

#591 建立於 2025年1月21日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)Julia (64 fork)github user discovery
bugenhancementgood first issue

倉庫指標

Star
 (336 star)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南