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

Multi GPU #202

Merged
merged 7 commits into from
Oct 26, 2023
Merged

Multi GPU #202

merged 7 commits into from
Oct 26, 2023

Conversation

martindevans
Copy link
Member

@martindevans martindevans commented Oct 20, 2023

Added support for multi GPU in the model config.

This is a litte rough at the moment. The IModelParams.TensorSplits array length must be <= NativeApi.llama_max_devices(). If it's too small it's padded up to size (with zeroes). If it's too large the ToLlamaModelParams method throws. I'd rather not require the user to query the native API directly, and I'd rather the error were caught at config time.

This is exposed through a TensorSplitsCollection on the IModelParams interface. The collection can be indexed into (like an array) and automatically has the correct size. There is no way to change the size, preventing incorrect usage.

  • Tested with multiple GPUs

@martindevans
Copy link
Member Author

Note that this PR breaks Newtonsoft.Json serialization of IModelParams. System.Text.Json still works fine.

Last time we discussed this I don't think anyone was particularly interested in supporting JSON serialization at all and I only added it because it was very easy to do.

@martindevans
Copy link
Member Author

Some discussion about this PR over in #189.

@martindevans
Copy link
Member Author

Tested by swiftress on Discord and confirmed working (https://discord.com/channels/1106946823282761851/1106947264938790972/1166937319664795689)

@martindevans martindevans merged commit 321d0b5 into SciSharp:master Oct 26, 2023
4 checks passed
@martindevans martindevans deleted the multi_gpu branch October 26, 2023 13:40
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

Successfully merging this pull request may close these issues.

1 participant