mpi_cholesky_distributed.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2011, 2017 Université de Bordeaux
  4. * Copyright (C) 2010 Mehdi Juhoor <mjuhoor@gmail.com>
  5. * Copyright (C) 2010, 2011, 2012, 2013, 2015 CNRS
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #include "mpi_cholesky.h"
  19. /* This is the same as matrix_decomposition, but the matrix is not allocated in
  20. * totality on all nodes, thus allowing much bigger matrices, but doesn't allow
  21. * trivial checks */
  22. int main(int argc, char **argv)
  23. {
  24. /* create a simple definite positive symetric matrix example
  25. *
  26. * Hilbert matrix : h(i,j) = 1/(i+j+1)
  27. * */
  28. float ***bmat;
  29. int rank, nodes, ret;
  30. double timing, flops;
  31. ret = starpu_init(NULL);
  32. STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
  33. ret = starpu_mpi_init(&argc, &argv, 1);
  34. STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init");
  35. starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
  36. starpu_mpi_comm_size(MPI_COMM_WORLD, &nodes);
  37. starpu_cublas_init();
  38. parse_args(argc, argv, nodes);
  39. matrix_init(&bmat, rank, nodes, 0);
  40. dw_cholesky(bmat, size/nblocks, rank, nodes, &timing, &flops);
  41. starpu_mpi_shutdown();
  42. matrix_free(&bmat, rank, nodes, 0);
  43. starpu_cublas_shutdown();
  44. starpu_shutdown();
  45. if (rank == 0)
  46. {
  47. FPRINTF(stdout, "Computation time (in ms): %2.2f\n", timing/1000);
  48. FPRINTF(stdout, "Synthetic GFlops : %2.2f\n", (flops/timing/1000.0f));
  49. }
  50. return 0;
  51. }