mpi_cholesky_distributed.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2011 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. int main(int argc, char **argv)
  20. {
  21. /* create a simple definite positive symetric matrix example
  22. *
  23. * Hilbert matrix : h(i,j) = 1/(i+j+1)
  24. * */
  25. float ***bmat;
  26. int rank, nodes, ret;
  27. double timing, flops;
  28. ret = starpu_init(NULL);
  29. STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
  30. ret = starpu_mpi_init(&argc, &argv, 1);
  31. STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init");
  32. starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
  33. starpu_mpi_comm_size(MPI_COMM_WORLD, &nodes);
  34. starpu_cublas_init();
  35. parse_args(argc, argv, nodes);
  36. matrix_init(&bmat, rank, nodes, 0);
  37. dw_cholesky(bmat, size/nblocks, rank, nodes, &timing, &flops);
  38. starpu_mpi_shutdown();
  39. matrix_free(&bmat, rank, nodes, 0);
  40. starpu_cublas_shutdown();
  41. starpu_shutdown();
  42. if (rank == 0)
  43. {
  44. FPRINTF(stdout, "Computation time (in ms): %2.2f\n", timing/1000);
  45. FPRINTF(stdout, "Synthetic GFlops : %2.2f\n", (flops/timing/1000.0f));
  46. }
  47. return 0;
  48. }