mpi_cholesky_distributed.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2011 Université de Bordeaux 1
  4. * Copyright (C) 2010 Mehdi Juhoor <mjuhoor@gmail.com>
  5. * Copyright (C) 2010, 2011, 2012, 2013 Centre National de la Recherche Scientifique
  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 <starpu_mpi.h>
  19. #include "mpi_cholesky_models.h"
  20. #include "mpi_cholesky_codelets.h"
  21. #include "mpi_decomposition_matrix.h"
  22. #include "mpi_decomposition_params.h"
  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. ret = starpu_init(NULL);
  33. STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
  34. ret = starpu_mpi_init(&argc, &argv, 1);
  35. STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init");
  36. MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  37. MPI_Comm_size(MPI_COMM_WORLD, &nodes);
  38. starpu_cublas_init();
  39. parse_args(argc, argv, nodes);
  40. matrix_init(&bmat, rank, nodes, 0);
  41. dw_cholesky(bmat, size/nblocks, rank, nodes, &timing, &flops);
  42. starpu_mpi_shutdown();
  43. matrix_free(&bmat, rank, nodes, 0);
  44. starpu_cublas_shutdown();
  45. starpu_shutdown();
  46. if (rank == 0)
  47. {
  48. fprintf(stdout, "Computation time (in ms): %2.2f\n", timing/1000);
  49. fprintf(stdout, "Synthetic GFlops : %2.2f\n", (flops/timing/1000.0f));
  50. }
  51. return 0;
  52. }