Skip to content
New issue

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

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

Open
giordano opened this issue Jan 21, 2025 · 1 comment
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Comments

@giordano
Copy link
Member

giordano commented Jan 21, 2025

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

if CUDA.functional()
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;
}
@giordano giordano added bug Something isn't working enhancement New feature or request labels Jan 21, 2025
@mofeing mofeing added the good first issue Good for newcomers label Jan 21, 2025
@mofeing
Copy link
Collaborator

mofeing commented Jan 21, 2025

we also need to check for the platform name to check if we are on CPU or GPU:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants