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

PackageCompiler fails with Flux on embedded ARM/no GPU #2262

Closed
cirobr opened this issue Jun 9, 2023 · 5 comments
Closed

PackageCompiler fails with Flux on embedded ARM/no GPU #2262

cirobr opened this issue Jun 9, 2023 · 5 comments

Comments

@cirobr
Copy link

cirobr commented Jun 9, 2023

Hello,

Have added detailed description on Julia Discourse regarding execution failure of precompiled apps when Flux is invoked and the hardware has no GPU. Please refer to this link for details: click here

It appears the root cause is tied to the fact that CUDA package (and a number of CUDA artifacts) are part of Flux' dependency list.

The issue became a roadblock to implement Julia ML apps on embedded ARM. Perhaps the project may want to consider a GPU-agnostic approach? Simple ML apps may need only multi-core (no GPU) to run.

Thanks in advance.

@cirobr cirobr changed the title PackageCompiler fails with Flux on embeded ARM/no GPU PackageCompiler fails with Flux on embedded ARM/no GPU Jun 9, 2023
@ToucheSir
Copy link
Member

Looking through the Discourse thread, I think the problem is not specific to CUDA.jl but with something odd about your environment. I'd recommend reporting it with the usual JuliaGPU help channels.

To your comments on the same thread, the reason Flux depends on CUDA by default is the same reason PyTorch or TensorFlow do: it was the only game in town and there isn't (or wasn't) any other way to add GPU functionality given limitations of the package manager. We go to great lengths to make sure that the CUDA functionality is only activated when you ask for it, but we can't control what happens at install time. It may just be that your environment is sufficiently weird that it hits an edge case the CUDA.jl maintainers weren't thinking of, because they also go to great lengths to make sure CUDA.jl doesn't try to load GPU functionality unnecessarily on platforms which don't support it.

Perhaps the project may want to consider a GPU-agnostic approach?

See above. Note that Flux does support AMDGPU.jl through the very recent package extensions mechanism, but because its so new and we need to maintain backwards compat (with earlier versions of Flux and Julia), the CUDA.jl default path remains. It's not for lack of trying too: we want to do the same for CUDA.jl eventually, but unless someone figures out a way around the roadblocks in FluxML/NNlib.jl#492 (comment) we're presently stuck. Perhaps you know people who could help with that?

@cirobr
Copy link
Author

cirobr commented Jun 9, 2023

Thanks for the insight. The environment has just Flux on it, and the code is as long as "using Flux; println()". Machine is plain Oracle instance of AArch64 + Ubuntu 22.04, no extras. Of course, the issue was found on a much more complex environment and much more complex code. The reporting of the issue reflects personal effort by removing non relevant code to the root cause analysis and to collaborate on the improvement of such a great package as Flux is.

I'll try other avenues, including those suggestions.

Thanks.

@ToucheSir
Copy link
Member

I would try installing and importing CUDA.jl in a fresh environment. No calling functions, just import/using. If you can get that working, you should be able to use Flux without much issue.

@CarloLucibello
Copy link
Member

CarloLucibello commented Jul 11, 2023

CUDA is now supported through extensions, so this should be fixed

@cirobr
Copy link
Author

cirobr commented Jul 12, 2023

CUDA is now supported through extensions, so this should be fixed

Thanks for the feedback. I've run my code against the latest updates. Problem is indeed gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants