GithubHelp home page GithubHelp logo

Comments (7)

AsakusaRinne avatar AsakusaRinne commented on September 26, 2024 1

Could you please take a look of the file structure of your output directory? (x64/debug/net6.0/runtimes for example) Then please use NativeLibraryConfig.Instance.WithLogs() to see the details during backend selection.

from llamasharp.

dluc avatar dluc commented on September 26, 2024

Test 1: only CPU nuget

Time taken: 29 secs

<PackageReference Include="LLamaSharp" />

<PackageReference Include="LLamaSharp.Backend.Cpu" />
[LLamaSharp Native] [Info] NativeLibraryConfig Description:
- Path: 
- PreferCuda: True
- PreferredAvxLevel: AVX2
- AllowFallback: True
- SkipCheck: False
- Logging: True
- SearchDirectories and Priorities: { ./ }
[LLamaSharp Native] [Info] Detected OS Platform: WINDOWS
[LLamaSharp Native] [Info] Detected cuda major version 12.
[LLamaSharp Native] [Info] Tried to load runtimes/win-x64/native/cuda12/libllama.dll but failed.
[LLamaSharp Native] [Info] ./runtimes/win-x64/native/avx2/libllama.dll is selected and loaded successfully.
image

Test 2: only CUDA 12 nuget

Time taken: 22 secs

<PackageReference Include="LLamaSharp" />
<PackageReference Include="LLamaSharp.Backend.Cuda12" />
[LLamaSharp Native] [Info] NativeLibraryConfig Description:
- Path: 
- PreferCuda: True
- PreferredAvxLevel: AVX2
- AllowFallback: True
- SkipCheck: False
- Logging: True
- SearchDirectories and Priorities: { ./ }
[LLamaSharp Native] [Info] Detected OS Platform: WINDOWS
[LLamaSharp Native] [Info] Detected cuda major version 12.
[LLamaSharp Native] [Info] ./runtimes/win-x64/native/cuda12/libllama.dll is selected and loaded successfully.

Under "native" there's only one folder with the DLL inside:
image

Test 3: both CPU and CUDA 12 nugets

Time taken: 29 secs

<PackageReference Include="LLamaSharp" />

<PackageReference Include="LLamaSharp.Backend.Cpu" />

<PackageReference Include="LLamaSharp.Backend.Cuda12" />
[LLamaSharp Native] [Info] NativeLibraryConfig Description:
- Path: 
- PreferCuda: True
- PreferredAvxLevel: AVX2
- AllowFallback: True
- SkipCheck: False
- Logging: True
- SearchDirectories and Priorities: { ./ }
[LLamaSharp Native] [Info] Detected OS Platform: WINDOWS
[LLamaSharp Native] [Info] Detected cuda major version 12.
[LLamaSharp Native] [Info] ./runtimes/win-x64/native/cuda12/libllama.dll is selected and loaded successfully.

FunctionalTests\bin\Debug\net7.0\runtimes:
image

FunctionalTests\bin\Debug\net7.0\runtimes\win-x64\native:
image
image

from llamasharp.

dluc avatar dluc commented on September 26, 2024

@AsakusaRinne so everything looks ok from the logs, but as you can see the time taken doesn't match.

  • Test 1: only CPU nuget - Time taken: 29 secs
  • Test 2: only CUDA 12 nuget - Time taken: 22 secs
  • Test 3: both CPU and CUDA 12 nugets - Time taken: 29 secs

from llamasharp.

AsakusaRinne avatar AsakusaRinne commented on September 26, 2024

If you delete the libllama.dll at the root of output path, would the time taken act as expected? Note that after removing the file, please don't re-compile the project.

from llamasharp.

martindevans avatar martindevans commented on September 26, 2024

Also you could try adding a breakpoint in here. From there you can see the exact set of binaries it's going to try (libraryTryLoadOrder) and which one it succeeds on.

from llamasharp.

dluc avatar dluc commented on September 26, 2024

I've created a new project to run these tests and taken the steps to manually delete the DLL files. Interestingly, in this new project, the performance timings between cuda12 and avx2 are too close to definitively say if there's an issue. For the time being, I'm placing my trust in the logs. If an opportunity arises where I can obtain a machine with a more powerful Nvidia card, I'll conduct further tests where the performance gap would likely be more evident.

from llamasharp.

AsakusaRinne avatar AsakusaRinne commented on September 26, 2024

@dluc If needed, you could set GpuLayerCount a larger number to increase the time gap between cpu version and gpu version.

from llamasharp.

Related Issues (20)

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.