Coder Social home page Coder Social logo

CUDA 4.0 compatibility about onnxruntime.jl HOT 6 CLOSED

jw3126 avatar jw3126 commented on July 29, 2024
CUDA 4.0 compatibility

from onnxruntime.jl.

Comments (6)

GunnarFarneback avatar GunnarFarneback commented on July 29, 2024

Multiple optional dependencies can be implemented with nested @requires. Something like

    @require CUDA="052768ef-5323-5732-b1bb-66c8b64840ba" begin
        CUDA.functional() && include("cuda.jl")
        @require cuDNN="02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd" begin
            CUDA.functional() && include("cudnn.jl")
        end
    end

To support both CUDA 3 and CUDA 4 requires some more conditionals in the current cuda.jl code. E.g. CUDA.libcufft has become a string in CUDA 4, so CUDA.libcufft() yields a Method Error. I would have made a PR if I had understood the role of the CUDA sub-libraries and the significance of the calls being made in cuda.jl.

from onnxruntime.jl.

jw3126 avatar jw3126 commented on July 29, 2024

This is a bit of a tricky problem. The situation is as follows:

  • To run on cuda libonnxruntime needs a bunch of other libs like libcudnn
  • Not all of these libs can easily be provided by binary builder, see #19
  • In CUDA.jl 3.0 all the required libs where shipped with CUDA.jl. So a pragmatic solution to our problem was to @require CUDA.jl and then figure out the paths to all libs shipped with CUDA.
  • CUDA.jl v4 does not ship all the libs anymore. So we would need a nested requires or perhaps CUDNN_jll as a direct dependency and CUDA.jl via requires.

Right now I do not need CUDA.jl v4 and onnxruntime gpu simultaneously. So personally I won't fix this soon, but a PR would be awesome of course.

from onnxruntime.jl.

GunnarFarneback avatar GunnarFarneback commented on July 29, 2024

Not all of these libs can easily be provided by binary builder

If I understand https://www.juliabloggers.com/cuda-jl-4-0/ correctly, this is a solved problem in CUDA.jl 4. If so I guess most of the stuff happening in cuda.jl isn't really needed with CUDA 4, except we can't control which version of CUDA gets loaded through Requires.

or perhaps CUDNN_jll as a direct dependency and CUDA.jl via requires.

CUDNN_jll brings in a couple more CUDA jlls and I suspect those are uncomfortably big for someone who only wants to run on CPU.

from onnxruntime.jl.

jw3126 avatar jw3126 commented on July 29, 2024

Not all of these libs can easily be provided by binary builder

If I understand https://www.juliabloggers.com/cuda-jl-4-0/ correctly, this is a solved problem in CUDA.jl 4. If so I guess most of the stuff happening in cuda.jl isn't really needed with CUDA 4, except we can't control which version of CUDA gets loaded through Requires.

Oh, this is awesome news. I see two paths forward:

Option 1: Get rid of Requires.jl Create a tiny ONNXRuntimeCUDA package that depends on all the jll packages that expose the CUDA libs.

Option 2: Get rid of Requires.jl obtain the cuda libs as lazy artifacts

What do you think?

or perhaps CUDNN_jll as a direct dependency and CUDA.jl via requires.

CUDNN_jll brings in a couple more CUDA jlls and I suspect those are uncomfortably big for someone who only wants to run on CPU.

Good point.

from onnxruntime.jl.

stemann avatar stemann commented on July 29, 2024

The version of CUDA can be controlled with the CUDA_Runtime_jll preference version: https://cuda.juliagpu.org/stable/installation/overview/#Specifying-the-CUDA-version

Can't Preferences.jl be exploited similarly here? E.g. to add a preference to ONNXRuntime_jll to select e.g. CPU or CUDA-artifacts - and let the rest sort itself out.

Cf. #19 (comment)

from onnxruntime.jl.

GunnarFarneback avatar GunnarFarneback commented on July 29, 2024

#32 implements support for CUDA.jl versions 4 and 5, but only for Julia 1.9 and later.

from onnxruntime.jl.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.