mpi_cholesky_distributed.c 1.9 KB

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