ggml-mpi.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //go:build mpi
  2. /**
  3. * llama.cpp - git 3ebb00935f3f0522b75df49c2769ab1774b91380
  4. *
  5. * MIT License
  6. *
  7. * Copyright (c) 2023 Georgi Gerganov
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documentation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in all
  17. * copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  25. * SOFTWARE.
  26. */
  27. #pragma once
  28. struct ggml_context;
  29. struct ggml_tensor;
  30. struct ggml_cgraph;
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. struct ggml_mpi_context;
  35. void ggml_mpi_backend_init(void);
  36. void ggml_mpi_backend_free(void);
  37. struct ggml_mpi_context * ggml_mpi_init(void);
  38. void ggml_mpi_free(struct ggml_mpi_context * ctx);
  39. int ggml_mpi_rank(struct ggml_mpi_context * ctx);
  40. void ggml_mpi_eval_init(
  41. struct ggml_mpi_context * ctx_mpi,
  42. int * n_tokens,
  43. int * n_past,
  44. int * n_threads);
  45. void ggml_mpi_graph_compute_pre(
  46. struct ggml_mpi_context * ctx_mpi,
  47. struct ggml_cgraph * gf,
  48. int n_layers);
  49. void ggml_mpi_graph_compute_post(
  50. struct ggml_mpi_context * ctx_mpi,
  51. struct ggml_cgraph * gf,
  52. int n_layers);
  53. #ifdef __cplusplus
  54. }
  55. #endif