mpi_cholesky_distributed.c 2.0 KB

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